From f07a244b9020bb299c9e6d1357b26b38ed90ffb3 Mon Sep 17 00:00:00 2001 From: Twilio Date: Mon, 1 Apr 2024 14:56:49 +0000 Subject: [PATCH 01/87] [Librarian] Regenerated @ 7e2caf2ef38bb07afedbc8ba24e3a235c57337ad 2deb312512e85217931fbc99141b334a5d6beaaf --- CHANGES.md | 37 + twilio/rest/__init__.py | 15 - .../rest/api/v2010/account/call/__init__.py | 80 +-- .../v2010/account/conference/participant.py | 2 + twilio/rest/content/v1/content/__init__.py | 521 +------------- .../content/v1/content/approval_create.py | 27 +- .../rest/content/v1/content/approval_fetch.py | 32 +- .../v1/service/conversation/__init__.py | 24 +- twilio/rest/flex_api/v1/plugin/__init__.py | 12 + twilio/rest/media/MediaBase.py | 44 -- twilio/rest/media/v1/__init__.py | 59 -- twilio/rest/media/v1/media_processor.py | 622 ----------------- twilio/rest/media/v1/media_recording.py | 554 --------------- .../rest/media/v1/player_streamer/__init__.py | 641 ------------------ .../v1/player_streamer/playback_grant.py | 280 -------- twilio/rest/numbers/v1/bulk_eligibility.py | 3 +- twilio/rest/numbers/v1/eligibility.py | 3 +- twilio/rest/numbers/v1/porting_port_in.py | 3 +- .../rest/numbers/v1/porting_port_in_fetch.py | 4 + .../numbers/v2/bulk_hosted_number_order.py | 3 +- twilio/rest/oauth/v1/token.py | 23 +- twilio/rest/preview_messaging/v1/message.py | 3 +- .../serverless/v1/service/build/__init__.py | 2 + twilio/rest/studio/v2/flow_validate.py | 2 + .../task_queue_bulk_real_time_statistics.py | 3 +- .../v1/compliance_registration_inquiries.py | 186 ++++- .../trusthub/v1/trust_products/__init__.py | 60 +- .../v1/room/participant/subscribe_rules.py | 2 + twilio/rest/video/v1/room/recording_rules.py | 2 + 29 files changed, 392 insertions(+), 2857 deletions(-) delete mode 100644 twilio/rest/media/MediaBase.py delete mode 100644 twilio/rest/media/v1/__init__.py delete mode 100644 twilio/rest/media/v1/media_processor.py delete mode 100644 twilio/rest/media/v1/media_recording.py delete mode 100644 twilio/rest/media/v1/player_streamer/__init__.py delete mode 100644 twilio/rest/media/v1/player_streamer/playback_grant.py diff --git a/CHANGES.md b/CHANGES.md index d5fbaebfcc..1bc063569b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,43 @@ twilio-python Changelog Here you can see the full list of changes between each twilio-python release. +[2024-04-01] Version 9.0.3 +-------------------------- +**Api** +- Add property `queue_time` to conference participant resource +- Update RiskCheck documentation +- Correct call filtering by start and end time documentation, clarifying that times are UTC. + +**Flex** +- Adding optional parameter to `plugins` + +**Media** +- Remove API: MediaProcessor + +**Messaging** +- Remove Sending-Window due to test failure +- Add Sending-Window as a response property to Messaging Services, gated by a beta feature flag + +**Numbers** +- Correct valid_until_date field to be visible in Bundles resource +- Adding port_in_status field to the Port In resource and phone_number_status and sid fields to the Port In Phone Number resource + +**Oauth** +- Modified token endpoint response +- Added refresh_token and scope as optional parameter to token endpoint + +**Trusthub** +- Add update inquiry endpoint in compliance_registration. +- Add new field in themeSetId in compliance_registration. + +**Voice** +- Correct call filtering by start and end time documentation, clarifying that times are UTC. + +**Twiml** +- Add support for new Google voices (Q1 2024) for `Say` verb - gu-IN voices +- Add support for new Amazon Polly and Google voices (Q1 2024) for `Say` verb - Niamh (en-IE) and Sofie (da-DK) voices + + [2024-03-15] Version 9.0.2 -------------------------- **Oauth** diff --git a/twilio/rest/__init__.py b/twilio/rest/__init__.py index 254d920786..c7f722642a 100644 --- a/twilio/rest/__init__.py +++ b/twilio/rest/__init__.py @@ -27,7 +27,6 @@ from twilio.rest.intelligence import Intelligence 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 @@ -136,7 +135,6 @@ def __init__( self._intelligence: Optional["Intelligence"] = None 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 @@ -329,19 +327,6 @@ def lookups(self) -> "Lookups": self._lookups = Lookups(self) return self._lookups - @property - def media(self) -> "Media": - """ - Access the Media Twilio Domain - - :returns: Media Twilio Domain - """ - if self._media is None: - from twilio.rest.media import Media - - self._media = Media(self) - return self._media - @property def preview_messaging(self) -> "PreviewMessaging": """ diff --git a/twilio/rest/api/v2010/account/call/__init__.py b/twilio/rest/api/v2010/account/call/__init__.py index b218709a2d..2ba343f566 100644 --- a/twilio/rest/api/v2010/account/call/__init__.py +++ b/twilio/rest/api/v2010/account/call/__init__.py @@ -52,8 +52,8 @@ class UpdateStatus(object): """ :ivar sid: The unique string that we created to identify this Call resource. - :ivar date_created: The date and time in GMT that this resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - :ivar date_updated: The date and time in GMT that this resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_created: The date and time in UTC that this resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in UTC that this resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. :ivar parent_call_sid: The SID that identifies the call that created this leg. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Call resource. :ivar to: The phone number, SIP address, Client identifier or SIM SID that received this call. Phone numbers are in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g., +16175551212). SIP addresses are formatted as `name@company.com`. Client identifiers are formatted `client:name`. SIM SIDs are formatted as `sim:sid`. @@ -62,8 +62,8 @@ class UpdateStatus(object): :ivar from_formatted: The calling phone number, SIP address, or Client identifier formatted for display. Non-North American phone numbers are in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g., +442071838750). :ivar phone_number_sid: If the call was inbound, this is the SID of the IncomingPhoneNumber resource that received the call. If the call was outbound, it is the SID of the OutgoingCallerId resource from which the call was placed. :ivar status: - :ivar start_time: The start time of the call, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. Empty if the call has not yet been dialed. - :ivar end_time: The time the call ended, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. Empty if the call did not complete successfully. + :ivar start_time: The start time of the call, given as UTC in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. Empty if the call has not yet been dialed. + :ivar end_time: The time the call ended, given as UTC in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. Empty if the call did not complete successfully. :ivar duration: The length of the call in seconds. This value is empty for busy, failed, unanswered, or ongoing calls. :ivar price: The charge for this call, in the currency associated with the account. Populated after the call is completed. May not be immediately available. :ivar price_unit: The currency in which `Price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g., `USD`, `EUR`, `JPY`). Always capitalized for calls. @@ -977,12 +977,12 @@ def stream( :param str from_: Only include calls from this phone number, SIP address, Client identifier or SIM SID. :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 datetime start_time: Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in UTC, 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 UTC, 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 UTC, 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 UTC, 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 UTC, 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 UTC, 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 @@ -1034,12 +1034,12 @@ async def stream_async( :param str from_: Only include calls from this phone number, SIP address, Client identifier or SIM SID. :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 datetime start_time: Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in UTC, 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 UTC, 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 UTC, 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 UTC, 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 UTC, 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 UTC, 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 @@ -1090,12 +1090,12 @@ def list( :param str from_: Only include calls from this phone number, SIP address, Client identifier or SIM SID. :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 datetime start_time: Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in UTC, 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 UTC, 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 UTC, 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 UTC, 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 UTC, 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 UTC, 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 @@ -1146,12 +1146,12 @@ async def list_async( :param str from_: Only include calls from this phone number, SIP address, Client identifier or SIM SID. :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 datetime start_time: Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in UTC, 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 UTC, 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 UTC, 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 UTC, 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 UTC, 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 UTC, 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 @@ -1203,12 +1203,12 @@ def page( :param from_: Only include calls from this phone number, SIP address, Client identifier or SIM SID. :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 start_time: Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in UTC, 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 UTC, 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 UTC, 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 UTC, 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 UTC, 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 UTC, 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 @@ -1260,12 +1260,12 @@ async def page_async( :param from_: Only include calls from this phone number, SIP address, Client identifier or SIM SID. :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 start_time: Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in UTC, 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 UTC, 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 UTC, 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 UTC, 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 UTC, 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 UTC, 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 diff --git a/twilio/rest/api/v2010/account/conference/participant.py b/twilio/rest/api/v2010/account/conference/participant.py index 1f3fffd8a4..2c7ae5932c 100644 --- a/twilio/rest/api/v2010/account/conference/participant.py +++ b/twilio/rest/api/v2010/account/conference/participant.py @@ -46,6 +46,7 @@ class Status(object): :ivar hold: Whether the participant is on hold. Can be `true` or `false`. :ivar start_conference_on_enter: Whether the conference starts when the participant joins the conference, if it has not already started. Can be: `true` or `false` and the default is `true`. If `false` and the conference has not started, the participant is muted and hears background music until another participant starts the conference. :ivar status: + :ivar queue_time: The wait time in milliseconds before participant's call is placed. Only available in the response to a create participant request. :ivar uri: The URI of the resource, relative to `https://api.twilio.com`. """ @@ -80,6 +81,7 @@ def __init__( "start_conference_on_enter" ) self.status: Optional["ParticipantInstance.Status"] = payload.get("status") + self.queue_time: Optional[str] = payload.get("queue_time") self.uri: Optional[str] = payload.get("uri") self._solution = { diff --git a/twilio/rest/content/v1/content/__init__.py b/twilio/rest/content/v1/content/__init__.py index bdc1102ca4..b057cb4f86 100644 --- a/twilio/rest/content/v1/content/__init__.py +++ b/twilio/rest/content/v1/content/__init__.py @@ -20,27 +20,10 @@ from twilio.base.list_resource import ListResource from twilio.base.version import Version from twilio.base.page import Page -from twilio.rest.content.v1.content.approval_create import ApprovalCreateList from twilio.rest.content.v1.content.approval_fetch import ApprovalFetchList class ContentInstance(InstanceResource): - - class AuthenticationActionType(object): - COPY_CODE = "COPY_CODE" - - class CallToActionActionType(object): - URL = "URL" - PHONE_NUMBER = "PHONE_NUMBER" - - class CardActionType(object): - URL = "URL" - PHONE_NUMBER = "PHONE_NUMBER" - QUICK_REPLY = "QUICK_REPLY" - - class QuickReplyActionType(object): - QUICK_REPLY = "QUICK_REPLY" - """ :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. @@ -49,7 +32,7 @@ class QuickReplyActionType(object): :ivar friendly_name: A string name used to describe the Content resource. Not visible to the end recipient. :ivar language: Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in. :ivar variables: Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}. - :ivar types: The [Content types](https://www.twilio.com/docs/content-api/content-types-overview) (e.g. twilio/text) for this Content resource. + :ivar types: The [Content types](https://www.twilio.com/docs/content/content-types-overview) (e.g. twilio/text) for this Content resource. :ivar url: The URL of the resource, relative to `https://content.twilio.com`. :ivar links: A list of links related to the Content resource, such as approval_fetch and approval_create """ @@ -130,13 +113,6 @@ async def fetch_async(self) -> "ContentInstance": """ return await self._proxy.fetch_async() - @property - def approval_create(self) -> ApprovalCreateList: - """ - Access the approval_create - """ - return self._proxy.approval_create - @property def approval_fetch(self) -> ApprovalFetchList: """ @@ -171,7 +147,6 @@ def __init__(self, version: Version, sid: str): } self._uri = "/Content/{sid}".format(**self._solution) - self._approval_create: Optional[ApprovalCreateList] = None self._approval_fetch: Optional[ApprovalFetchList] = None def delete(self) -> bool: @@ -236,18 +211,6 @@ async def fetch_async(self) -> ContentInstance: sid=self._solution["sid"], ) - @property - def approval_create(self) -> ApprovalCreateList: - """ - Access the approval_create - """ - if self._approval_create is None: - self._approval_create = ApprovalCreateList( - self._version, - self._solution["sid"], - ) - return self._approval_create - @property def approval_fetch(self) -> ApprovalFetchList: """ @@ -291,451 +254,6 @@ def __repr__(self) -> str: class ContentList(ListResource): - class AuthenticationAction(object): - """ - :ivar type: - :ivar copy_code_text: - """ - - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): - - self.type: Optional["ContentInstance.AuthenticationActionType"] = ( - payload.get("type") - ) - self.copy_code_text: Optional[str] = payload.get("copy_code_text") - - def to_dict(self): - return { - "type": self.type.to_dict(), - "copy_code_text": self.copy_code_text, - } - - class CallToActionAction(object): - """ - :ivar type: - :ivar title: - :ivar url: - :ivar phone: - :ivar id: - """ - - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): - - self.type: Optional["ContentInstance.CallToActionActionType"] = payload.get( - "type" - ) - self.title: Optional[str] = payload.get("title") - self.url: Optional[str] = payload.get("url") - self.phone: Optional[str] = payload.get("phone") - self.id: Optional[str] = payload.get("id") - - def to_dict(self): - return { - "type": self.type.to_dict(), - "title": self.title, - "url": self.url, - "phone": self.phone, - "id": self.id, - } - - class CardAction(object): - """ - :ivar type: - :ivar title: - :ivar url: - :ivar phone: - :ivar id: - """ - - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): - - self.type: Optional["ContentInstance.CardActionType"] = payload.get("type") - self.title: Optional[str] = payload.get("title") - self.url: Optional[str] = payload.get("url") - self.phone: Optional[str] = payload.get("phone") - self.id: Optional[str] = payload.get("id") - - def to_dict(self): - return { - "type": self.type.to_dict(), - "title": self.title, - "url": self.url, - "phone": self.phone, - "id": self.id, - } - - class CatalogItem(object): - """ - :ivar id: - :ivar section_title: - :ivar name: - :ivar media_url: - :ivar price: - :ivar description: - """ - - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): - - self.id: Optional[str] = payload.get("id") - self.section_title: Optional[str] = payload.get("section_title") - self.name: Optional[str] = payload.get("name") - self.media_url: Optional[str] = payload.get("media_url") - self.price: Optional[float] = payload.get("price") - self.description: Optional[str] = payload.get("description") - - def to_dict(self): - return { - "id": self.id, - "section_title": self.section_title, - "name": self.name, - "media_url": self.media_url, - "price": self.price, - "description": self.description, - } - - class ContentCreateRequest(object): - """ - :ivar friendly_name: User defined name of the content - :ivar variables: Key value pairs of variable name to value - :ivar language: Language code for the content - :ivar types: - """ - - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): - - self.friendly_name: Optional[str] = payload.get("friendly_name") - self.variables: Optional[dict[str, str]] = payload.get("variables") - self.language: Optional[str] = payload.get("language") - self.types: Optional[ContentList.Types] = payload.get("types") - - def to_dict(self): - return { - "friendly_name": self.friendly_name, - "variables": self.variables, - "language": self.language, - "types": self.types.to_dict(), - } - - class ListItem(object): - """ - :ivar id: - :ivar item: - :ivar description: - """ - - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): - - self.id: Optional[str] = payload.get("id") - self.item: Optional[str] = payload.get("item") - self.description: Optional[str] = payload.get("description") - - def to_dict(self): - return { - "id": self.id, - "item": self.item, - "description": self.description, - } - - class QuickReplyAction(object): - """ - :ivar type: - :ivar title: - :ivar id: - """ - - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): - - self.type: Optional["ContentInstance.QuickReplyActionType"] = payload.get( - "type" - ) - self.title: Optional[str] = payload.get("title") - self.id: Optional[str] = payload.get("id") - - def to_dict(self): - return { - "type": self.type.to_dict(), - "title": self.title, - "id": self.id, - } - - class TwilioCallToAction(object): - """ - :ivar body: - :ivar actions: - """ - - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): - - self.body: Optional[str] = payload.get("body") - self.actions: Optional[List[ContentList.CallToActionAction]] = payload.get( - "actions" - ) - - def to_dict(self): - return { - "body": self.body, - "actions": [actions.to_dict() for actions in self.actions], - } - - class TwilioCard(object): - """ - :ivar title: - :ivar subtitle: - :ivar media: - :ivar actions: - """ - - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): - - self.title: Optional[str] = payload.get("title") - self.subtitle: Optional[str] = payload.get("subtitle") - self.media: Optional[List[str]] = payload.get("media") - self.actions: Optional[List[ContentList.CardAction]] = payload.get( - "actions" - ) - - def to_dict(self): - return { - "title": self.title, - "subtitle": self.subtitle, - "media": self.media, - "actions": [actions.to_dict() for actions in self.actions], - } - - class TwilioCatalog(object): - """ - :ivar title: - :ivar body: - :ivar subtitle: - :ivar id: - :ivar items: - :ivar dynamic_items: - """ - - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): - - self.title: Optional[str] = payload.get("title") - self.body: Optional[str] = payload.get("body") - self.subtitle: Optional[str] = payload.get("subtitle") - self.id: Optional[str] = payload.get("id") - self.items: Optional[List[ContentList.CatalogItem]] = payload.get("items") - self.dynamic_items: Optional[str] = payload.get("dynamic_items") - - def to_dict(self): - return { - "title": self.title, - "body": self.body, - "subtitle": self.subtitle, - "id": self.id, - "items": [items.to_dict() for items in self.items], - "dynamic_items": self.dynamic_items, - } - - class TwilioListPicker(object): - """ - :ivar body: - :ivar button: - :ivar items: - """ - - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): - - self.body: Optional[str] = payload.get("body") - self.button: Optional[str] = payload.get("button") - self.items: Optional[List[ContentList.ListItem]] = payload.get("items") - - def to_dict(self): - return { - "body": self.body, - "button": self.button, - "items": [items.to_dict() for items in self.items], - } - - class TwilioLocation(object): - """ - :ivar latitude: - :ivar longitude: - :ivar label: - """ - - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): - - self.latitude: Optional[float] = payload.get("latitude") - self.longitude: Optional[float] = payload.get("longitude") - self.label: Optional[str] = payload.get("label") - - def to_dict(self): - return { - "latitude": self.latitude, - "longitude": self.longitude, - "label": self.label, - } - - class TwilioMedia(object): - """ - :ivar body: - :ivar media: - """ - - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): - - self.body: Optional[str] = payload.get("body") - self.media: Optional[List[str]] = payload.get("media") - - def to_dict(self): - return { - "body": self.body, - "media": self.media, - } - - class TwilioQuickReply(object): - """ - :ivar body: - :ivar actions: - """ - - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): - - self.body: Optional[str] = payload.get("body") - self.actions: Optional[List[ContentList.QuickReplyAction]] = payload.get( - "actions" - ) - - def to_dict(self): - return { - "body": self.body, - "actions": [actions.to_dict() for actions in self.actions], - } - - class TwilioText(object): - """ - :ivar body: - """ - - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): - - self.body: Optional[str] = payload.get("body") - - def to_dict(self): - return { - "body": self.body, - } - - class Types(object): - """ - :ivar twilio_text: - :ivar twilio_media: - :ivar twilio_location: - :ivar twilio_list_picker: - :ivar twilio_call_to_action: - :ivar twilio_quick_reply: - :ivar twilio_card: - :ivar twilio_catalog: - :ivar whatsapp_card: - :ivar whatsapp_authentication: - """ - - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): - - self.twilio_text: Optional[ContentList.TwilioText] = payload.get( - "twilio_text" - ) - self.twilio_media: Optional[ContentList.TwilioMedia] = payload.get( - "twilio_media" - ) - self.twilio_location: Optional[ContentList.TwilioLocation] = payload.get( - "twilio_location" - ) - self.twilio_list_picker: Optional[ContentList.TwilioListPicker] = ( - payload.get("twilio_list_picker") - ) - self.twilio_call_to_action: Optional[ContentList.TwilioCallToAction] = ( - payload.get("twilio_call_to_action") - ) - self.twilio_quick_reply: Optional[ContentList.TwilioQuickReply] = ( - payload.get("twilio_quick_reply") - ) - self.twilio_card: Optional[ContentList.TwilioCard] = payload.get( - "twilio_card" - ) - self.twilio_catalog: Optional[ContentList.TwilioCatalog] = payload.get( - "twilio_catalog" - ) - self.whatsapp_card: Optional[ContentList.WhatsappCard] = payload.get( - "whatsapp_card" - ) - self.whatsapp_authentication: Optional[ - ContentList.WhatsappAuthentication - ] = payload.get("whatsapp_authentication") - - def to_dict(self): - return { - "twilio_text": self.twilio_text.to_dict(), - "twilio_media": self.twilio_media.to_dict(), - "twilio_location": self.twilio_location.to_dict(), - "twilio_list_picker": self.twilio_list_picker.to_dict(), - "twilio_call_to_action": self.twilio_call_to_action.to_dict(), - "twilio_quick_reply": self.twilio_quick_reply.to_dict(), - "twilio_card": self.twilio_card.to_dict(), - "twilio_catalog": self.twilio_catalog.to_dict(), - "whatsapp_card": self.whatsapp_card.to_dict(), - "whatsapp_authentication": self.whatsapp_authentication.to_dict(), - } - - class WhatsappAuthentication(object): - """ - :ivar add_security_recommendation: - :ivar code_expiration_minutes: - :ivar actions: - """ - - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): - - self.add_security_recommendation: Optional[bool] = payload.get( - "add_security_recommendation" - ) - self.code_expiration_minutes: Optional[float] = payload.get( - "code_expiration_minutes" - ) - self.actions: Optional[List[ContentList.AuthenticationAction]] = ( - payload.get("actions") - ) - - def to_dict(self): - return { - "add_security_recommendation": self.add_security_recommendation, - "code_expiration_minutes": self.code_expiration_minutes, - "actions": [actions.to_dict() for actions in self.actions], - } - - class WhatsappCard(object): - """ - :ivar body: - :ivar footer: - :ivar media: - :ivar header_text: - :ivar actions: - """ - - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): - - self.body: Optional[str] = payload.get("body") - self.footer: Optional[str] = payload.get("footer") - self.media: Optional[List[str]] = payload.get("media") - self.header_text: Optional[str] = payload.get("header_text") - self.actions: Optional[List[ContentList.CardAction]] = payload.get( - "actions" - ) - - def to_dict(self): - return { - "body": self.body, - "footer": self.footer, - "media": self.media, - "header_text": self.header_text, - "actions": [actions.to_dict() for actions in self.actions], - } - def __init__(self, version: Version): """ Initialize the ContentList @@ -747,43 +265,6 @@ def __init__(self, version: Version): self._uri = "/Content" - def create(self, content_create_request: ContentCreateRequest) -> ContentInstance: - """ - Create the ContentInstance - - :param content_create_request: - - :returns: The created ContentInstance - """ - data = content_create_request.to_dict() - - headers = {"Content-Type": "application/json"} - payload = self._version.create( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return ContentInstance(self._version, payload) - - async def create_async( - self, content_create_request: ContentCreateRequest - ) -> ContentInstance: - """ - Asynchronously create the ContentInstance - - :param content_create_request: - - :returns: The created ContentInstance - """ - - data = content_create_request.to_dict() - headers = {"Content-Type": "application/json"} - - payload = await self._version.create_async( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return ContentInstance(self._version, payload) - def stream( self, limit: Optional[int] = None, diff --git a/twilio/rest/content/v1/content/approval_create.py b/twilio/rest/content/v1/content/approval_create.py index 63a4474306..ddd922afc2 100644 --- a/twilio/rest/content/v1/content/approval_create.py +++ b/twilio/rest/content/v1/content/approval_create.py @@ -29,7 +29,7 @@ class ApprovalCreateInstance(InstanceResource): :ivar allow_category_change: """ - def __init__(self, version: Version, payload: Dict[str, Any], sid: str): + def __init__(self, version: Version, payload: Dict[str, Any], content_sid: str): super().__init__(version) self.name: Optional[str] = payload.get("name") @@ -42,7 +42,7 @@ def __init__(self, version: Version, payload: Dict[str, Any], sid: str): ) self._solution = { - "sid": sid, + "content_sid": content_sid, } def __repr__(self) -> str: @@ -63,7 +63,7 @@ class ContentApprovalRequest(object): :ivar category: A WhatsApp recognized template category. """ - def __init__(self, payload: Dict[str, Any], sid: str): + def __init__(self, payload: Dict[str, Any], content_sid: str): self.name: Optional[str] = payload.get("name") self.category: Optional[str] = payload.get("category") @@ -74,21 +74,23 @@ def to_dict(self): "category": self.category, } - def __init__(self, version: Version, sid: str): + def __init__(self, version: Version, content_sid: str): """ Initialize the ApprovalCreateList :param version: Version that contains the resource - :param sid: + :param content_sid: """ super().__init__(version) # Path Solution self._solution = { - "sid": sid, + "content_sid": content_sid, } - self._uri = "/Content/{sid}/ApprovalRequests/whatsapp".format(**self._solution) + self._uri = "/Content/{content_sid}/ApprovalRequests/whatsapp".format( + **self._solution + ) def create( self, content_approval_request: ContentApprovalRequest @@ -103,11 +105,14 @@ def create( 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"]) + return ApprovalCreateInstance( + self._version, payload, content_sid=self._solution["content_sid"] + ) async def create_async( self, content_approval_request: ContentApprovalRequest @@ -119,15 +124,17 @@ async def create_async( :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"]) + return ApprovalCreateInstance( + self._version, payload, content_sid=self._solution["content_sid"] + ) def __repr__(self) -> str: """ diff --git a/twilio/rest/content/v1/content/approval_fetch.py b/twilio/rest/content/v1/content/approval_fetch.py index f35ef6a48f..f679a920a1 100644 --- a/twilio/rest/content/v1/content/approval_fetch.py +++ b/twilio/rest/content/v1/content/approval_fetch.py @@ -27,7 +27,7 @@ class ApprovalFetchInstance(InstanceResource): :ivar url: The URL of the resource, relative to `https://content.twilio.com`. """ - def __init__(self, version: Version, payload: Dict[str, Any], sid: str): + def __init__(self, version: Version, payload: Dict[str, Any], content_sid: str): super().__init__(version) self.sid: Optional[str] = payload.get("sid") @@ -36,7 +36,7 @@ def __init__(self, version: Version, payload: Dict[str, Any], sid: str): self.url: Optional[str] = payload.get("url") self._solution = { - "sid": sid, + "content_sid": content_sid, } self._context: Optional[ApprovalFetchContext] = None @@ -51,7 +51,7 @@ def _proxy(self) -> "ApprovalFetchContext": if self._context is None: self._context = ApprovalFetchContext( self._version, - sid=self._solution["sid"], + content_sid=self._solution["content_sid"], ) return self._context @@ -85,20 +85,20 @@ def __repr__(self) -> str: class ApprovalFetchContext(InstanceContext): - def __init__(self, version: Version, sid: str): + def __init__(self, version: Version, content_sid: str): """ Initialize the ApprovalFetchContext :param version: Version that contains the resource - :param sid: The Twilio-provided string that uniquely identifies the Content resource whose approval information to fetch. + :param content_sid: The Twilio-provided string that uniquely identifies the Content resource whose approval information to fetch. """ super().__init__(version) # Path Solution self._solution = { - "sid": sid, + "content_sid": content_sid, } - self._uri = "/Content/{sid}/ApprovalRequests".format(**self._solution) + self._uri = "/Content/{content_sid}/ApprovalRequests".format(**self._solution) def fetch(self) -> ApprovalFetchInstance: """ @@ -116,7 +116,7 @@ def fetch(self) -> ApprovalFetchInstance: return ApprovalFetchInstance( self._version, payload, - sid=self._solution["sid"], + content_sid=self._solution["content_sid"], ) async def fetch_async(self) -> ApprovalFetchInstance: @@ -135,7 +135,7 @@ async def fetch_async(self) -> ApprovalFetchInstance: return ApprovalFetchInstance( self._version, payload, - sid=self._solution["sid"], + content_sid=self._solution["content_sid"], ) def __repr__(self) -> str: @@ -150,19 +150,19 @@ def __repr__(self) -> str: class ApprovalFetchList(ListResource): - def __init__(self, version: Version, sid: str): + def __init__(self, version: Version, content_sid: str): """ Initialize the ApprovalFetchList :param version: Version that contains the resource - :param sid: The Twilio-provided string that uniquely identifies the Content resource whose approval information to fetch. + :param content_sid: The Twilio-provided string that uniquely identifies the Content resource whose approval information to fetch. """ super().__init__(version) # Path Solution self._solution = { - "sid": sid, + "content_sid": content_sid, } def get(self) -> ApprovalFetchContext: @@ -170,14 +170,18 @@ def get(self) -> ApprovalFetchContext: Constructs a ApprovalFetchContext """ - return ApprovalFetchContext(self._version, sid=self._solution["sid"]) + return ApprovalFetchContext( + self._version, content_sid=self._solution["content_sid"] + ) def __call__(self) -> ApprovalFetchContext: """ Constructs a ApprovalFetchContext """ - return ApprovalFetchContext(self._version, sid=self._solution["sid"]) + return ApprovalFetchContext( + self._version, content_sid=self._solution["content_sid"] + ) def __repr__(self) -> str: """ diff --git a/twilio/rest/conversations/v1/service/conversation/__init__.py b/twilio/rest/conversations/v1/service/conversation/__init__.py index c347977a40..69e87e5eef 100644 --- a/twilio/rest/conversations/v1/service/conversation/__init__.py +++ b/twilio/rest/conversations/v1/service/conversation/__init__.py @@ -765,8 +765,8 @@ def stream( is reached. The results are returned as a generator, so this operation is memory efficient. - :param str start_date: Start date or time in ISO8601 format for filtering list of Conversations. If a date is provided, the start time of the date is used (YYYY-MM-DDT00:00:00Z). Can be combined with other filters. - :param str end_date: End date or time in ISO8601 format for filtering list of Conversations. If a date is provided, the end time of the date is used (YYYY-MM-DDT23:59:59Z). Can be combined with other filters. + :param str start_date: Specifies the beginning of the date range for filtering Conversations based on their creation date. Conversations that were created on or after this date will be included in the results. The date must be in ISO8601 format, specifically starting at the beginning of the specified date (YYYY-MM-DDT00:00:00Z), for precise filtering. This parameter can be combined with other filters. If this filter is used, the returned list is sorted by latest conversation creation date in descending order. + :param str end_date: Defines the end of the date range for filtering conversations by their creation date. Only conversations that were created on or before this date will appear in the results. The date must be in ISO8601 format, specifically capturing up to the end of the specified date (YYYY-MM-DDT23:59:59Z), to ensure that conversations from the entire end day are included. This parameter can be combined with other filters. If this filter is used, the returned list is sorted by latest conversation creation date in descending order. :param "ConversationInstance.State" state: State for sorting and filtering list of Conversations. Can be `active`, `inactive` or `closed` :param limit: Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit @@ -801,8 +801,8 @@ async def stream_async( is reached. The results are returned as a generator, so this operation is memory efficient. - :param str start_date: Start date or time in ISO8601 format for filtering list of Conversations. If a date is provided, the start time of the date is used (YYYY-MM-DDT00:00:00Z). Can be combined with other filters. - :param str end_date: End date or time in ISO8601 format for filtering list of Conversations. If a date is provided, the end time of the date is used (YYYY-MM-DDT23:59:59Z). Can be combined with other filters. + :param str start_date: Specifies the beginning of the date range for filtering Conversations based on their creation date. Conversations that were created on or after this date will be included in the results. The date must be in ISO8601 format, specifically starting at the beginning of the specified date (YYYY-MM-DDT00:00:00Z), for precise filtering. This parameter can be combined with other filters. If this filter is used, the returned list is sorted by latest conversation creation date in descending order. + :param str end_date: Defines the end of the date range for filtering conversations by their creation date. Only conversations that were created on or before this date will appear in the results. The date must be in ISO8601 format, specifically capturing up to the end of the specified date (YYYY-MM-DDT23:59:59Z), to ensure that conversations from the entire end day are included. This parameter can be combined with other filters. If this filter is used, the returned list is sorted by latest conversation creation date in descending order. :param "ConversationInstance.State" state: State for sorting and filtering list of Conversations. Can be `active`, `inactive` or `closed` :param limit: Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit @@ -836,8 +836,8 @@ def list( Unlike stream(), this operation is eager and will load `limit` records into memory before returning. - :param str start_date: Start date or time in ISO8601 format for filtering list of Conversations. If a date is provided, the start time of the date is used (YYYY-MM-DDT00:00:00Z). Can be combined with other filters. - :param str end_date: End date or time in ISO8601 format for filtering list of Conversations. If a date is provided, the end time of the date is used (YYYY-MM-DDT23:59:59Z). Can be combined with other filters. + :param str start_date: Specifies the beginning of the date range for filtering Conversations based on their creation date. Conversations that were created on or after this date will be included in the results. The date must be in ISO8601 format, specifically starting at the beginning of the specified date (YYYY-MM-DDT00:00:00Z), for precise filtering. This parameter can be combined with other filters. If this filter is used, the returned list is sorted by latest conversation creation date in descending order. + :param str end_date: Defines the end of the date range for filtering conversations by their creation date. Only conversations that were created on or before this date will appear in the results. The date must be in ISO8601 format, specifically capturing up to the end of the specified date (YYYY-MM-DDT23:59:59Z), to ensure that conversations from the entire end day are included. This parameter can be combined with other filters. If this filter is used, the returned list is sorted by latest conversation creation date in descending order. :param "ConversationInstance.State" state: State for sorting and filtering list of Conversations. Can be `active`, `inactive` or `closed` :param limit: Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit @@ -871,8 +871,8 @@ async def list_async( Unlike stream(), this operation is eager and will load `limit` records into memory before returning. - :param str start_date: Start date or time in ISO8601 format for filtering list of Conversations. If a date is provided, the start time of the date is used (YYYY-MM-DDT00:00:00Z). Can be combined with other filters. - :param str end_date: End date or time in ISO8601 format for filtering list of Conversations. If a date is provided, the end time of the date is used (YYYY-MM-DDT23:59:59Z). Can be combined with other filters. + :param str start_date: Specifies the beginning of the date range for filtering Conversations based on their creation date. Conversations that were created on or after this date will be included in the results. The date must be in ISO8601 format, specifically starting at the beginning of the specified date (YYYY-MM-DDT00:00:00Z), for precise filtering. This parameter can be combined with other filters. If this filter is used, the returned list is sorted by latest conversation creation date in descending order. + :param str end_date: Defines the end of the date range for filtering conversations by their creation date. Only conversations that were created on or before this date will appear in the results. The date must be in ISO8601 format, specifically capturing up to the end of the specified date (YYYY-MM-DDT23:59:59Z), to ensure that conversations from the entire end day are included. This parameter can be combined with other filters. If this filter is used, the returned list is sorted by latest conversation creation date in descending order. :param "ConversationInstance.State" state: State for sorting and filtering list of Conversations. Can be `active`, `inactive` or `closed` :param limit: Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit @@ -907,8 +907,8 @@ def page( Retrieve a single page of ConversationInstance records from the API. Request is executed immediately - :param start_date: Start date or time in ISO8601 format for filtering list of Conversations. If a date is provided, the start time of the date is used (YYYY-MM-DDT00:00:00Z). Can be combined with other filters. - :param end_date: End date or time in ISO8601 format for filtering list of Conversations. If a date is provided, the end time of the date is used (YYYY-MM-DDT23:59:59Z). Can be combined with other filters. + :param start_date: Specifies the beginning of the date range for filtering Conversations based on their creation date. Conversations that were created on or after this date will be included in the results. The date must be in ISO8601 format, specifically starting at the beginning of the specified date (YYYY-MM-DDT00:00:00Z), for precise filtering. This parameter can be combined with other filters. If this filter is used, the returned list is sorted by latest conversation creation date in descending order. + :param end_date: Defines the end of the date range for filtering conversations by their creation date. Only conversations that were created on or before this date will appear in the results. The date must be in ISO8601 format, specifically capturing up to the end of the specified date (YYYY-MM-DDT23:59:59Z), to ensure that conversations from the entire end day are included. This parameter can be combined with other filters. If this filter is used, the returned list is sorted by latest conversation creation date in descending order. :param state: State for sorting and filtering list of Conversations. Can be `active`, `inactive` or `closed` :param page_token: PageToken provided by the API :param page_number: Page Number, this value is simply for client state @@ -943,8 +943,8 @@ async def page_async( Asynchronously retrieve a single page of ConversationInstance records from the API. Request is executed immediately - :param start_date: Start date or time in ISO8601 format for filtering list of Conversations. If a date is provided, the start time of the date is used (YYYY-MM-DDT00:00:00Z). Can be combined with other filters. - :param end_date: End date or time in ISO8601 format for filtering list of Conversations. If a date is provided, the end time of the date is used (YYYY-MM-DDT23:59:59Z). Can be combined with other filters. + :param start_date: Specifies the beginning of the date range for filtering Conversations based on their creation date. Conversations that were created on or after this date will be included in the results. The date must be in ISO8601 format, specifically starting at the beginning of the specified date (YYYY-MM-DDT00:00:00Z), for precise filtering. This parameter can be combined with other filters. If this filter is used, the returned list is sorted by latest conversation creation date in descending order. + :param end_date: Defines the end of the date range for filtering conversations by their creation date. Only conversations that were created on or before this date will appear in the results. The date must be in ISO8601 format, specifically capturing up to the end of the specified date (YYYY-MM-DDT23:59:59Z), to ensure that conversations from the entire end day are included. This parameter can be combined with other filters. If this filter is used, the returned list is sorted by latest conversation creation date in descending order. :param state: State for sorting and filtering list of Conversations. Can be `active`, `inactive` or `closed` :param page_token: PageToken provided by the API :param page_number: Page Number, this value is simply for client state diff --git a/twilio/rest/flex_api/v1/plugin/__init__.py b/twilio/rest/flex_api/v1/plugin/__init__.py index 09244d42de..90697d1845 100644 --- a/twilio/rest/flex_api/v1/plugin/__init__.py +++ b/twilio/rest/flex_api/v1/plugin/__init__.py @@ -359,6 +359,8 @@ def create( flex_metadata: Union[str, object] = values.unset, friendly_name: Union[str, object] = values.unset, description: Union[str, object] = values.unset, + cli_version: Union[str, object] = values.unset, + validate_status: Union[str, object] = values.unset, ) -> PluginInstance: """ Create the PluginInstance @@ -367,6 +369,8 @@ def create( :param flex_metadata: The Flex-Metadata HTTP request header :param friendly_name: The Flex Plugin's friendly name. :param description: A descriptive string that you create to describe the plugin resource. It can be up to 500 characters long + :param cli_version: The version of Flex Plugins CLI used to create this plugin + :param validate_status: The validation status of the plugin, indicating whether it has been validated :returns: The created PluginInstance """ @@ -376,6 +380,8 @@ def create( "UniqueName": unique_name, "FriendlyName": friendly_name, "Description": description, + "CliVersion": cli_version, + "ValidateStatus": validate_status, } ) headers = values.of( @@ -396,6 +402,8 @@ async def create_async( flex_metadata: Union[str, object] = values.unset, friendly_name: Union[str, object] = values.unset, description: Union[str, object] = values.unset, + cli_version: Union[str, object] = values.unset, + validate_status: Union[str, object] = values.unset, ) -> PluginInstance: """ Asynchronously create the PluginInstance @@ -404,6 +412,8 @@ async def create_async( :param flex_metadata: The Flex-Metadata HTTP request header :param friendly_name: The Flex Plugin's friendly name. :param description: A descriptive string that you create to describe the plugin resource. It can be up to 500 characters long + :param cli_version: The version of Flex Plugins CLI used to create this plugin + :param validate_status: The validation status of the plugin, indicating whether it has been validated :returns: The created PluginInstance """ @@ -413,6 +423,8 @@ async def create_async( "UniqueName": unique_name, "FriendlyName": friendly_name, "Description": description, + "CliVersion": cli_version, + "ValidateStatus": validate_status, } ) headers = values.of( diff --git a/twilio/rest/media/MediaBase.py b/twilio/rest/media/MediaBase.py deleted file mode 100644 index 6581eb5d09..0000000000 --- a/twilio/rest/media/MediaBase.py +++ /dev/null @@ -1,44 +0,0 @@ -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.media.v1 import V1 - - -class MediaBase(Domain): - - def __init__(self, twilio: Client): - """ - Initialize the Media Domain - - :returns: Domain for Media - """ - super().__init__(twilio, "https://media.twilio.com") - self._v1: Optional[V1] = None - - @property - def v1(self) -> V1: - """ - :returns: Versions v1 of Media - """ - 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/media/v1/__init__.py b/twilio/rest/media/v1/__init__.py deleted file mode 100644 index 3cef1df9b2..0000000000 --- a/twilio/rest/media/v1/__init__.py +++ /dev/null @@ -1,59 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Media - 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 Optional -from twilio.base.version import Version -from twilio.base.domain import Domain -from twilio.rest.media.v1.media_processor import MediaProcessorList -from twilio.rest.media.v1.media_recording import MediaRecordingList -from twilio.rest.media.v1.player_streamer import PlayerStreamerList - - -class V1(Version): - - def __init__(self, domain: Domain): - """ - Initialize the V1 version of Media - - :param domain: The Twilio.media domain - """ - super().__init__(domain, "v1") - self._media_processor: Optional[MediaProcessorList] = None - self._media_recording: Optional[MediaRecordingList] = None - self._player_streamer: Optional[PlayerStreamerList] = None - - @property - def media_processor(self) -> MediaProcessorList: - if self._media_processor is None: - self._media_processor = MediaProcessorList(self) - return self._media_processor - - @property - def media_recording(self) -> MediaRecordingList: - if self._media_recording is None: - self._media_recording = MediaRecordingList(self) - return self._media_recording - - @property - def player_streamer(self) -> PlayerStreamerList: - if self._player_streamer is None: - self._player_streamer = PlayerStreamerList(self) - return self._player_streamer - - def __repr__(self) -> str: - """ - Provide a friendly representation - :returns: Machine friendly representation - """ - return "" diff --git a/twilio/rest/media/v1/media_processor.py b/twilio/rest/media/v1/media_processor.py deleted file mode 100644 index 7f1d2825b1..0000000000 --- a/twilio/rest/media/v1/media_processor.py +++ /dev/null @@ -1,622 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Media - 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 datetime import datetime -from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, serialize, values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.version import Version -from twilio.base.page import Page - - -class MediaProcessorInstance(InstanceResource): - - class Order(object): - ASC = "asc" - DESC = "desc" - - class Status(object): - FAILED = "failed" - STARTED = "started" - ENDED = "ended" - - class UpdateStatus(object): - ENDED = "ended" - - """ - :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the MediaProcessor resource. - :ivar sid: The unique string generated to identify the MediaProcessor resource. - :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - :ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - :ivar extension: The [Media Extension](/docs/live/media-extensions-overview) name or URL. Ex: `video-composer-v2` - :ivar extension_context: The context of the Media Extension, represented as a JSON dictionary. See the documentation for the specific [Media Extension](/docs/live/media-extensions-overview) you are using for more information about the context to send. - :ivar status: - :ivar url: The absolute URL of the resource. - :ivar ended_reason: The reason why a MediaProcessor ended. When a MediaProcessor is in progress, will be `null`. When a MediaProcessor is completed, can be `ended-via-api`, `max-duration-exceeded`, `error-loading-extension`, `error-streaming-media` or `internal-service-error`. See [ended reasons](/docs/live/api/mediaprocessors#mediaprocessor-ended-reason-values) for more details. - :ivar status_callback: The URL to which Twilio will send asynchronous webhook requests for every MediaProcessor event. See [Status Callbacks](/docs/live/api/status-callbacks) for details. - :ivar status_callback_method: The HTTP method Twilio should use to call the `status_callback` URL. Can be `POST` or `GET` and the default is `POST`. - :ivar max_duration: The maximum time, in seconds, that the MediaProcessor can run before automatically ends. The default value is 300 seconds, and the maximum value is 90000 seconds. Once this maximum duration is reached, Twilio will end the MediaProcessor, regardless of whether media is still streaming. - """ - - def __init__( - self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None - ): - super().__init__(version) - - self.account_sid: Optional[str] = payload.get("account_sid") - self.sid: Optional[str] = payload.get("sid") - self.date_created: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("date_created") - ) - self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("date_updated") - ) - self.extension: Optional[str] = payload.get("extension") - self.extension_context: Optional[str] = payload.get("extension_context") - self.status: Optional["MediaProcessorInstance.Status"] = payload.get("status") - self.url: Optional[str] = payload.get("url") - self.ended_reason: Optional[str] = payload.get("ended_reason") - self.status_callback: Optional[str] = payload.get("status_callback") - self.status_callback_method: Optional[str] = payload.get( - "status_callback_method" - ) - self.max_duration: Optional[int] = deserialize.integer( - payload.get("max_duration") - ) - - self._solution = { - "sid": sid or self.sid, - } - self._context: Optional[MediaProcessorContext] = None - - @property - def _proxy(self) -> "MediaProcessorContext": - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: MediaProcessorContext for this MediaProcessorInstance - """ - if self._context is None: - self._context = MediaProcessorContext( - self._version, - sid=self._solution["sid"], - ) - return self._context - - def fetch(self) -> "MediaProcessorInstance": - """ - Fetch the MediaProcessorInstance - - - :returns: The fetched MediaProcessorInstance - """ - return self._proxy.fetch() - - async def fetch_async(self) -> "MediaProcessorInstance": - """ - Asynchronous coroutine to fetch the MediaProcessorInstance - - - :returns: The fetched MediaProcessorInstance - """ - return await self._proxy.fetch_async() - - def update( - self, status: "MediaProcessorInstance.UpdateStatus" - ) -> "MediaProcessorInstance": - """ - Update the MediaProcessorInstance - - :param status: - - :returns: The updated MediaProcessorInstance - """ - return self._proxy.update( - status=status, - ) - - async def update_async( - self, status: "MediaProcessorInstance.UpdateStatus" - ) -> "MediaProcessorInstance": - """ - Asynchronous coroutine to update the MediaProcessorInstance - - :param status: - - :returns: The updated MediaProcessorInstance - """ - return await self._proxy.update_async( - status=status, - ) - - 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 MediaProcessorContext(InstanceContext): - - def __init__(self, version: Version, sid: str): - """ - Initialize the MediaProcessorContext - - :param version: Version that contains the resource - :param sid: The SID of the MediaProcessor resource to update. - """ - super().__init__(version) - - # Path Solution - self._solution = { - "sid": sid, - } - self._uri = "/MediaProcessors/{sid}".format(**self._solution) - - def fetch(self) -> MediaProcessorInstance: - """ - Fetch the MediaProcessorInstance - - - :returns: The fetched MediaProcessorInstance - """ - - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) - - return MediaProcessorInstance( - self._version, - payload, - sid=self._solution["sid"], - ) - - async def fetch_async(self) -> MediaProcessorInstance: - """ - Asynchronous coroutine to fetch the MediaProcessorInstance - - - :returns: The fetched MediaProcessorInstance - """ - - payload = await self._version.fetch_async( - method="GET", - uri=self._uri, - ) - - return MediaProcessorInstance( - self._version, - payload, - sid=self._solution["sid"], - ) - - def update( - self, status: "MediaProcessorInstance.UpdateStatus" - ) -> MediaProcessorInstance: - """ - Update the MediaProcessorInstance - - :param status: - - :returns: The updated MediaProcessorInstance - """ - data = values.of( - { - "Status": status, - } - ) - - payload = self._version.update( - method="POST", - uri=self._uri, - data=data, - ) - - return MediaProcessorInstance(self._version, payload, sid=self._solution["sid"]) - - async def update_async( - self, status: "MediaProcessorInstance.UpdateStatus" - ) -> MediaProcessorInstance: - """ - Asynchronous coroutine to update the MediaProcessorInstance - - :param status: - - :returns: The updated MediaProcessorInstance - """ - data = values.of( - { - "Status": status, - } - ) - - payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, - ) - - return MediaProcessorInstance(self._version, payload, sid=self._solution["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 MediaProcessorPage(Page): - - def get_instance(self, payload: Dict[str, Any]) -> MediaProcessorInstance: - """ - Build an instance of MediaProcessorInstance - - :param payload: Payload response from the API - """ - return MediaProcessorInstance(self._version, payload) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" - - -class MediaProcessorList(ListResource): - - def __init__(self, version: Version): - """ - Initialize the MediaProcessorList - - :param version: Version that contains the resource - - """ - super().__init__(version) - - self._uri = "/MediaProcessors" - - def create( - self, - extension: str, - extension_context: str, - extension_environment: Union[object, object] = values.unset, - status_callback: Union[str, object] = values.unset, - status_callback_method: Union[str, object] = values.unset, - max_duration: Union[int, object] = values.unset, - ) -> MediaProcessorInstance: - """ - Create the MediaProcessorInstance - - :param extension: The [Media Extension](/docs/live/media-extensions-overview) name or URL. Ex: `video-composer-v2` - :param extension_context: The context of the Media Extension, represented as a JSON dictionary. See the documentation for the specific [Media Extension](/docs/live/media-extensions-overview) you are using for more information about the context to send. - :param extension_environment: User-defined environment variables for the Media Extension, represented as a JSON dictionary of key/value strings. See the documentation for the specific [Media Extension](/docs/live/media-extensions-overview) you are using for more information about whether you need to provide this. - :param status_callback: The URL to which Twilio will send asynchronous webhook requests for every MediaProcessor event. See [Status Callbacks](/docs/live/api/status-callbacks) for details. - :param status_callback_method: The HTTP method Twilio should use to call the `status_callback` URL. Can be `POST` or `GET` and the default is `POST`. - :param max_duration: The maximum time, in seconds, that the MediaProcessor can run before automatically ends. The default value is 300 seconds, and the maximum value is 90000 seconds. Once this maximum duration is reached, Twilio will end the MediaProcessor, regardless of whether media is still streaming. - - :returns: The created MediaProcessorInstance - """ - - data = values.of( - { - "Extension": extension, - "ExtensionContext": extension_context, - "ExtensionEnvironment": serialize.object(extension_environment), - "StatusCallback": status_callback, - "StatusCallbackMethod": status_callback_method, - "MaxDuration": max_duration, - } - ) - - payload = self._version.create( - method="POST", - uri=self._uri, - data=data, - ) - - return MediaProcessorInstance(self._version, payload) - - async def create_async( - self, - extension: str, - extension_context: str, - extension_environment: Union[object, object] = values.unset, - status_callback: Union[str, object] = values.unset, - status_callback_method: Union[str, object] = values.unset, - max_duration: Union[int, object] = values.unset, - ) -> MediaProcessorInstance: - """ - Asynchronously create the MediaProcessorInstance - - :param extension: The [Media Extension](/docs/live/media-extensions-overview) name or URL. Ex: `video-composer-v2` - :param extension_context: The context of the Media Extension, represented as a JSON dictionary. See the documentation for the specific [Media Extension](/docs/live/media-extensions-overview) you are using for more information about the context to send. - :param extension_environment: User-defined environment variables for the Media Extension, represented as a JSON dictionary of key/value strings. See the documentation for the specific [Media Extension](/docs/live/media-extensions-overview) you are using for more information about whether you need to provide this. - :param status_callback: The URL to which Twilio will send asynchronous webhook requests for every MediaProcessor event. See [Status Callbacks](/docs/live/api/status-callbacks) for details. - :param status_callback_method: The HTTP method Twilio should use to call the `status_callback` URL. Can be `POST` or `GET` and the default is `POST`. - :param max_duration: The maximum time, in seconds, that the MediaProcessor can run before automatically ends. The default value is 300 seconds, and the maximum value is 90000 seconds. Once this maximum duration is reached, Twilio will end the MediaProcessor, regardless of whether media is still streaming. - - :returns: The created MediaProcessorInstance - """ - - data = values.of( - { - "Extension": extension, - "ExtensionContext": extension_context, - "ExtensionEnvironment": serialize.object(extension_environment), - "StatusCallback": status_callback, - "StatusCallbackMethod": status_callback_method, - "MaxDuration": max_duration, - } - ) - - payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, - ) - - return MediaProcessorInstance(self._version, payload) - - def stream( - self, - order: Union["MediaProcessorInstance.Order", object] = values.unset, - status: Union["MediaProcessorInstance.Status", object] = values.unset, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> Iterator[MediaProcessorInstance]: - """ - Streams MediaProcessorInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param "MediaProcessorInstance.Order" order: The sort order of the list by `date_created`. Can be: `asc` (ascending) or `desc` (descending) with `desc` as the default. - :param "MediaProcessorInstance.Status" status: Status to filter by, with possible values `started`, `ended` or `failed`. - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - """ - limits = self._version.read_limits(limit, page_size) - page = self.page(order=order, status=status, page_size=limits["page_size"]) - - return self._version.stream(page, limits["limit"]) - - async def stream_async( - self, - order: Union["MediaProcessorInstance.Order", object] = values.unset, - status: Union["MediaProcessorInstance.Status", object] = values.unset, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> AsyncIterator[MediaProcessorInstance]: - """ - Asynchronously streams MediaProcessorInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param "MediaProcessorInstance.Order" order: The sort order of the list by `date_created`. Can be: `asc` (ascending) or `desc` (descending) with `desc` as the default. - :param "MediaProcessorInstance.Status" status: Status to filter by, with possible values `started`, `ended` or `failed`. - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - """ - limits = self._version.read_limits(limit, page_size) - page = await self.page_async( - order=order, status=status, page_size=limits["page_size"] - ) - - return self._version.stream_async(page, limits["limit"]) - - def list( - self, - order: Union["MediaProcessorInstance.Order", object] = values.unset, - status: Union["MediaProcessorInstance.Status", object] = values.unset, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[MediaProcessorInstance]: - """ - Lists MediaProcessorInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param "MediaProcessorInstance.Order" order: The sort order of the list by `date_created`. Can be: `asc` (ascending) or `desc` (descending) with `desc` as the default. - :param "MediaProcessorInstance.Status" status: Status to filter by, with possible values `started`, `ended` or `failed`. - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: list that will contain up to limit results - """ - return list( - self.stream( - order=order, - status=status, - limit=limit, - page_size=page_size, - ) - ) - - async def list_async( - self, - order: Union["MediaProcessorInstance.Order", object] = values.unset, - status: Union["MediaProcessorInstance.Status", object] = values.unset, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[MediaProcessorInstance]: - """ - Asynchronously lists MediaProcessorInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param "MediaProcessorInstance.Order" order: The sort order of the list by `date_created`. Can be: `asc` (ascending) or `desc` (descending) with `desc` as the default. - :param "MediaProcessorInstance.Status" status: Status to filter by, with possible values `started`, `ended` or `failed`. - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: list that will contain up to limit results - """ - return [ - record - async for record in await self.stream_async( - order=order, - status=status, - limit=limit, - page_size=page_size, - ) - ] - - def page( - self, - order: Union["MediaProcessorInstance.Order", object] = values.unset, - status: Union["MediaProcessorInstance.Status", object] = values.unset, - page_token: Union[str, object] = values.unset, - page_number: Union[int, object] = values.unset, - page_size: Union[int, object] = values.unset, - ) -> MediaProcessorPage: - """ - Retrieve a single page of MediaProcessorInstance records from the API. - Request is executed immediately - - :param order: The sort order of the list by `date_created`. Can be: `asc` (ascending) or `desc` (descending) with `desc` as the default. - :param status: Status to filter by, with possible values `started`, `ended` or `failed`. - :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 - - :returns: Page of MediaProcessorInstance - """ - data = values.of( - { - "Order": order, - "Status": status, - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - response = self._version.page(method="GET", uri=self._uri, params=data) - return MediaProcessorPage(self._version, response) - - async def page_async( - self, - order: Union["MediaProcessorInstance.Order", object] = values.unset, - status: Union["MediaProcessorInstance.Status", object] = values.unset, - page_token: Union[str, object] = values.unset, - page_number: Union[int, object] = values.unset, - page_size: Union[int, object] = values.unset, - ) -> MediaProcessorPage: - """ - Asynchronously retrieve a single page of MediaProcessorInstance records from the API. - Request is executed immediately - - :param order: The sort order of the list by `date_created`. Can be: `asc` (ascending) or `desc` (descending) with `desc` as the default. - :param status: Status to filter by, with possible values `started`, `ended` or `failed`. - :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 - - :returns: Page of MediaProcessorInstance - """ - data = values.of( - { - "Order": order, - "Status": status, - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - response = await self._version.page_async( - method="GET", uri=self._uri, params=data - ) - return MediaProcessorPage(self._version, response) - - def get_page(self, target_url: str) -> MediaProcessorPage: - """ - Retrieve a specific page of MediaProcessorInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of MediaProcessorInstance - """ - response = self._version.domain.twilio.request("GET", target_url) - return MediaProcessorPage(self._version, response) - - async def get_page_async(self, target_url: str) -> MediaProcessorPage: - """ - Asynchronously retrieve a specific page of MediaProcessorInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of MediaProcessorInstance - """ - response = await self._version.domain.twilio.request_async("GET", target_url) - return MediaProcessorPage(self._version, response) - - def get(self, sid: str) -> MediaProcessorContext: - """ - Constructs a MediaProcessorContext - - :param sid: The SID of the MediaProcessor resource to update. - """ - return MediaProcessorContext(self._version, sid=sid) - - def __call__(self, sid: str) -> MediaProcessorContext: - """ - Constructs a MediaProcessorContext - - :param sid: The SID of the MediaProcessor resource to update. - """ - return MediaProcessorContext(self._version, sid=sid) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" diff --git a/twilio/rest/media/v1/media_recording.py b/twilio/rest/media/v1/media_recording.py deleted file mode 100644 index fb916e5278..0000000000 --- a/twilio/rest/media/v1/media_recording.py +++ /dev/null @@ -1,554 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Media - 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 datetime import datetime -from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.version import Version -from twilio.base.page import Page - - -class MediaRecordingInstance(InstanceResource): - - class Format(object): - MP4 = "mp4" - WEBM = "webm" - - class Order(object): - ASC = "asc" - DESC = "desc" - - class Status(object): - PROCESSING = "processing" - COMPLETED = "completed" - DELETED = "deleted" - FAILED = "failed" - - """ - :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the MediaRecording resource. - :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - :ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - :ivar duration: The duration of the MediaRecording in seconds. - :ivar format: - :ivar links: The URLs of related resources. - :ivar processor_sid: The SID of the MediaProcessor resource which produced the MediaRecording. - :ivar resolution: The dimensions of the video image in pixels expressed as columns (width) and rows (height). - :ivar source_sid: The SID of the resource that generated the original media track(s) of the MediaRecording. - :ivar sid: The unique string generated to identify the MediaRecording resource. - :ivar media_size: The size of the recording media in bytes. - :ivar status: - :ivar status_callback: The URL to which Twilio will send asynchronous webhook requests for every MediaRecording event. See [Status Callbacks](/docs/live/api/status-callbacks) for more details. - :ivar status_callback_method: The HTTP method Twilio should use to call the `status_callback` URL. Can be `POST` or `GET` and the default is `POST`. - :ivar url: The absolute URL of the resource. - """ - - def __init__( - self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None - ): - super().__init__(version) - - self.account_sid: Optional[str] = payload.get("account_sid") - self.date_created: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("date_created") - ) - self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("date_updated") - ) - self.duration: Optional[int] = deserialize.integer(payload.get("duration")) - self.format: Optional["MediaRecordingInstance.Format"] = payload.get("format") - self.links: Optional[Dict[str, object]] = payload.get("links") - self.processor_sid: Optional[str] = payload.get("processor_sid") - self.resolution: Optional[str] = payload.get("resolution") - self.source_sid: Optional[str] = payload.get("source_sid") - self.sid: Optional[str] = payload.get("sid") - self.media_size: Optional[int] = payload.get("media_size") - self.status: Optional["MediaRecordingInstance.Status"] = payload.get("status") - self.status_callback: Optional[str] = payload.get("status_callback") - self.status_callback_method: Optional[str] = payload.get( - "status_callback_method" - ) - self.url: Optional[str] = payload.get("url") - - self._solution = { - "sid": sid or self.sid, - } - self._context: Optional[MediaRecordingContext] = None - - @property - def _proxy(self) -> "MediaRecordingContext": - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: MediaRecordingContext for this MediaRecordingInstance - """ - if self._context is None: - self._context = MediaRecordingContext( - self._version, - sid=self._solution["sid"], - ) - return self._context - - def delete(self) -> bool: - """ - Deletes the MediaRecordingInstance - - - :returns: True if delete succeeds, False otherwise - """ - return self._proxy.delete() - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the MediaRecordingInstance - - - :returns: True if delete succeeds, False otherwise - """ - return await self._proxy.delete_async() - - def fetch(self) -> "MediaRecordingInstance": - """ - Fetch the MediaRecordingInstance - - - :returns: The fetched MediaRecordingInstance - """ - return self._proxy.fetch() - - async def fetch_async(self) -> "MediaRecordingInstance": - """ - Asynchronous coroutine to fetch the MediaRecordingInstance - - - :returns: The fetched MediaRecordingInstance - """ - return await self._proxy.fetch_async() - - 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 MediaRecordingContext(InstanceContext): - - def __init__(self, version: Version, sid: str): - """ - Initialize the MediaRecordingContext - - :param version: Version that contains the resource - :param sid: The SID of the MediaRecording resource to fetch. - """ - super().__init__(version) - - # Path Solution - self._solution = { - "sid": sid, - } - self._uri = "/MediaRecordings/{sid}".format(**self._solution) - - def delete(self) -> bool: - """ - Deletes the MediaRecordingInstance - - - :returns: True if delete succeeds, False otherwise - """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the MediaRecordingInstance - - - :returns: True if delete succeeds, False otherwise - """ - return await self._version.delete_async( - method="DELETE", - uri=self._uri, - ) - - def fetch(self) -> MediaRecordingInstance: - """ - Fetch the MediaRecordingInstance - - - :returns: The fetched MediaRecordingInstance - """ - - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) - - return MediaRecordingInstance( - self._version, - payload, - sid=self._solution["sid"], - ) - - async def fetch_async(self) -> MediaRecordingInstance: - """ - Asynchronous coroutine to fetch the MediaRecordingInstance - - - :returns: The fetched MediaRecordingInstance - """ - - payload = await self._version.fetch_async( - method="GET", - uri=self._uri, - ) - - return MediaRecordingInstance( - self._version, - payload, - sid=self._solution["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 MediaRecordingPage(Page): - - def get_instance(self, payload: Dict[str, Any]) -> MediaRecordingInstance: - """ - Build an instance of MediaRecordingInstance - - :param payload: Payload response from the API - """ - return MediaRecordingInstance(self._version, payload) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" - - -class MediaRecordingList(ListResource): - - def __init__(self, version: Version): - """ - Initialize the MediaRecordingList - - :param version: Version that contains the resource - - """ - super().__init__(version) - - self._uri = "/MediaRecordings" - - def stream( - self, - order: Union["MediaRecordingInstance.Order", object] = values.unset, - status: Union["MediaRecordingInstance.Status", object] = values.unset, - processor_sid: Union[str, object] = values.unset, - source_sid: Union[str, object] = values.unset, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> Iterator[MediaRecordingInstance]: - """ - Streams MediaRecordingInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param "MediaRecordingInstance.Order" order: The sort order of the list by `date_created`. Can be: `asc` (ascending) or `desc` (descending) with `desc` as the default. - :param "MediaRecordingInstance.Status" status: Status to filter by, with possible values `processing`, `completed`, `deleted`, or `failed`. - :param str processor_sid: SID of a MediaProcessor to filter by. - :param str source_sid: SID of a MediaRecording source to filter by. - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - """ - limits = self._version.read_limits(limit, page_size) - page = self.page( - order=order, - status=status, - processor_sid=processor_sid, - source_sid=source_sid, - page_size=limits["page_size"], - ) - - return self._version.stream(page, limits["limit"]) - - async def stream_async( - self, - order: Union["MediaRecordingInstance.Order", object] = values.unset, - status: Union["MediaRecordingInstance.Status", object] = values.unset, - processor_sid: Union[str, object] = values.unset, - source_sid: Union[str, object] = values.unset, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> AsyncIterator[MediaRecordingInstance]: - """ - Asynchronously streams MediaRecordingInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param "MediaRecordingInstance.Order" order: The sort order of the list by `date_created`. Can be: `asc` (ascending) or `desc` (descending) with `desc` as the default. - :param "MediaRecordingInstance.Status" status: Status to filter by, with possible values `processing`, `completed`, `deleted`, or `failed`. - :param str processor_sid: SID of a MediaProcessor to filter by. - :param str source_sid: SID of a MediaRecording source to filter by. - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - """ - limits = self._version.read_limits(limit, page_size) - page = await self.page_async( - order=order, - status=status, - processor_sid=processor_sid, - source_sid=source_sid, - page_size=limits["page_size"], - ) - - return self._version.stream_async(page, limits["limit"]) - - def list( - self, - order: Union["MediaRecordingInstance.Order", object] = values.unset, - status: Union["MediaRecordingInstance.Status", object] = values.unset, - processor_sid: Union[str, object] = values.unset, - source_sid: Union[str, object] = values.unset, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[MediaRecordingInstance]: - """ - Lists MediaRecordingInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param "MediaRecordingInstance.Order" order: The sort order of the list by `date_created`. Can be: `asc` (ascending) or `desc` (descending) with `desc` as the default. - :param "MediaRecordingInstance.Status" status: Status to filter by, with possible values `processing`, `completed`, `deleted`, or `failed`. - :param str processor_sid: SID of a MediaProcessor to filter by. - :param str source_sid: SID of a MediaRecording source to filter by. - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: list that will contain up to limit results - """ - return list( - self.stream( - order=order, - status=status, - processor_sid=processor_sid, - source_sid=source_sid, - limit=limit, - page_size=page_size, - ) - ) - - async def list_async( - self, - order: Union["MediaRecordingInstance.Order", object] = values.unset, - status: Union["MediaRecordingInstance.Status", object] = values.unset, - processor_sid: Union[str, object] = values.unset, - source_sid: Union[str, object] = values.unset, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[MediaRecordingInstance]: - """ - Asynchronously lists MediaRecordingInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param "MediaRecordingInstance.Order" order: The sort order of the list by `date_created`. Can be: `asc` (ascending) or `desc` (descending) with `desc` as the default. - :param "MediaRecordingInstance.Status" status: Status to filter by, with possible values `processing`, `completed`, `deleted`, or `failed`. - :param str processor_sid: SID of a MediaProcessor to filter by. - :param str source_sid: SID of a MediaRecording source to filter by. - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: list that will contain up to limit results - """ - return [ - record - async for record in await self.stream_async( - order=order, - status=status, - processor_sid=processor_sid, - source_sid=source_sid, - limit=limit, - page_size=page_size, - ) - ] - - def page( - self, - order: Union["MediaRecordingInstance.Order", object] = values.unset, - status: Union["MediaRecordingInstance.Status", object] = values.unset, - processor_sid: Union[str, object] = values.unset, - source_sid: Union[str, object] = values.unset, - page_token: Union[str, object] = values.unset, - page_number: Union[int, object] = values.unset, - page_size: Union[int, object] = values.unset, - ) -> MediaRecordingPage: - """ - Retrieve a single page of MediaRecordingInstance records from the API. - Request is executed immediately - - :param order: The sort order of the list by `date_created`. Can be: `asc` (ascending) or `desc` (descending) with `desc` as the default. - :param status: Status to filter by, with possible values `processing`, `completed`, `deleted`, or `failed`. - :param processor_sid: SID of a MediaProcessor to filter by. - :param source_sid: SID of a MediaRecording source to filter by. - :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 - - :returns: Page of MediaRecordingInstance - """ - data = values.of( - { - "Order": order, - "Status": status, - "ProcessorSid": processor_sid, - "SourceSid": source_sid, - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - response = self._version.page(method="GET", uri=self._uri, params=data) - return MediaRecordingPage(self._version, response) - - async def page_async( - self, - order: Union["MediaRecordingInstance.Order", object] = values.unset, - status: Union["MediaRecordingInstance.Status", object] = values.unset, - processor_sid: Union[str, object] = values.unset, - source_sid: Union[str, object] = values.unset, - page_token: Union[str, object] = values.unset, - page_number: Union[int, object] = values.unset, - page_size: Union[int, object] = values.unset, - ) -> MediaRecordingPage: - """ - Asynchronously retrieve a single page of MediaRecordingInstance records from the API. - Request is executed immediately - - :param order: The sort order of the list by `date_created`. Can be: `asc` (ascending) or `desc` (descending) with `desc` as the default. - :param status: Status to filter by, with possible values `processing`, `completed`, `deleted`, or `failed`. - :param processor_sid: SID of a MediaProcessor to filter by. - :param source_sid: SID of a MediaRecording source to filter by. - :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 - - :returns: Page of MediaRecordingInstance - """ - data = values.of( - { - "Order": order, - "Status": status, - "ProcessorSid": processor_sid, - "SourceSid": source_sid, - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - response = await self._version.page_async( - method="GET", uri=self._uri, params=data - ) - return MediaRecordingPage(self._version, response) - - def get_page(self, target_url: str) -> MediaRecordingPage: - """ - Retrieve a specific page of MediaRecordingInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of MediaRecordingInstance - """ - response = self._version.domain.twilio.request("GET", target_url) - return MediaRecordingPage(self._version, response) - - async def get_page_async(self, target_url: str) -> MediaRecordingPage: - """ - Asynchronously retrieve a specific page of MediaRecordingInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of MediaRecordingInstance - """ - response = await self._version.domain.twilio.request_async("GET", target_url) - return MediaRecordingPage(self._version, response) - - def get(self, sid: str) -> MediaRecordingContext: - """ - Constructs a MediaRecordingContext - - :param sid: The SID of the MediaRecording resource to fetch. - """ - return MediaRecordingContext(self._version, sid=sid) - - def __call__(self, sid: str) -> MediaRecordingContext: - """ - Constructs a MediaRecordingContext - - :param sid: The SID of the MediaRecording resource to fetch. - """ - return MediaRecordingContext(self._version, sid=sid) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" diff --git a/twilio/rest/media/v1/player_streamer/__init__.py b/twilio/rest/media/v1/player_streamer/__init__.py deleted file mode 100644 index 86832ba990..0000000000 --- a/twilio/rest/media/v1/player_streamer/__init__.py +++ /dev/null @@ -1,641 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Media - 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 datetime import datetime -from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, serialize, values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.version import Version -from twilio.base.page import Page -from twilio.rest.media.v1.player_streamer.playback_grant import PlaybackGrantList - - -class PlayerStreamerInstance(InstanceResource): - - class EndedReason(object): - ENDED_VIA_API = "ended-via-api" - MAX_DURATION_EXCEEDED = "max-duration-exceeded" - STREAM_DISCONNECTED_BY_SOURCE = "stream-disconnected-by-source" - UNEXPECTED_FAILURE = "unexpected-failure" - - class Order(object): - ASC = "asc" - DESC = "desc" - - class Status(object): - CREATED = "created" - STARTED = "started" - ENDED = "ended" - FAILED = "failed" - - class UpdateStatus(object): - ENDED = "ended" - - """ - :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the PlayerStreamer resource. - :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - :ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - :ivar video: Specifies whether the PlayerStreamer is configured to stream video. Defaults to `true`. - :ivar links: The URLs of related resources. - :ivar sid: The unique string generated to identify the PlayerStreamer resource. - :ivar status: - :ivar url: The absolute URL of the resource. - :ivar status_callback: The URL to which Twilio will send asynchronous webhook requests for every PlayerStreamer event. See [Status Callbacks](/docs/live/api/status-callbacks) for more details. - :ivar status_callback_method: The HTTP method Twilio should use to call the `status_callback` URL. Can be `POST` or `GET` and the default is `POST`. - :ivar ended_reason: - :ivar max_duration: The maximum time, in seconds, that the PlayerStreamer is active (`created` or `started`) before automatically ends. The default value is 300 seconds, and the maximum value is 90000 seconds. Once this maximum duration is reached, Twilio will end the PlayerStreamer, regardless of whether media is still streaming. - """ - - def __init__( - self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None - ): - super().__init__(version) - - self.account_sid: Optional[str] = payload.get("account_sid") - self.date_created: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("date_created") - ) - self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("date_updated") - ) - self.video: Optional[bool] = payload.get("video") - self.links: Optional[Dict[str, object]] = payload.get("links") - self.sid: Optional[str] = payload.get("sid") - self.status: Optional["PlayerStreamerInstance.Status"] = payload.get("status") - self.url: Optional[str] = payload.get("url") - self.status_callback: Optional[str] = payload.get("status_callback") - self.status_callback_method: Optional[str] = payload.get( - "status_callback_method" - ) - self.ended_reason: Optional["PlayerStreamerInstance.EndedReason"] = payload.get( - "ended_reason" - ) - self.max_duration: Optional[int] = deserialize.integer( - payload.get("max_duration") - ) - - self._solution = { - "sid": sid or self.sid, - } - self._context: Optional[PlayerStreamerContext] = None - - @property - def _proxy(self) -> "PlayerStreamerContext": - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: PlayerStreamerContext for this PlayerStreamerInstance - """ - if self._context is None: - self._context = PlayerStreamerContext( - self._version, - sid=self._solution["sid"], - ) - return self._context - - def fetch(self) -> "PlayerStreamerInstance": - """ - Fetch the PlayerStreamerInstance - - - :returns: The fetched PlayerStreamerInstance - """ - return self._proxy.fetch() - - async def fetch_async(self) -> "PlayerStreamerInstance": - """ - Asynchronous coroutine to fetch the PlayerStreamerInstance - - - :returns: The fetched PlayerStreamerInstance - """ - return await self._proxy.fetch_async() - - def update( - self, status: "PlayerStreamerInstance.UpdateStatus" - ) -> "PlayerStreamerInstance": - """ - Update the PlayerStreamerInstance - - :param status: - - :returns: The updated PlayerStreamerInstance - """ - return self._proxy.update( - status=status, - ) - - async def update_async( - self, status: "PlayerStreamerInstance.UpdateStatus" - ) -> "PlayerStreamerInstance": - """ - Asynchronous coroutine to update the PlayerStreamerInstance - - :param status: - - :returns: The updated PlayerStreamerInstance - """ - return await self._proxy.update_async( - status=status, - ) - - @property - def playback_grant(self) -> PlaybackGrantList: - """ - Access the playback_grant - """ - return self._proxy.playback_grant - - 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 PlayerStreamerContext(InstanceContext): - - def __init__(self, version: Version, sid: str): - """ - Initialize the PlayerStreamerContext - - :param version: Version that contains the resource - :param sid: The SID of the PlayerStreamer resource to update. - """ - super().__init__(version) - - # Path Solution - self._solution = { - "sid": sid, - } - self._uri = "/PlayerStreamers/{sid}".format(**self._solution) - - self._playback_grant: Optional[PlaybackGrantList] = None - - def fetch(self) -> PlayerStreamerInstance: - """ - Fetch the PlayerStreamerInstance - - - :returns: The fetched PlayerStreamerInstance - """ - - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) - - return PlayerStreamerInstance( - self._version, - payload, - sid=self._solution["sid"], - ) - - async def fetch_async(self) -> PlayerStreamerInstance: - """ - Asynchronous coroutine to fetch the PlayerStreamerInstance - - - :returns: The fetched PlayerStreamerInstance - """ - - payload = await self._version.fetch_async( - method="GET", - uri=self._uri, - ) - - return PlayerStreamerInstance( - self._version, - payload, - sid=self._solution["sid"], - ) - - def update( - self, status: "PlayerStreamerInstance.UpdateStatus" - ) -> PlayerStreamerInstance: - """ - Update the PlayerStreamerInstance - - :param status: - - :returns: The updated PlayerStreamerInstance - """ - data = values.of( - { - "Status": status, - } - ) - - payload = self._version.update( - method="POST", - uri=self._uri, - data=data, - ) - - return PlayerStreamerInstance(self._version, payload, sid=self._solution["sid"]) - - async def update_async( - self, status: "PlayerStreamerInstance.UpdateStatus" - ) -> PlayerStreamerInstance: - """ - Asynchronous coroutine to update the PlayerStreamerInstance - - :param status: - - :returns: The updated PlayerStreamerInstance - """ - data = values.of( - { - "Status": status, - } - ) - - payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, - ) - - return PlayerStreamerInstance(self._version, payload, sid=self._solution["sid"]) - - @property - def playback_grant(self) -> PlaybackGrantList: - """ - Access the playback_grant - """ - if self._playback_grant is None: - self._playback_grant = PlaybackGrantList( - self._version, - self._solution["sid"], - ) - return self._playback_grant - - 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 PlayerStreamerPage(Page): - - def get_instance(self, payload: Dict[str, Any]) -> PlayerStreamerInstance: - """ - Build an instance of PlayerStreamerInstance - - :param payload: Payload response from the API - """ - return PlayerStreamerInstance(self._version, payload) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" - - -class PlayerStreamerList(ListResource): - - def __init__(self, version: Version): - """ - Initialize the PlayerStreamerList - - :param version: Version that contains the resource - - """ - super().__init__(version) - - self._uri = "/PlayerStreamers" - - def create( - self, - video: Union[bool, object] = values.unset, - status_callback: Union[str, object] = values.unset, - status_callback_method: Union[str, object] = values.unset, - max_duration: Union[int, object] = values.unset, - ) -> PlayerStreamerInstance: - """ - Create the PlayerStreamerInstance - - :param video: Specifies whether the PlayerStreamer is configured to stream video. Defaults to `true`. - :param status_callback: The URL to which Twilio will send asynchronous webhook requests for every PlayerStreamer event. See [Status Callbacks](/docs/live/api/status-callbacks) for more details. - :param status_callback_method: The HTTP method Twilio should use to call the `status_callback` URL. Can be `POST` or `GET` and the default is `POST`. - :param max_duration: The maximum time, in seconds, that the PlayerStreamer is active (`created` or `started`) before automatically ends. The default value is 300 seconds, and the maximum value is 90000 seconds. Once this maximum duration is reached, Twilio will end the PlayerStreamer, regardless of whether media is still streaming. - - :returns: The created PlayerStreamerInstance - """ - - data = values.of( - { - "Video": serialize.boolean_to_string(video), - "StatusCallback": status_callback, - "StatusCallbackMethod": status_callback_method, - "MaxDuration": max_duration, - } - ) - - payload = self._version.create( - method="POST", - uri=self._uri, - data=data, - ) - - return PlayerStreamerInstance(self._version, payload) - - async def create_async( - self, - video: Union[bool, object] = values.unset, - status_callback: Union[str, object] = values.unset, - status_callback_method: Union[str, object] = values.unset, - max_duration: Union[int, object] = values.unset, - ) -> PlayerStreamerInstance: - """ - Asynchronously create the PlayerStreamerInstance - - :param video: Specifies whether the PlayerStreamer is configured to stream video. Defaults to `true`. - :param status_callback: The URL to which Twilio will send asynchronous webhook requests for every PlayerStreamer event. See [Status Callbacks](/docs/live/api/status-callbacks) for more details. - :param status_callback_method: The HTTP method Twilio should use to call the `status_callback` URL. Can be `POST` or `GET` and the default is `POST`. - :param max_duration: The maximum time, in seconds, that the PlayerStreamer is active (`created` or `started`) before automatically ends. The default value is 300 seconds, and the maximum value is 90000 seconds. Once this maximum duration is reached, Twilio will end the PlayerStreamer, regardless of whether media is still streaming. - - :returns: The created PlayerStreamerInstance - """ - - data = values.of( - { - "Video": serialize.boolean_to_string(video), - "StatusCallback": status_callback, - "StatusCallbackMethod": status_callback_method, - "MaxDuration": max_duration, - } - ) - - payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, - ) - - return PlayerStreamerInstance(self._version, payload) - - def stream( - self, - order: Union["PlayerStreamerInstance.Order", object] = values.unset, - status: Union["PlayerStreamerInstance.Status", object] = values.unset, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> Iterator[PlayerStreamerInstance]: - """ - Streams PlayerStreamerInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param "PlayerStreamerInstance.Order" order: The sort order of the list by `date_created`. Can be: `asc` (ascending) or `desc` (descending) with `desc` as the default. - :param "PlayerStreamerInstance.Status" status: Status to filter by, with possible values `created`, `started`, `ended`, or `failed`. - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - """ - limits = self._version.read_limits(limit, page_size) - page = self.page(order=order, status=status, page_size=limits["page_size"]) - - return self._version.stream(page, limits["limit"]) - - async def stream_async( - self, - order: Union["PlayerStreamerInstance.Order", object] = values.unset, - status: Union["PlayerStreamerInstance.Status", object] = values.unset, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> AsyncIterator[PlayerStreamerInstance]: - """ - Asynchronously streams PlayerStreamerInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param "PlayerStreamerInstance.Order" order: The sort order of the list by `date_created`. Can be: `asc` (ascending) or `desc` (descending) with `desc` as the default. - :param "PlayerStreamerInstance.Status" status: Status to filter by, with possible values `created`, `started`, `ended`, or `failed`. - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - """ - limits = self._version.read_limits(limit, page_size) - page = await self.page_async( - order=order, status=status, page_size=limits["page_size"] - ) - - return self._version.stream_async(page, limits["limit"]) - - def list( - self, - order: Union["PlayerStreamerInstance.Order", object] = values.unset, - status: Union["PlayerStreamerInstance.Status", object] = values.unset, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[PlayerStreamerInstance]: - """ - Lists PlayerStreamerInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param "PlayerStreamerInstance.Order" order: The sort order of the list by `date_created`. Can be: `asc` (ascending) or `desc` (descending) with `desc` as the default. - :param "PlayerStreamerInstance.Status" status: Status to filter by, with possible values `created`, `started`, `ended`, or `failed`. - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: list that will contain up to limit results - """ - return list( - self.stream( - order=order, - status=status, - limit=limit, - page_size=page_size, - ) - ) - - async def list_async( - self, - order: Union["PlayerStreamerInstance.Order", object] = values.unset, - status: Union["PlayerStreamerInstance.Status", object] = values.unset, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[PlayerStreamerInstance]: - """ - Asynchronously lists PlayerStreamerInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param "PlayerStreamerInstance.Order" order: The sort order of the list by `date_created`. Can be: `asc` (ascending) or `desc` (descending) with `desc` as the default. - :param "PlayerStreamerInstance.Status" status: Status to filter by, with possible values `created`, `started`, `ended`, or `failed`. - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: list that will contain up to limit results - """ - return [ - record - async for record in await self.stream_async( - order=order, - status=status, - limit=limit, - page_size=page_size, - ) - ] - - def page( - self, - order: Union["PlayerStreamerInstance.Order", object] = values.unset, - status: Union["PlayerStreamerInstance.Status", object] = values.unset, - page_token: Union[str, object] = values.unset, - page_number: Union[int, object] = values.unset, - page_size: Union[int, object] = values.unset, - ) -> PlayerStreamerPage: - """ - Retrieve a single page of PlayerStreamerInstance records from the API. - Request is executed immediately - - :param order: The sort order of the list by `date_created`. Can be: `asc` (ascending) or `desc` (descending) with `desc` as the default. - :param status: Status to filter by, with possible values `created`, `started`, `ended`, or `failed`. - :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 - - :returns: Page of PlayerStreamerInstance - """ - data = values.of( - { - "Order": order, - "Status": status, - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - response = self._version.page(method="GET", uri=self._uri, params=data) - return PlayerStreamerPage(self._version, response) - - async def page_async( - self, - order: Union["PlayerStreamerInstance.Order", object] = values.unset, - status: Union["PlayerStreamerInstance.Status", object] = values.unset, - page_token: Union[str, object] = values.unset, - page_number: Union[int, object] = values.unset, - page_size: Union[int, object] = values.unset, - ) -> PlayerStreamerPage: - """ - Asynchronously retrieve a single page of PlayerStreamerInstance records from the API. - Request is executed immediately - - :param order: The sort order of the list by `date_created`. Can be: `asc` (ascending) or `desc` (descending) with `desc` as the default. - :param status: Status to filter by, with possible values `created`, `started`, `ended`, or `failed`. - :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 - - :returns: Page of PlayerStreamerInstance - """ - data = values.of( - { - "Order": order, - "Status": status, - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - response = await self._version.page_async( - method="GET", uri=self._uri, params=data - ) - return PlayerStreamerPage(self._version, response) - - def get_page(self, target_url: str) -> PlayerStreamerPage: - """ - Retrieve a specific page of PlayerStreamerInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of PlayerStreamerInstance - """ - response = self._version.domain.twilio.request("GET", target_url) - return PlayerStreamerPage(self._version, response) - - async def get_page_async(self, target_url: str) -> PlayerStreamerPage: - """ - Asynchronously retrieve a specific page of PlayerStreamerInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of PlayerStreamerInstance - """ - response = await self._version.domain.twilio.request_async("GET", target_url) - return PlayerStreamerPage(self._version, response) - - def get(self, sid: str) -> PlayerStreamerContext: - """ - Constructs a PlayerStreamerContext - - :param sid: The SID of the PlayerStreamer resource to update. - """ - return PlayerStreamerContext(self._version, sid=sid) - - def __call__(self, sid: str) -> PlayerStreamerContext: - """ - Constructs a PlayerStreamerContext - - :param sid: The SID of the PlayerStreamer resource to update. - """ - return PlayerStreamerContext(self._version, sid=sid) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" diff --git a/twilio/rest/media/v1/player_streamer/playback_grant.py b/twilio/rest/media/v1/player_streamer/playback_grant.py deleted file mode 100644 index a4cdbb4026..0000000000 --- a/twilio/rest/media/v1/player_streamer/playback_grant.py +++ /dev/null @@ -1,280 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Media - 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 datetime import datetime -from typing import Any, Dict, Optional, Union -from twilio.base import deserialize, values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.version import Version - - -class PlaybackGrantInstance(InstanceResource): - """ - :ivar sid: The unique string generated to identify the PlayerStreamer resource that this PlaybackGrant authorizes views for. - :ivar url: The absolute URL of the resource. - :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this resource. - :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - :ivar grant: The grant that authorizes the player sdk to connect to the livestream - """ - - def __init__(self, version: Version, payload: Dict[str, Any], sid: str): - super().__init__(version) - - self.sid: Optional[str] = payload.get("sid") - self.url: Optional[str] = payload.get("url") - self.account_sid: Optional[str] = payload.get("account_sid") - self.date_created: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("date_created") - ) - self.grant: Optional[Dict[str, object]] = payload.get("grant") - - self._solution = { - "sid": sid, - } - self._context: Optional[PlaybackGrantContext] = None - - @property - def _proxy(self) -> "PlaybackGrantContext": - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: PlaybackGrantContext for this PlaybackGrantInstance - """ - if self._context is None: - self._context = PlaybackGrantContext( - self._version, - sid=self._solution["sid"], - ) - return self._context - - def create( - self, - ttl: Union[int, object] = values.unset, - access_control_allow_origin: Union[str, object] = values.unset, - ) -> "PlaybackGrantInstance": - """ - Create the PlaybackGrantInstance - - :param ttl: The time to live of the PlaybackGrant. Default value is 15 seconds. Maximum value is 60 seconds. - :param access_control_allow_origin: The full origin URL where the livestream can be streamed. If this is not provided, it can be streamed from any domain. - - :returns: The created PlaybackGrantInstance - """ - return self._proxy.create( - ttl=ttl, - access_control_allow_origin=access_control_allow_origin, - ) - - async def create_async( - self, - ttl: Union[int, object] = values.unset, - access_control_allow_origin: Union[str, object] = values.unset, - ) -> "PlaybackGrantInstance": - """ - Asynchronous coroutine to create the PlaybackGrantInstance - - :param ttl: The time to live of the PlaybackGrant. Default value is 15 seconds. Maximum value is 60 seconds. - :param access_control_allow_origin: The full origin URL where the livestream can be streamed. If this is not provided, it can be streamed from any domain. - - :returns: The created PlaybackGrantInstance - """ - return await self._proxy.create_async( - ttl=ttl, - access_control_allow_origin=access_control_allow_origin, - ) - - def fetch(self) -> "PlaybackGrantInstance": - """ - Fetch the PlaybackGrantInstance - - - :returns: The fetched PlaybackGrantInstance - """ - return self._proxy.fetch() - - async def fetch_async(self) -> "PlaybackGrantInstance": - """ - Asynchronous coroutine to fetch the PlaybackGrantInstance - - - :returns: The fetched PlaybackGrantInstance - """ - return await self._proxy.fetch_async() - - 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 PlaybackGrantContext(InstanceContext): - - def __init__(self, version: Version, sid: str): - """ - Initialize the PlaybackGrantContext - - :param version: Version that contains the resource - :param sid: The SID of the PlayerStreamer resource to fetch. - """ - super().__init__(version) - - # Path Solution - self._solution = { - "sid": sid, - } - self._uri = "/PlayerStreamers/{sid}/PlaybackGrant".format(**self._solution) - - def create( - self, - ttl: Union[int, object] = values.unset, - access_control_allow_origin: Union[str, object] = values.unset, - ) -> PlaybackGrantInstance: - """ - Create the PlaybackGrantInstance - - :param ttl: The time to live of the PlaybackGrant. Default value is 15 seconds. Maximum value is 60 seconds. - :param access_control_allow_origin: The full origin URL where the livestream can be streamed. If this is not provided, it can be streamed from any domain. - - :returns: The created PlaybackGrantInstance - """ - data = values.of( - { - "Ttl": ttl, - "AccessControlAllowOrigin": access_control_allow_origin, - } - ) - - payload = self._version.create(method="POST", uri=self._uri, data=data) - - return PlaybackGrantInstance(self._version, payload, sid=self._solution["sid"]) - - async def create_async( - self, - ttl: Union[int, object] = values.unset, - access_control_allow_origin: Union[str, object] = values.unset, - ) -> PlaybackGrantInstance: - """ - Asynchronous coroutine to create the PlaybackGrantInstance - - :param ttl: The time to live of the PlaybackGrant. Default value is 15 seconds. Maximum value is 60 seconds. - :param access_control_allow_origin: The full origin URL where the livestream can be streamed. If this is not provided, it can be streamed from any domain. - - :returns: The created PlaybackGrantInstance - """ - data = values.of( - { - "Ttl": ttl, - "AccessControlAllowOrigin": access_control_allow_origin, - } - ) - - payload = await self._version.create_async( - method="POST", uri=self._uri, data=data - ) - - return PlaybackGrantInstance(self._version, payload, sid=self._solution["sid"]) - - def fetch(self) -> PlaybackGrantInstance: - """ - Fetch the PlaybackGrantInstance - - - :returns: The fetched PlaybackGrantInstance - """ - - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) - - return PlaybackGrantInstance( - self._version, - payload, - sid=self._solution["sid"], - ) - - async def fetch_async(self) -> PlaybackGrantInstance: - """ - Asynchronous coroutine to fetch the PlaybackGrantInstance - - - :returns: The fetched PlaybackGrantInstance - """ - - payload = await self._version.fetch_async( - method="GET", - uri=self._uri, - ) - - return PlaybackGrantInstance( - self._version, - payload, - sid=self._solution["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 PlaybackGrantList(ListResource): - - def __init__(self, version: Version, sid: str): - """ - Initialize the PlaybackGrantList - - :param version: Version that contains the resource - :param sid: The unique string generated to identify the PlayerStreamer resource associated with this PlaybackGrant - - """ - super().__init__(version) - - # Path Solution - self._solution = { - "sid": sid, - } - - def get(self) -> PlaybackGrantContext: - """ - Constructs a PlaybackGrantContext - - """ - return PlaybackGrantContext(self._version, sid=self._solution["sid"]) - - def __call__(self) -> PlaybackGrantContext: - """ - Constructs a PlaybackGrantContext - - """ - return PlaybackGrantContext(self._version, sid=self._solution["sid"]) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" diff --git a/twilio/rest/numbers/v1/bulk_eligibility.py b/twilio/rest/numbers/v1/bulk_eligibility.py index 3915116416..0e92b5b076 100644 --- a/twilio/rest/numbers/v1/bulk_eligibility.py +++ b/twilio/rest/numbers/v1/bulk_eligibility.py @@ -193,6 +193,7 @@ def create( data = body.to_dict() headers = {"Content-Type": "application/json"} + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -209,8 +210,8 @@ async def create_async( :returns: The created BulkEligibilityInstance """ - data = body.to_dict() + headers = {"Content-Type": "application/json"} payload = await self._version.create_async( diff --git a/twilio/rest/numbers/v1/eligibility.py b/twilio/rest/numbers/v1/eligibility.py index 3b8b5be345..91a2c73261 100644 --- a/twilio/rest/numbers/v1/eligibility.py +++ b/twilio/rest/numbers/v1/eligibility.py @@ -64,6 +64,7 @@ def create(self, body: Union[object, object] = values.unset) -> EligibilityInsta data = body.to_dict() headers = {"Content-Type": "application/json"} + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -80,8 +81,8 @@ async def create_async( :returns: The created EligibilityInstance """ - data = body.to_dict() + headers = {"Content-Type": "application/json"} payload = await self._version.create_async( diff --git a/twilio/rest/numbers/v1/porting_port_in.py b/twilio/rest/numbers/v1/porting_port_in.py index b0cd0fdfc1..086c630c65 100644 --- a/twilio/rest/numbers/v1/porting_port_in.py +++ b/twilio/rest/numbers/v1/porting_port_in.py @@ -68,6 +68,7 @@ def create( data = body.to_dict() headers = {"Content-Type": "application/json"} + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -84,8 +85,8 @@ async def create_async( :returns: The created PortingPortInInstance """ - data = body.to_dict() + headers = {"Content-Type": "application/json"} payload = await self._version.create_async( diff --git a/twilio/rest/numbers/v1/porting_port_in_fetch.py b/twilio/rest/numbers/v1/porting_port_in_fetch.py index 78e31afbd8..dc0b79c252 100644 --- a/twilio/rest/numbers/v1/porting_port_in_fetch.py +++ b/twilio/rest/numbers/v1/porting_port_in_fetch.py @@ -30,6 +30,7 @@ class PortingPortInFetchInstance(InstanceResource): :ivar target_port_in_date: Minimum number of days in the future (at least 2 days) needs to be established with the Ops team for validation. :ivar target_port_in_time_range_start: Minimum hour in the future needs to be established with the Ops team for validation. :ivar target_port_in_time_range_end: Maximum hour in the future needs to be established with the Ops team for validation. + :ivar port_in_request_status: The status of the port in request. The possible values are: In progress, Completed, Expired, In review, Waiting for Signature, Action Required, and Canceled. :ivar losing_carrier_information: The information for the losing carrier. :ivar phone_numbers: The list of phone numbers to Port in. Phone numbers are in E.164 format (e.g. +16175551212). :ivar documents: The list of documents SID referencing a utility bills @@ -58,6 +59,9 @@ def __init__( self.target_port_in_time_range_end: Optional[str] = payload.get( "target_port_in_time_range_end" ) + self.port_in_request_status: Optional[str] = payload.get( + "port_in_request_status" + ) self.losing_carrier_information: Optional[Dict[str, object]] = payload.get( "losing_carrier_information" ) diff --git a/twilio/rest/numbers/v2/bulk_hosted_number_order.py b/twilio/rest/numbers/v2/bulk_hosted_number_order.py index 0e75a5067b..30a57e28f4 100644 --- a/twilio/rest/numbers/v2/bulk_hosted_number_order.py +++ b/twilio/rest/numbers/v2/bulk_hosted_number_order.py @@ -231,6 +231,7 @@ def create( data = body.to_dict() headers = {"Content-Type": "application/json"} + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -247,8 +248,8 @@ async def create_async( :returns: The created BulkHostedNumberOrderInstance """ - data = body.to_dict() + headers = {"Content-Type": "application/json"} payload = await self._version.create_async( diff --git a/twilio/rest/oauth/v1/token.py b/twilio/rest/oauth/v1/token.py index eb6d9d1b74..42884f0896 100644 --- a/twilio/rest/oauth/v1/token.py +++ b/twilio/rest/oauth/v1/token.py @@ -12,9 +12,8 @@ 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 import values from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -37,9 +36,7 @@ def __init__(self, version: Version, payload: Dict[str, Any]): self.refresh_token: Optional[str] = payload.get("refresh_token") self.id_token: Optional[str] = payload.get("id_token") self.token_type: Optional[str] = payload.get("token_type") - self.expires_in: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("expires_in") - ) + self.expires_in: Optional[int] = payload.get("expires_in") def __repr__(self) -> str: """ @@ -68,10 +65,12 @@ def create( self, grant_type: str, client_id: str, - client_secret: str, + client_secret: Union[str, object] = values.unset, code: Union[str, object] = values.unset, redirect_uri: Union[str, object] = values.unset, audience: Union[str, object] = values.unset, + refresh_token: Union[str, object] = values.unset, + scope: Union[str, object] = values.unset, ) -> TokenInstance: """ Create the TokenInstance @@ -82,6 +81,8 @@ def create( :param code: JWT token related to the authorization code grant type. :param redirect_uri: The redirect uri :param audience: The targeted audience uri + :param refresh_token: JWT token related to refresh access token. + :param scope: The scope of token :returns: The created TokenInstance """ @@ -94,6 +95,8 @@ def create( "Code": code, "RedirectUri": redirect_uri, "Audience": audience, + "RefreshToken": refresh_token, + "Scope": scope, } ) @@ -109,10 +112,12 @@ async def create_async( self, grant_type: str, client_id: str, - client_secret: str, + client_secret: Union[str, object] = values.unset, code: Union[str, object] = values.unset, redirect_uri: Union[str, object] = values.unset, audience: Union[str, object] = values.unset, + refresh_token: Union[str, object] = values.unset, + scope: Union[str, object] = values.unset, ) -> TokenInstance: """ Asynchronously create the TokenInstance @@ -123,6 +128,8 @@ async def create_async( :param code: JWT token related to the authorization code grant type. :param redirect_uri: The redirect uri :param audience: The targeted audience uri + :param refresh_token: JWT token related to refresh access token. + :param scope: The scope of token :returns: The created TokenInstance """ @@ -135,6 +142,8 @@ async def create_async( "Code": code, "RedirectUri": redirect_uri, "Audience": audience, + "RefreshToken": refresh_token, + "Scope": scope, } ) diff --git a/twilio/rest/preview_messaging/v1/message.py b/twilio/rest/preview_messaging/v1/message.py index c6212c7f4f..0d2822e002 100644 --- a/twilio/rest/preview_messaging/v1/message.py +++ b/twilio/rest/preview_messaging/v1/message.py @@ -168,6 +168,7 @@ def create(self, create_messages_request: CreateMessagesRequest) -> MessageInsta data = create_messages_request.to_dict() headers = {"Content-Type": "application/json"} + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -184,8 +185,8 @@ async def create_async( :returns: The created MessageInstance """ - data = create_messages_request.to_dict() + headers = {"Content-Type": "application/json"} payload = await self._version.create_async( diff --git a/twilio/rest/serverless/v1/service/build/__init__.py b/twilio/rest/serverless/v1/service/build/__init__.py index 25997bec2e..fa7a7947ac 100644 --- a/twilio/rest/serverless/v1/service/build/__init__.py +++ b/twilio/rest/serverless/v1/service/build/__init__.py @@ -315,6 +315,7 @@ def create(self, asset_versions: Union[List[str], object]=values.unset, function }) + payload = self._version.create(method='POST', uri=self._uri, data=data,) return BuildInstance(self._version, payload, service_sid=self._solution['service_sid']) @@ -339,6 +340,7 @@ async def create_async(self, asset_versions: Union[List[str], object]=values.uns }) + payload = await self._version.create_async(method='POST', uri=self._uri, data=data,) return BuildInstance(self._version, payload, service_sid=self._solution['service_sid']) diff --git a/twilio/rest/studio/v2/flow_validate.py b/twilio/rest/studio/v2/flow_validate.py index 6994e6af14..43f226e154 100644 --- a/twilio/rest/studio/v2/flow_validate.py +++ b/twilio/rest/studio/v2/flow_validate.py @@ -75,6 +75,7 @@ def update( :returns: The created FlowValidateInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -109,6 +110,7 @@ async def update_async( :returns: The created FlowValidateInstance """ + data = values.of( { "FriendlyName": friendly_name, 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 index 0556e6bb4a..a1c44b1644 100644 --- 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 @@ -93,6 +93,7 @@ def create( data = body.to_dict() headers = {"Content-Type": "application/json"} + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -111,8 +112,8 @@ async def create_async( :returns: The created TaskQueueBulkRealTimeStatisticsInstance """ - data = body.to_dict() + headers = {"Content-Type": "application/json"} payload = await self._version.create_async( diff --git a/twilio/rest/trusthub/v1/compliance_registration_inquiries.py b/twilio/rest/trusthub/v1/compliance_registration_inquiries.py index d86b72db01..c279bce12b 100644 --- a/twilio/rest/trusthub/v1/compliance_registration_inquiries.py +++ b/twilio/rest/trusthub/v1/compliance_registration_inquiries.py @@ -14,7 +14,7 @@ from typing import Any, Dict, Optional, Union from twilio.base import serialize, values - +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource from twilio.base.version import Version @@ -51,7 +51,12 @@ class PhoneNumberType(object): :ivar url: The URL of this resource. """ - def __init__(self, version: Version, payload: Dict[str, Any]): + def __init__( + self, + version: Version, + payload: Dict[str, Any], + registration_id: Optional[str] = None, + ): super().__init__(version) self.inquiry_id: Optional[str] = payload.get("inquiry_id") @@ -59,14 +64,163 @@ def __init__(self, version: Version, payload: Dict[str, Any]): self.registration_id: Optional[str] = payload.get("registration_id") self.url: Optional[str] = payload.get("url") + self._solution = { + "registration_id": registration_id or self.registration_id, + } + self._context: Optional[ComplianceRegistrationInquiriesContext] = None + + @property + def _proxy(self) -> "ComplianceRegistrationInquiriesContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: ComplianceRegistrationInquiriesContext for this ComplianceRegistrationInquiriesInstance + """ + if self._context is None: + self._context = ComplianceRegistrationInquiriesContext( + self._version, + registration_id=self._solution["registration_id"], + ) + return self._context + + def update( + self, + is_isv_embed: Union[bool, object] = values.unset, + theme_set_id: Union[str, object] = values.unset, + ) -> "ComplianceRegistrationInquiriesInstance": + """ + Update the ComplianceRegistrationInquiriesInstance + + :param is_isv_embed: Indicates if the inquiry is being started from an ISV embedded component. + :param theme_set_id: Theme id for styling the inquiry form. + + :returns: The updated ComplianceRegistrationInquiriesInstance + """ + return self._proxy.update( + is_isv_embed=is_isv_embed, + theme_set_id=theme_set_id, + ) + + async def update_async( + self, + is_isv_embed: Union[bool, object] = values.unset, + theme_set_id: Union[str, object] = values.unset, + ) -> "ComplianceRegistrationInquiriesInstance": + """ + Asynchronous coroutine to update the ComplianceRegistrationInquiriesInstance + + :param is_isv_embed: Indicates if the inquiry is being started from an ISV embedded component. + :param theme_set_id: Theme id for styling the inquiry form. + + :returns: The updated ComplianceRegistrationInquiriesInstance + """ + return await self._proxy.update_async( + is_isv_embed=is_isv_embed, + theme_set_id=theme_set_id, + ) + 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 ComplianceRegistrationInquiriesContext(InstanceContext): + + def __init__(self, version: Version, registration_id: str): + """ + Initialize the ComplianceRegistrationInquiriesContext + + :param version: Version that contains the resource + :param registration_id: The unique RegistrationId matching the Regulatory Compliance Inquiry that should be resumed or resubmitted. This value will have been returned by the initial Regulatory Compliance Inquiry creation call. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "registration_id": registration_id, + } + self._uri = "/ComplianceInquiries/Registration/{registration_id}/RegulatoryCompliance/GB/Initialize".format( + **self._solution + ) + + def update( + self, + is_isv_embed: Union[bool, object] = values.unset, + theme_set_id: Union[str, object] = values.unset, + ) -> ComplianceRegistrationInquiriesInstance: + """ + Update the ComplianceRegistrationInquiriesInstance + + :param is_isv_embed: Indicates if the inquiry is being started from an ISV embedded component. + :param theme_set_id: Theme id for styling the inquiry form. + + :returns: The updated ComplianceRegistrationInquiriesInstance + """ + data = values.of( + { + "IsIsvEmbed": serialize.boolean_to_string(is_isv_embed), + "ThemeSetId": theme_set_id, + } + ) + + payload = self._version.update( + method="POST", + uri=self._uri, + data=data, + ) + + return ComplianceRegistrationInquiriesInstance( + self._version, payload, registration_id=self._solution["registration_id"] + ) + + async def update_async( + self, + is_isv_embed: Union[bool, object] = values.unset, + theme_set_id: Union[str, object] = values.unset, + ) -> ComplianceRegistrationInquiriesInstance: + """ + Asynchronous coroutine to update the ComplianceRegistrationInquiriesInstance - return "" + :param is_isv_embed: Indicates if the inquiry is being started from an ISV embedded component. + :param theme_set_id: Theme id for styling the inquiry form. + + :returns: The updated ComplianceRegistrationInquiriesInstance + """ + data = values.of( + { + "IsIsvEmbed": serialize.boolean_to_string(is_isv_embed), + "ThemeSetId": theme_set_id, + } + ) + + payload = await self._version.update_async( + method="POST", + uri=self._uri, + data=data, + ) + + return ComplianceRegistrationInquiriesInstance( + self._version, payload, registration_id=self._solution["registration_id"] + ) + + 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 ComplianceRegistrationInquiriesList(ListResource): @@ -129,6 +283,7 @@ def create( is_isv_embed: Union[bool, object] = values.unset, isv_registering_for_self_or_tenant: Union[str, object] = values.unset, status_callback_url: Union[str, object] = values.unset, + theme_set_id: Union[str, object] = values.unset, ) -> ComplianceRegistrationInquiriesInstance: """ Create the ComplianceRegistrationInquiriesInstance @@ -171,6 +326,7 @@ def create( :param is_isv_embed: Indicates if the inquiry is being started from an ISV embedded component. :param isv_registering_for_self_or_tenant: Indicates if the isv registering for self or tenant. :param status_callback_url: The url we call to inform you of bundle changes. + :param theme_set_id: Theme id for styling the inquiry form. :returns: The created ComplianceRegistrationInquiriesInstance """ @@ -219,6 +375,7 @@ def create( "IsIsvEmbed": serialize.boolean_to_string(is_isv_embed), "IsvRegisteringForSelfOrTenant": isv_registering_for_self_or_tenant, "StatusCallbackUrl": status_callback_url, + "ThemeSetId": theme_set_id, } ) @@ -275,6 +432,7 @@ async def create_async( is_isv_embed: Union[bool, object] = values.unset, isv_registering_for_self_or_tenant: Union[str, object] = values.unset, status_callback_url: Union[str, object] = values.unset, + theme_set_id: Union[str, object] = values.unset, ) -> ComplianceRegistrationInquiriesInstance: """ Asynchronously create the ComplianceRegistrationInquiriesInstance @@ -317,6 +475,7 @@ async def create_async( :param is_isv_embed: Indicates if the inquiry is being started from an ISV embedded component. :param isv_registering_for_self_or_tenant: Indicates if the isv registering for self or tenant. :param status_callback_url: The url we call to inform you of bundle changes. + :param theme_set_id: Theme id for styling the inquiry form. :returns: The created ComplianceRegistrationInquiriesInstance """ @@ -365,6 +524,7 @@ async def create_async( "IsIsvEmbed": serialize.boolean_to_string(is_isv_embed), "IsvRegisteringForSelfOrTenant": isv_registering_for_self_or_tenant, "StatusCallbackUrl": status_callback_url, + "ThemeSetId": theme_set_id, } ) @@ -376,6 +536,26 @@ async def create_async( return ComplianceRegistrationInquiriesInstance(self._version, payload) + def get(self, registration_id: str) -> ComplianceRegistrationInquiriesContext: + """ + Constructs a ComplianceRegistrationInquiriesContext + + :param registration_id: The unique RegistrationId matching the Regulatory Compliance Inquiry that should be resumed or resubmitted. This value will have been returned by the initial Regulatory Compliance Inquiry creation call. + """ + return ComplianceRegistrationInquiriesContext( + self._version, registration_id=registration_id + ) + + def __call__(self, registration_id: str) -> ComplianceRegistrationInquiriesContext: + """ + Constructs a ComplianceRegistrationInquiriesContext + + :param registration_id: The unique RegistrationId matching the Regulatory Compliance Inquiry that should be resumed or resubmitted. This value will have been returned by the initial Regulatory Compliance Inquiry creation call. + """ + return ComplianceRegistrationInquiriesContext( + self._version, registration_id=registration_id + ) + def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/trusthub/v1/trust_products/__init__.py b/twilio/rest/trusthub/v1/trust_products/__init__.py index a638f680f0..b74e8e842e 100644 --- a/twilio/rest/trusthub/v1/trust_products/__init__.py +++ b/twilio/rest/trusthub/v1/trust_products/__init__.py @@ -41,18 +41,18 @@ class Status(object): TWILIO_APPROVED = "twilio-approved" """ - :ivar sid: The unique string that we created to identify the Customer-Profile resource. - :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Customer-Profile resource. - :ivar policy_sid: The unique string of a policy that is associated to the Customer-Profile resource. + :ivar sid: The unique string that we created to identify the Trust Product resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Trust Product resource. + :ivar policy_sid: The unique string of the policy that is associated with the Trust Product resource. :ivar friendly_name: The string that you assigned to describe the resource. :ivar status: - :ivar valid_until: The date and time in GMT in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format when the resource will be valid until. - :ivar email: The email address that will receive updates when the Customer-Profile resource changes status. + :ivar valid_until: The date and time in GMT in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format until which the resource will be valid. + :ivar email: The email address that will receive updates when the Trust Product resource changes status. :ivar status_callback: The URL we call to inform your application of status changes. :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. :ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - :ivar url: The absolute URL of the Customer-Profile resource. - :ivar links: The URLs of the Assigned Items of the Customer-Profile resource. + :ivar url: The absolute URL of the Trust Product resource. + :ivar links: The URLs of the Assigned Items of the Trust Product resource. """ def __init__( @@ -148,7 +148,7 @@ def update( :param status: :param status_callback: The URL we call to inform your application of status changes. :param friendly_name: The string that you assigned to describe the resource. - :param email: The email address that will receive updates when the Customer-Profile resource changes status. + :param email: The email address that will receive updates when the Trust Product resource changes status. :returns: The updated TrustProductsInstance """ @@ -172,7 +172,7 @@ async def update_async( :param status: :param status_callback: The URL we call to inform your application of status changes. :param friendly_name: The string that you assigned to describe the resource. - :param email: The email address that will receive updates when the Customer-Profile resource changes status. + :param email: The email address that will receive updates when the Trust Product resource changes status. :returns: The updated TrustProductsInstance """ @@ -223,7 +223,7 @@ def __init__(self, version: Version, sid: str): Initialize the TrustProductsContext :param version: Version that contains the resource - :param sid: The unique string that we created to identify the Customer-Profile resource. + :param sid: The unique string that we created to identify the Trust Product resource. """ super().__init__(version) @@ -316,7 +316,7 @@ def update( :param status: :param status_callback: The URL we call to inform your application of status changes. :param friendly_name: The string that you assigned to describe the resource. - :param email: The email address that will receive updates when the Customer-Profile resource changes status. + :param email: The email address that will receive updates when the Trust Product resource changes status. :returns: The updated TrustProductsInstance """ @@ -350,7 +350,7 @@ async def update_async( :param status: :param status_callback: The URL we call to inform your application of status changes. :param friendly_name: The string that you assigned to describe the resource. - :param email: The email address that will receive updates when the Customer-Profile resource changes status. + :param email: The email address that will receive updates when the Trust Product resource changes status. :returns: The updated TrustProductsInstance """ @@ -466,8 +466,8 @@ def create( Create the TrustProductsInstance :param friendly_name: The string that you assigned to describe the resource. - :param email: The email address that will receive updates when the Customer-Profile resource changes status. - :param policy_sid: The unique string of a policy that is associated to the Customer-Profile resource. + :param email: The email address that will receive updates when the Trust Product resource changes status. + :param policy_sid: The unique string of a policy that is associated to the Trust Product resource. :param status_callback: The URL we call to inform your application of status changes. :returns: The created TrustProductsInstance @@ -501,8 +501,8 @@ async def create_async( Asynchronously create the TrustProductsInstance :param friendly_name: The string that you assigned to describe the resource. - :param email: The email address that will receive updates when the Customer-Profile resource changes status. - :param policy_sid: The unique string of a policy that is associated to the Customer-Profile resource. + :param email: The email address that will receive updates when the Trust Product resource changes status. + :param policy_sid: The unique string of a policy that is associated to the Trust Product resource. :param status_callback: The URL we call to inform your application of status changes. :returns: The created TrustProductsInstance @@ -539,9 +539,9 @@ def stream( is reached. The results are returned as a generator, so this operation is memory efficient. - :param "TrustProductsInstance.Status" status: The verification status of the Customer-Profile resource. + :param "TrustProductsInstance.Status" status: The verification status of the Trust Product resource. :param str friendly_name: The string that you assigned to describe the resource. - :param str policy_sid: The unique string of a policy that is associated to the Customer-Profile resource. + :param str policy_sid: The unique string of a policy that is associated to the Trust Product resource. :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 @@ -575,9 +575,9 @@ async def stream_async( is reached. The results are returned as a generator, so this operation is memory efficient. - :param "TrustProductsInstance.Status" status: The verification status of the Customer-Profile resource. + :param "TrustProductsInstance.Status" status: The verification status of the Trust Product resource. :param str friendly_name: The string that you assigned to describe the resource. - :param str policy_sid: The unique string of a policy that is associated to the Customer-Profile resource. + :param str policy_sid: The unique string of a policy that is associated to the Trust Product resource. :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 @@ -610,9 +610,9 @@ def list( Unlike stream(), this operation is eager and will load `limit` records into memory before returning. - :param "TrustProductsInstance.Status" status: The verification status of the Customer-Profile resource. + :param "TrustProductsInstance.Status" status: The verification status of the Trust Product resource. :param str friendly_name: The string that you assigned to describe the resource. - :param str policy_sid: The unique string of a policy that is associated to the Customer-Profile resource. + :param str policy_sid: The unique string of a policy that is associated to the Trust Product resource. :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 @@ -645,9 +645,9 @@ async def list_async( Unlike stream(), this operation is eager and will load `limit` records into memory before returning. - :param "TrustProductsInstance.Status" status: The verification status of the Customer-Profile resource. + :param "TrustProductsInstance.Status" status: The verification status of the Trust Product resource. :param str friendly_name: The string that you assigned to describe the resource. - :param str policy_sid: The unique string of a policy that is associated to the Customer-Profile resource. + :param str policy_sid: The unique string of a policy that is associated to the Trust Product resource. :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 @@ -681,9 +681,9 @@ def page( Retrieve a single page of TrustProductsInstance records from the API. Request is executed immediately - :param status: The verification status of the Customer-Profile resource. + :param status: The verification status of the Trust Product resource. :param friendly_name: The string that you assigned to describe the resource. - :param policy_sid: The unique string of a policy that is associated to the Customer-Profile resource. + :param policy_sid: The unique string of a policy that is associated to the Trust Product resource. :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 @@ -717,9 +717,9 @@ async def page_async( Asynchronously retrieve a single page of TrustProductsInstance records from the API. Request is executed immediately - :param status: The verification status of the Customer-Profile resource. + :param status: The verification status of the Trust Product resource. :param friendly_name: The string that you assigned to describe the resource. - :param policy_sid: The unique string of a policy that is associated to the Customer-Profile resource. + :param policy_sid: The unique string of a policy that is associated to the Trust Product resource. :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 @@ -770,7 +770,7 @@ def get(self, sid: str) -> TrustProductsContext: """ Constructs a TrustProductsContext - :param sid: The unique string that we created to identify the Customer-Profile resource. + :param sid: The unique string that we created to identify the Trust Product resource. """ return TrustProductsContext(self._version, sid=sid) @@ -778,7 +778,7 @@ def __call__(self, sid: str) -> TrustProductsContext: """ Constructs a TrustProductsContext - :param sid: The unique string that we created to identify the Customer-Profile resource. + :param sid: The unique string that we created to identify the Trust Product resource. """ return TrustProductsContext(self._version, sid=sid) diff --git a/twilio/rest/video/v1/room/participant/subscribe_rules.py b/twilio/rest/video/v1/room/participant/subscribe_rules.py index 3015163e6d..e07d3b5ff9 100644 --- a/twilio/rest/video/v1/room/participant/subscribe_rules.py +++ b/twilio/rest/video/v1/room/participant/subscribe_rules.py @@ -132,6 +132,7 @@ def update( :returns: The created SubscribeRulesInstance """ + data = values.of( { "Rules": serialize.object(rules), @@ -161,6 +162,7 @@ async def update_async( :returns: The created SubscribeRulesInstance """ + data = values.of( { "Rules": serialize.object(rules), diff --git a/twilio/rest/video/v1/room/recording_rules.py b/twilio/rest/video/v1/room/recording_rules.py index 6e731a1458..c94bbf1497 100644 --- a/twilio/rest/video/v1/room/recording_rules.py +++ b/twilio/rest/video/v1/room/recording_rules.py @@ -111,6 +111,7 @@ def update( :returns: The created RecordingRulesInstance """ + data = values.of( { "Rules": serialize.object(rules), @@ -137,6 +138,7 @@ async def update_async( :returns: The created RecordingRulesInstance """ + data = values.of( { "Rules": serialize.object(rules), From 31b6560644143d0bee8bcabc108614b4940cf0e3 Mon Sep 17 00:00:00 2001 From: Twilio Date: Mon, 1 Apr 2024 15:00:53 +0000 Subject: [PATCH 02/87] Release 9.0.3 --- setup.py | 2 +- twilio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 625c210413..1a14afcb7a 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name="twilio", - version="9.0.2", + version="9.0.3", description="Twilio API client and TwiML generator", author="Twilio", help_center="https://www.twilio.com/help/contact", diff --git a/twilio/__init__.py b/twilio/__init__.py index 698515090a..6a60af8330 100644 --- a/twilio/__init__.py +++ b/twilio/__init__.py @@ -1,2 +1,2 @@ -__version_info__ = ("9", "0", "2") +__version_info__ = ("9", "0", "3") __version__ = ".".join(__version_info__) From 3318ec17c97c6f1ac5923059460c059fe431b271 Mon Sep 17 00:00:00 2001 From: Twilio Date: Thu, 4 Apr 2024 14:52:04 +0000 Subject: [PATCH 03/87] [Librarian] Regenerated @ b894abe9525247ea4345d78891244817d397f6de f80058eb415516baff0287784518c3a22be1b1b6 --- CHANGES.md | 25 ++++++ twilio/rest/api/v2010/account/call/payment.py | 1 + .../api/v2010/account/conference/__init__.py | 80 +++++++++---------- .../conversations/v1/conversation/__init__.py | 24 +++--- twilio/rest/flex_api/v1/plugin/__init__.py | 12 --- .../flex_api/v1/plugin/plugin_versions.py | 12 +++ twilio/rest/lookups/v2/phone_number.py | 22 ++++- twilio/rest/messaging/v1/service/__init__.py | 4 + twilio/rest/verify/v2/service/__init__.py | 38 +++++++++ 9 files changed, 150 insertions(+), 68 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 1bc063569b..f35fbb4c48 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,31 @@ twilio-python Changelog Here you can see the full list of changes between each twilio-python release. +[2024-04-04] Version 9.0.4 +-------------------------- +**Api** +- Correct conference filtering by date_created and date_updated documentation, clarifying that times are UTC. + +**Flex** +- Remove optional parameter from `plugins` and it to `plugin_versions` + +**Lookups** +- Add new `pre_fill` package to the lookup response + +**Messaging** +- Cleanup api.messaging.next-gen from Messaging Services endpoints +- Readd Sending-Window after fixing test failure + +**Verify** +- Add `whatsapp.msg_service_sid` and `whatsapp.from` parameters to create, update, get and list of services endpoints + +**Voice** +- Correct conference filtering by date_created and date_updated documentation, clarifying that times are UTC. + +**Twiml** +- Add new `token_type` value `payment-method` for `Pay` verb + + [2024-04-01] Version 9.0.3 -------------------------- **Api** diff --git a/twilio/rest/api/v2010/account/call/payment.py b/twilio/rest/api/v2010/account/call/payment.py index d6252f5277..08619588de 100644 --- a/twilio/rest/api/v2010/account/call/payment.py +++ b/twilio/rest/api/v2010/account/call/payment.py @@ -47,6 +47,7 @@ class Status(object): class TokenType(object): ONE_TIME = "one-time" REUSABLE = "reusable" + PAYMENT_METHOD = "payment-method" """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Payments resource. diff --git a/twilio/rest/api/v2010/account/conference/__init__.py b/twilio/rest/api/v2010/account/conference/__init__.py index fff75dea5d..074ce8a587 100644 --- a/twilio/rest/api/v2010/account/conference/__init__.py +++ b/twilio/rest/api/v2010/account/conference/__init__.py @@ -47,12 +47,12 @@ class UpdateStatus(object): """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Conference resource. - :ivar date_created: The date and time in GMT that this resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - :ivar date_updated: The date and time in GMT that this resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_created: The date and time in UTC that this resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in UTC that this resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. :ivar api_version: The API version used to create this conference. - :ivar friendly_name: A string that you assigned to describe this conference room. Maxiumum length is 128 characters. + :ivar friendly_name: A string that you assigned to describe this conference room. Maximum length is 128 characters. :ivar region: A string that represents the Twilio Region where the conference audio was mixed. May be `us1`, `ie1`, `de1`, `sg1`, `br1`, `au1`, and `jp1`. Basic conference audio will always be mixed in `us1`. Global Conference audio will be mixed nearest to the majority of participants. - :ivar sid: The unique string that that we created to identify this Conference resource. + :ivar sid: The unique, Twilio-provided string used to identify this Conference resource. :ivar status: :ivar uri: The URI of this resource, relative to `https://api.twilio.com`. :ivar subresource_uris: A list of related resources identified by their URIs relative to `https://api.twilio.com`. @@ -428,12 +428,12 @@ def stream( is reached. 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 date date_created: Only include conferences that were created on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read conferences that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read conferences that were created on or after midnight of this date. + :param date date_created_before: Only include conferences that were created on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read conferences that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read conferences that were created on or after midnight of this date. + :param date date_created_after: Only include conferences that were created on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read conferences that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read conferences that were created on or after midnight of this date. + :param date date_updated: Only include conferences that were last updated on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were last updated on this date. You can also specify an inequality, such as `DateUpdated<=YYYY-MM-DD`, to read conferences that were last updated on or before midnight of this date, and `DateUpdated>=YYYY-MM-DD` to read conferences that were last updated on or after midnight of this date. + :param date date_updated_before: Only include conferences that were last updated on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were last updated on this date. You can also specify an inequality, such as `DateUpdated<=YYYY-MM-DD`, to read conferences that were last updated on or before midnight of this date, and `DateUpdated>=YYYY-MM-DD` to read conferences that were last updated on or after midnight of this date. + :param date date_updated_after: Only include conferences that were last updated on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were last updated on this date. You can also specify an inequality, such as `DateUpdated<=YYYY-MM-DD`, to read conferences that were last updated on or before midnight of this date, and `DateUpdated>=YYYY-MM-DD` to read conferences that were last updated on or after midnight of this date. :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() @@ -479,12 +479,12 @@ async def stream_async( is reached. 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 date date_created: Only include conferences that were created on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read conferences that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read conferences that were created on or after midnight of this date. + :param date date_created_before: Only include conferences that were created on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read conferences that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read conferences that were created on or after midnight of this date. + :param date date_created_after: Only include conferences that were created on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read conferences that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read conferences that were created on or after midnight of this date. + :param date date_updated: Only include conferences that were last updated on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were last updated on this date. You can also specify an inequality, such as `DateUpdated<=YYYY-MM-DD`, to read conferences that were last updated on or before midnight of this date, and `DateUpdated>=YYYY-MM-DD` to read conferences that were last updated on or after midnight of this date. + :param date date_updated_before: Only include conferences that were last updated on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were last updated on this date. You can also specify an inequality, such as `DateUpdated<=YYYY-MM-DD`, to read conferences that were last updated on or before midnight of this date, and `DateUpdated>=YYYY-MM-DD` to read conferences that were last updated on or after midnight of this date. + :param date date_updated_after: Only include conferences that were last updated on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were last updated on this date. You can also specify an inequality, such as `DateUpdated<=YYYY-MM-DD`, to read conferences that were last updated on or before midnight of this date, and `DateUpdated>=YYYY-MM-DD` to read conferences that were last updated on or after midnight of this date. :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() @@ -529,12 +529,12 @@ def list( Unlike stream(), this operation is eager and will load `limit` records into 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 date date_created: Only include conferences that were created on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read conferences that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read conferences that were created on or after midnight of this date. + :param date date_created_before: Only include conferences that were created on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read conferences that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read conferences that were created on or after midnight of this date. + :param date date_created_after: Only include conferences that were created on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read conferences that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read conferences that were created on or after midnight of this date. + :param date date_updated: Only include conferences that were last updated on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were last updated on this date. You can also specify an inequality, such as `DateUpdated<=YYYY-MM-DD`, to read conferences that were last updated on or before midnight of this date, and `DateUpdated>=YYYY-MM-DD` to read conferences that were last updated on or after midnight of this date. + :param date date_updated_before: Only include conferences that were last updated on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were last updated on this date. You can also specify an inequality, such as `DateUpdated<=YYYY-MM-DD`, to read conferences that were last updated on or before midnight of this date, and `DateUpdated>=YYYY-MM-DD` to read conferences that were last updated on or after midnight of this date. + :param date date_updated_after: Only include conferences that were last updated on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were last updated on this date. You can also specify an inequality, such as `DateUpdated<=YYYY-MM-DD`, to read conferences that were last updated on or before midnight of this date, and `DateUpdated>=YYYY-MM-DD` to read conferences that were last updated on or after midnight of this date. :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 @@ -579,12 +579,12 @@ async def list_async( Unlike stream(), this operation is eager and will load `limit` records into 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 date date_created: Only include conferences that were created on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read conferences that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read conferences that were created on or after midnight of this date. + :param date date_created_before: Only include conferences that were created on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read conferences that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read conferences that were created on or after midnight of this date. + :param date date_created_after: Only include conferences that were created on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read conferences that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read conferences that were created on or after midnight of this date. + :param date date_updated: Only include conferences that were last updated on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were last updated on this date. You can also specify an inequality, such as `DateUpdated<=YYYY-MM-DD`, to read conferences that were last updated on or before midnight of this date, and `DateUpdated>=YYYY-MM-DD` to read conferences that were last updated on or after midnight of this date. + :param date date_updated_before: Only include conferences that were last updated on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were last updated on this date. You can also specify an inequality, such as `DateUpdated<=YYYY-MM-DD`, to read conferences that were last updated on or before midnight of this date, and `DateUpdated>=YYYY-MM-DD` to read conferences that were last updated on or after midnight of this date. + :param date date_updated_after: Only include conferences that were last updated on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were last updated on this date. You can also specify an inequality, such as `DateUpdated<=YYYY-MM-DD`, to read conferences that were last updated on or before midnight of this date, and `DateUpdated>=YYYY-MM-DD` to read conferences that were last updated on or after midnight of this date. :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 @@ -630,12 +630,12 @@ def page( Retrieve a single page of ConferenceInstance records from the API. 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 date_created: Only include conferences that were created on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read conferences that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read conferences that were created on or after midnight of this date. + :param date_created_before: Only include conferences that were created on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read conferences that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read conferences that were created on or after midnight of this date. + :param date_created_after: Only include conferences that were created on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read conferences that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read conferences that were created on or after midnight of this date. + :param date_updated: Only include conferences that were last updated on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were last updated on this date. You can also specify an inequality, such as `DateUpdated<=YYYY-MM-DD`, to read conferences that were last updated on or before midnight of this date, and `DateUpdated>=YYYY-MM-DD` to read conferences that were last updated on or after midnight of this date. + :param date_updated_before: Only include conferences that were last updated on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were last updated on this date. You can also specify an inequality, such as `DateUpdated<=YYYY-MM-DD`, to read conferences that were last updated on or before midnight of this date, and `DateUpdated>=YYYY-MM-DD` to read conferences that were last updated on or after midnight of this date. + :param date_updated_after: Only include conferences that were last updated on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were last updated on this date. You can also specify an inequality, such as `DateUpdated<=YYYY-MM-DD`, to read conferences that were last updated on or before midnight of this date, and `DateUpdated>=YYYY-MM-DD` to read conferences that were last updated on or after midnight of this date. :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 @@ -681,12 +681,12 @@ async def page_async( Asynchronously retrieve a single page of ConferenceInstance records from the API. 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 date_created: Only include conferences that were created on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read conferences that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read conferences that were created on or after midnight of this date. + :param date_created_before: Only include conferences that were created on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read conferences that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read conferences that were created on or after midnight of this date. + :param date_created_after: Only include conferences that were created on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read conferences that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read conferences that were created on or after midnight of this date. + :param date_updated: Only include conferences that were last updated on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were last updated on this date. You can also specify an inequality, such as `DateUpdated<=YYYY-MM-DD`, to read conferences that were last updated on or before midnight of this date, and `DateUpdated>=YYYY-MM-DD` to read conferences that were last updated on or after midnight of this date. + :param date_updated_before: Only include conferences that were last updated on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were last updated on this date. You can also specify an inequality, such as `DateUpdated<=YYYY-MM-DD`, to read conferences that were last updated on or before midnight of this date, and `DateUpdated>=YYYY-MM-DD` to read conferences that were last updated on or after midnight of this date. + :param date_updated_after: Only include conferences that were last updated on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were last updated on this date. You can also specify an inequality, such as `DateUpdated<=YYYY-MM-DD`, to read conferences that were last updated on or before midnight of this date, and `DateUpdated>=YYYY-MM-DD` to read conferences that were last updated on or after midnight of this date. :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 diff --git a/twilio/rest/conversations/v1/conversation/__init__.py b/twilio/rest/conversations/v1/conversation/__init__.py index bdb4bda324..4c9b8809ac 100644 --- a/twilio/rest/conversations/v1/conversation/__init__.py +++ b/twilio/rest/conversations/v1/conversation/__init__.py @@ -725,8 +725,8 @@ def stream( is reached. The results are returned as a generator, so this operation is memory efficient. - :param str start_date: Start date or time in ISO8601 format for filtering list of Conversations. If a date is provided, the start time of the date is used (YYYY-MM-DDT00:00:00Z). Can be combined with other filters. - :param str end_date: End date or time in ISO8601 format for filtering list of Conversations. If a date is provided, the end time of the date is used (YYYY-MM-DDT23:59:59Z). Can be combined with other filters. + :param str start_date: Specifies the beginning of the date range for filtering Conversations based on their creation date. Conversations that were created on or after this date will be included in the results. The date must be in ISO8601 format, specifically starting at the beginning of the specified date (YYYY-MM-DDT00:00:00Z), for precise filtering. This parameter can be combined with other filters. If this filter is used, the returned list is sorted by latest conversation creation date in descending order. + :param str end_date: Defines the end of the date range for filtering conversations by their creation date. Only conversations that were created on or before this date will appear in the results. The date must be in ISO8601 format, specifically capturing up to the end of the specified date (YYYY-MM-DDT23:59:59Z), to ensure that conversations from the entire end day are included. This parameter can be combined with other filters. If this filter is used, the returned list is sorted by latest conversation creation date in descending order. :param "ConversationInstance.State" state: State for sorting and filtering list of Conversations. Can be `active`, `inactive` or `closed` :param limit: Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit @@ -761,8 +761,8 @@ async def stream_async( is reached. The results are returned as a generator, so this operation is memory efficient. - :param str start_date: Start date or time in ISO8601 format for filtering list of Conversations. If a date is provided, the start time of the date is used (YYYY-MM-DDT00:00:00Z). Can be combined with other filters. - :param str end_date: End date or time in ISO8601 format for filtering list of Conversations. If a date is provided, the end time of the date is used (YYYY-MM-DDT23:59:59Z). Can be combined with other filters. + :param str start_date: Specifies the beginning of the date range for filtering Conversations based on their creation date. Conversations that were created on or after this date will be included in the results. The date must be in ISO8601 format, specifically starting at the beginning of the specified date (YYYY-MM-DDT00:00:00Z), for precise filtering. This parameter can be combined with other filters. If this filter is used, the returned list is sorted by latest conversation creation date in descending order. + :param str end_date: Defines the end of the date range for filtering conversations by their creation date. Only conversations that were created on or before this date will appear in the results. The date must be in ISO8601 format, specifically capturing up to the end of the specified date (YYYY-MM-DDT23:59:59Z), to ensure that conversations from the entire end day are included. This parameter can be combined with other filters. If this filter is used, the returned list is sorted by latest conversation creation date in descending order. :param "ConversationInstance.State" state: State for sorting and filtering list of Conversations. Can be `active`, `inactive` or `closed` :param limit: Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit @@ -796,8 +796,8 @@ def list( Unlike stream(), this operation is eager and will load `limit` records into memory before returning. - :param str start_date: Start date or time in ISO8601 format for filtering list of Conversations. If a date is provided, the start time of the date is used (YYYY-MM-DDT00:00:00Z). Can be combined with other filters. - :param str end_date: End date or time in ISO8601 format for filtering list of Conversations. If a date is provided, the end time of the date is used (YYYY-MM-DDT23:59:59Z). Can be combined with other filters. + :param str start_date: Specifies the beginning of the date range for filtering Conversations based on their creation date. Conversations that were created on or after this date will be included in the results. The date must be in ISO8601 format, specifically starting at the beginning of the specified date (YYYY-MM-DDT00:00:00Z), for precise filtering. This parameter can be combined with other filters. If this filter is used, the returned list is sorted by latest conversation creation date in descending order. + :param str end_date: Defines the end of the date range for filtering conversations by their creation date. Only conversations that were created on or before this date will appear in the results. The date must be in ISO8601 format, specifically capturing up to the end of the specified date (YYYY-MM-DDT23:59:59Z), to ensure that conversations from the entire end day are included. This parameter can be combined with other filters. If this filter is used, the returned list is sorted by latest conversation creation date in descending order. :param "ConversationInstance.State" state: State for sorting and filtering list of Conversations. Can be `active`, `inactive` or `closed` :param limit: Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit @@ -831,8 +831,8 @@ async def list_async( Unlike stream(), this operation is eager and will load `limit` records into memory before returning. - :param str start_date: Start date or time in ISO8601 format for filtering list of Conversations. If a date is provided, the start time of the date is used (YYYY-MM-DDT00:00:00Z). Can be combined with other filters. - :param str end_date: End date or time in ISO8601 format for filtering list of Conversations. If a date is provided, the end time of the date is used (YYYY-MM-DDT23:59:59Z). Can be combined with other filters. + :param str start_date: Specifies the beginning of the date range for filtering Conversations based on their creation date. Conversations that were created on or after this date will be included in the results. The date must be in ISO8601 format, specifically starting at the beginning of the specified date (YYYY-MM-DDT00:00:00Z), for precise filtering. This parameter can be combined with other filters. If this filter is used, the returned list is sorted by latest conversation creation date in descending order. + :param str end_date: Defines the end of the date range for filtering conversations by their creation date. Only conversations that were created on or before this date will appear in the results. The date must be in ISO8601 format, specifically capturing up to the end of the specified date (YYYY-MM-DDT23:59:59Z), to ensure that conversations from the entire end day are included. This parameter can be combined with other filters. If this filter is used, the returned list is sorted by latest conversation creation date in descending order. :param "ConversationInstance.State" state: State for sorting and filtering list of Conversations. Can be `active`, `inactive` or `closed` :param limit: Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit @@ -867,8 +867,8 @@ def page( Retrieve a single page of ConversationInstance records from the API. Request is executed immediately - :param start_date: Start date or time in ISO8601 format for filtering list of Conversations. If a date is provided, the start time of the date is used (YYYY-MM-DDT00:00:00Z). Can be combined with other filters. - :param end_date: End date or time in ISO8601 format for filtering list of Conversations. If a date is provided, the end time of the date is used (YYYY-MM-DDT23:59:59Z). Can be combined with other filters. + :param start_date: Specifies the beginning of the date range for filtering Conversations based on their creation date. Conversations that were created on or after this date will be included in the results. The date must be in ISO8601 format, specifically starting at the beginning of the specified date (YYYY-MM-DDT00:00:00Z), for precise filtering. This parameter can be combined with other filters. If this filter is used, the returned list is sorted by latest conversation creation date in descending order. + :param end_date: Defines the end of the date range for filtering conversations by their creation date. Only conversations that were created on or before this date will appear in the results. The date must be in ISO8601 format, specifically capturing up to the end of the specified date (YYYY-MM-DDT23:59:59Z), to ensure that conversations from the entire end day are included. This parameter can be combined with other filters. If this filter is used, the returned list is sorted by latest conversation creation date in descending order. :param state: State for sorting and filtering list of Conversations. Can be `active`, `inactive` or `closed` :param page_token: PageToken provided by the API :param page_number: Page Number, this value is simply for client state @@ -903,8 +903,8 @@ async def page_async( Asynchronously retrieve a single page of ConversationInstance records from the API. Request is executed immediately - :param start_date: Start date or time in ISO8601 format for filtering list of Conversations. If a date is provided, the start time of the date is used (YYYY-MM-DDT00:00:00Z). Can be combined with other filters. - :param end_date: End date or time in ISO8601 format for filtering list of Conversations. If a date is provided, the end time of the date is used (YYYY-MM-DDT23:59:59Z). Can be combined with other filters. + :param start_date: Specifies the beginning of the date range for filtering Conversations based on their creation date. Conversations that were created on or after this date will be included in the results. The date must be in ISO8601 format, specifically starting at the beginning of the specified date (YYYY-MM-DDT00:00:00Z), for precise filtering. This parameter can be combined with other filters. If this filter is used, the returned list is sorted by latest conversation creation date in descending order. + :param end_date: Defines the end of the date range for filtering conversations by their creation date. Only conversations that were created on or before this date will appear in the results. The date must be in ISO8601 format, specifically capturing up to the end of the specified date (YYYY-MM-DDT23:59:59Z), to ensure that conversations from the entire end day are included. This parameter can be combined with other filters. If this filter is used, the returned list is sorted by latest conversation creation date in descending order. :param state: State for sorting and filtering list of Conversations. Can be `active`, `inactive` or `closed` :param page_token: PageToken provided by the API :param page_number: Page Number, this value is simply for client state diff --git a/twilio/rest/flex_api/v1/plugin/__init__.py b/twilio/rest/flex_api/v1/plugin/__init__.py index 90697d1845..09244d42de 100644 --- a/twilio/rest/flex_api/v1/plugin/__init__.py +++ b/twilio/rest/flex_api/v1/plugin/__init__.py @@ -359,8 +359,6 @@ def create( flex_metadata: Union[str, object] = values.unset, friendly_name: Union[str, object] = values.unset, description: Union[str, object] = values.unset, - cli_version: Union[str, object] = values.unset, - validate_status: Union[str, object] = values.unset, ) -> PluginInstance: """ Create the PluginInstance @@ -369,8 +367,6 @@ def create( :param flex_metadata: The Flex-Metadata HTTP request header :param friendly_name: The Flex Plugin's friendly name. :param description: A descriptive string that you create to describe the plugin resource. It can be up to 500 characters long - :param cli_version: The version of Flex Plugins CLI used to create this plugin - :param validate_status: The validation status of the plugin, indicating whether it has been validated :returns: The created PluginInstance """ @@ -380,8 +376,6 @@ def create( "UniqueName": unique_name, "FriendlyName": friendly_name, "Description": description, - "CliVersion": cli_version, - "ValidateStatus": validate_status, } ) headers = values.of( @@ -402,8 +396,6 @@ async def create_async( flex_metadata: Union[str, object] = values.unset, friendly_name: Union[str, object] = values.unset, description: Union[str, object] = values.unset, - cli_version: Union[str, object] = values.unset, - validate_status: Union[str, object] = values.unset, ) -> PluginInstance: """ Asynchronously create the PluginInstance @@ -412,8 +404,6 @@ async def create_async( :param flex_metadata: The Flex-Metadata HTTP request header :param friendly_name: The Flex Plugin's friendly name. :param description: A descriptive string that you create to describe the plugin resource. It can be up to 500 characters long - :param cli_version: The version of Flex Plugins CLI used to create this plugin - :param validate_status: The validation status of the plugin, indicating whether it has been validated :returns: The created PluginInstance """ @@ -423,8 +413,6 @@ async def create_async( "UniqueName": unique_name, "FriendlyName": friendly_name, "Description": description, - "CliVersion": cli_version, - "ValidateStatus": validate_status, } ) headers = values.of( diff --git a/twilio/rest/flex_api/v1/plugin/plugin_versions.py b/twilio/rest/flex_api/v1/plugin/plugin_versions.py index 6f492dbad6..96313c84dd 100644 --- a/twilio/rest/flex_api/v1/plugin/plugin_versions.py +++ b/twilio/rest/flex_api/v1/plugin/plugin_versions.py @@ -251,6 +251,8 @@ def create( flex_metadata: Union[str, object] = values.unset, changelog: Union[str, object] = values.unset, private: Union[bool, object] = values.unset, + cli_version: Union[str, object] = values.unset, + validate_status: Union[str, object] = values.unset, ) -> PluginVersionsInstance: """ Create the PluginVersionsInstance @@ -260,6 +262,8 @@ def create( :param flex_metadata: The Flex-Metadata HTTP request header :param changelog: The changelog of the Flex Plugin Version. :param private: Whether this Flex Plugin Version requires authorization. + :param cli_version: The version of Flex Plugins CLI used to create this plugin + :param validate_status: The validation status of the plugin, indicating whether it has been validated :returns: The created PluginVersionsInstance """ @@ -270,6 +274,8 @@ def create( "PluginUrl": plugin_url, "Changelog": changelog, "Private": serialize.boolean_to_string(private), + "CliVersion": cli_version, + "ValidateStatus": validate_status, } ) headers = values.of( @@ -293,6 +299,8 @@ async def create_async( flex_metadata: Union[str, object] = values.unset, changelog: Union[str, object] = values.unset, private: Union[bool, object] = values.unset, + cli_version: Union[str, object] = values.unset, + validate_status: Union[str, object] = values.unset, ) -> PluginVersionsInstance: """ Asynchronously create the PluginVersionsInstance @@ -302,6 +310,8 @@ async def create_async( :param flex_metadata: The Flex-Metadata HTTP request header :param changelog: The changelog of the Flex Plugin Version. :param private: Whether this Flex Plugin Version requires authorization. + :param cli_version: The version of Flex Plugins CLI used to create this plugin + :param validate_status: The validation status of the plugin, indicating whether it has been validated :returns: The created PluginVersionsInstance """ @@ -312,6 +322,8 @@ async def create_async( "PluginUrl": plugin_url, "Changelog": changelog, "Private": serialize.boolean_to_string(private), + "CliVersion": cli_version, + "ValidateStatus": validate_status, } ) headers = values.of( diff --git a/twilio/rest/lookups/v2/phone_number.py b/twilio/rest/lookups/v2/phone_number.py index 57491aa0a9..d9c73c22d8 100644 --- a/twilio/rest/lookups/v2/phone_number.py +++ b/twilio/rest/lookups/v2/phone_number.py @@ -46,6 +46,7 @@ class ValidationError(object): :ivar reassigned_number: An object that contains reassigned number information. Reassigned Numbers will return a phone number's reassignment status given a phone number and date :ivar sms_pumping_risk: An object that contains information on if a phone number has been currently or previously blocked by Verify Fraud Guard for receiving malicious SMS pumping traffic as well as other signals associated with risky carriers and low conversion rates. :ivar phone_number_quality_score: An object that contains information of a mobile phone number quality score. Quality score will return a risk score about the phone number. + :ivar pre_fill: An object that contains pre fill information. pre_fill will return PII information associated with the phone number like first name, last name, address line, country code, state and postal code. :ivar url: The absolute URL of the resource. """ @@ -84,6 +85,7 @@ def __init__( self.phone_number_quality_score: Optional[Dict[str, object]] = payload.get( "phone_number_quality_score" ) + self.pre_fill: Optional[Dict[str, object]] = payload.get("pre_fill") self.url: Optional[str] = payload.get("url") self._solution = { @@ -121,11 +123,12 @@ def fetch( national_id: Union[str, object] = values.unset, date_of_birth: Union[str, object] = values.unset, last_verified_date: Union[str, object] = values.unset, + verification_sid: Union[str, object] = values.unset, ) -> "PhoneNumberInstance": """ Fetch the PhoneNumberInstance - :param fields: A comma-separated list of fields to return. Possible values are validation, caller_name, sim_swap, call_forwarding, line_status, line_type_intelligence, identity_match, reassigned_number, sms_pumping_risk, phone_number_quality_score. + :param fields: A comma-separated list of fields to return. Possible values are validation, caller_name, sim_swap, call_forwarding, line_status, line_type_intelligence, identity_match, reassigned_number, sms_pumping_risk, phone_number_quality_score, pre_fill. :param country_code: The [country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) used if the phone number provided is in national format. :param first_name: User’s first name. This query parameter is only used (optionally) for identity_match package requests. :param last_name: User’s last name. This query parameter is only used (optionally) for identity_match package requests. @@ -138,6 +141,7 @@ def fetch( :param national_id: User’s national ID, such as SSN or Passport ID. This query parameter is only used (optionally) for identity_match package requests. :param date_of_birth: User’s date of birth, in YYYYMMDD format. This query parameter is only used (optionally) for identity_match package requests. :param last_verified_date: The date you obtained consent to call or text the end-user of the phone number or a date on which you are reasonably certain that the end-user could still be reached at that number. This query parameter is only used (optionally) for reassigned_number package requests. + :param verification_sid: The unique identifier associated with a verification process through verify API. This query parameter is only used (optionally) for pre_fill package requests. :returns: The fetched PhoneNumberInstance """ @@ -155,6 +159,7 @@ def fetch( national_id=national_id, date_of_birth=date_of_birth, last_verified_date=last_verified_date, + verification_sid=verification_sid, ) async def fetch_async( @@ -172,11 +177,12 @@ async def fetch_async( national_id: Union[str, object] = values.unset, date_of_birth: Union[str, object] = values.unset, last_verified_date: Union[str, object] = values.unset, + verification_sid: Union[str, object] = values.unset, ) -> "PhoneNumberInstance": """ Asynchronous coroutine to fetch the PhoneNumberInstance - :param fields: A comma-separated list of fields to return. Possible values are validation, caller_name, sim_swap, call_forwarding, line_status, line_type_intelligence, identity_match, reassigned_number, sms_pumping_risk, phone_number_quality_score. + :param fields: A comma-separated list of fields to return. Possible values are validation, caller_name, sim_swap, call_forwarding, line_status, line_type_intelligence, identity_match, reassigned_number, sms_pumping_risk, phone_number_quality_score, pre_fill. :param country_code: The [country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) used if the phone number provided is in national format. :param first_name: User’s first name. This query parameter is only used (optionally) for identity_match package requests. :param last_name: User’s last name. This query parameter is only used (optionally) for identity_match package requests. @@ -189,6 +195,7 @@ async def fetch_async( :param national_id: User’s national ID, such as SSN or Passport ID. This query parameter is only used (optionally) for identity_match package requests. :param date_of_birth: User’s date of birth, in YYYYMMDD format. This query parameter is only used (optionally) for identity_match package requests. :param last_verified_date: The date you obtained consent to call or text the end-user of the phone number or a date on which you are reasonably certain that the end-user could still be reached at that number. This query parameter is only used (optionally) for reassigned_number package requests. + :param verification_sid: The unique identifier associated with a verification process through verify API. This query parameter is only used (optionally) for pre_fill package requests. :returns: The fetched PhoneNumberInstance """ @@ -206,6 +213,7 @@ async def fetch_async( national_id=national_id, date_of_birth=date_of_birth, last_verified_date=last_verified_date, + verification_sid=verification_sid, ) def __repr__(self) -> str: @@ -250,11 +258,12 @@ def fetch( national_id: Union[str, object] = values.unset, date_of_birth: Union[str, object] = values.unset, last_verified_date: Union[str, object] = values.unset, + verification_sid: Union[str, object] = values.unset, ) -> PhoneNumberInstance: """ Fetch the PhoneNumberInstance - :param fields: A comma-separated list of fields to return. Possible values are validation, caller_name, sim_swap, call_forwarding, line_status, line_type_intelligence, identity_match, reassigned_number, sms_pumping_risk, phone_number_quality_score. + :param fields: A comma-separated list of fields to return. Possible values are validation, caller_name, sim_swap, call_forwarding, line_status, line_type_intelligence, identity_match, reassigned_number, sms_pumping_risk, phone_number_quality_score, pre_fill. :param country_code: The [country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) used if the phone number provided is in national format. :param first_name: User’s first name. This query parameter is only used (optionally) for identity_match package requests. :param last_name: User’s last name. This query parameter is only used (optionally) for identity_match package requests. @@ -267,6 +276,7 @@ def fetch( :param national_id: User’s national ID, such as SSN or Passport ID. This query parameter is only used (optionally) for identity_match package requests. :param date_of_birth: User’s date of birth, in YYYYMMDD format. This query parameter is only used (optionally) for identity_match package requests. :param last_verified_date: The date you obtained consent to call or text the end-user of the phone number or a date on which you are reasonably certain that the end-user could still be reached at that number. This query parameter is only used (optionally) for reassigned_number package requests. + :param verification_sid: The unique identifier associated with a verification process through verify API. This query parameter is only used (optionally) for pre_fill package requests. :returns: The fetched PhoneNumberInstance """ @@ -286,6 +296,7 @@ def fetch( "NationalId": national_id, "DateOfBirth": date_of_birth, "LastVerifiedDate": last_verified_date, + "VerificationSid": verification_sid, } ) @@ -312,11 +323,12 @@ async def fetch_async( national_id: Union[str, object] = values.unset, date_of_birth: Union[str, object] = values.unset, last_verified_date: Union[str, object] = values.unset, + verification_sid: Union[str, object] = values.unset, ) -> PhoneNumberInstance: """ Asynchronous coroutine to fetch the PhoneNumberInstance - :param fields: A comma-separated list of fields to return. Possible values are validation, caller_name, sim_swap, call_forwarding, line_status, line_type_intelligence, identity_match, reassigned_number, sms_pumping_risk, phone_number_quality_score. + :param fields: A comma-separated list of fields to return. Possible values are validation, caller_name, sim_swap, call_forwarding, line_status, line_type_intelligence, identity_match, reassigned_number, sms_pumping_risk, phone_number_quality_score, pre_fill. :param country_code: The [country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) used if the phone number provided is in national format. :param first_name: User’s first name. This query parameter is only used (optionally) for identity_match package requests. :param last_name: User’s last name. This query parameter is only used (optionally) for identity_match package requests. @@ -329,6 +341,7 @@ async def fetch_async( :param national_id: User’s national ID, such as SSN or Passport ID. This query parameter is only used (optionally) for identity_match package requests. :param date_of_birth: User’s date of birth, in YYYYMMDD format. This query parameter is only used (optionally) for identity_match package requests. :param last_verified_date: The date you obtained consent to call or text the end-user of the phone number or a date on which you are reasonably certain that the end-user could still be reached at that number. This query parameter is only used (optionally) for reassigned_number package requests. + :param verification_sid: The unique identifier associated with a verification process through verify API. This query parameter is only used (optionally) for pre_fill package requests. :returns: The fetched PhoneNumberInstance """ @@ -348,6 +361,7 @@ async def fetch_async( "NationalId": national_id, "DateOfBirth": date_of_birth, "LastVerifiedDate": last_verified_date, + "VerificationSid": verification_sid, } ) diff --git a/twilio/rest/messaging/v1/service/__init__.py b/twilio/rest/messaging/v1/service/__init__.py index 75c798f4c4..f7351843b6 100644 --- a/twilio/rest/messaging/v1/service/__init__.py +++ b/twilio/rest/messaging/v1/service/__init__.py @@ -61,6 +61,7 @@ class ScanMessageContent(object): :ivar usecase: A string that describes the scenario in which the Messaging Service will be used. Possible values are `notifications`, `marketing`, `verification`, `discussion`, `poll`, `undeclared`. :ivar us_app_to_person_registered: Whether US A2P campaign is registered for this Service. :ivar use_inbound_webhook_on_number: A boolean value that indicates either the webhook url configured on the phone number will be used or `inbound_request_url`/`fallback_url` url will be called when a message is received from the phone number. If this field is enabled then the webhook url defined on the phone number will override the `inbound_request_url`/`fallback_url` defined for the Messaging Service. + :ivar sending_windows: A list of Sending Windows, which indicate defined time ranges in which a message can be sent, in the UTC time zone. Each window is defined by two strings, labeled \"start_time\" and \"end_time\". """ def __init__( @@ -107,6 +108,9 @@ def __init__( self.use_inbound_webhook_on_number: Optional[bool] = payload.get( "use_inbound_webhook_on_number" ) + self.sending_windows: Optional[Dict[str, object]] = payload.get( + "sending_windows" + ) self._solution = { "sid": sid or self.sid, diff --git a/twilio/rest/verify/v2/service/__init__.py b/twilio/rest/verify/v2/service/__init__.py index 9e4d69d52b..7ea0b0ab56 100644 --- a/twilio/rest/verify/v2/service/__init__.py +++ b/twilio/rest/verify/v2/service/__init__.py @@ -47,6 +47,7 @@ class ServiceInstance(InstanceResource): :ivar push: Configurations for the Push factors (channel) created under this Service. :ivar totp: Configurations for the TOTP factors (channel) created under this Service. :ivar default_template_sid: + :ivar whatsapp: :ivar verify_event_subscription_enabled: Whether to allow verifications from the service to reach the stream-events sinks if configured :ivar date_created: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. :ivar date_updated: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. @@ -79,6 +80,7 @@ def __init__( self.push: Optional[Dict[str, object]] = payload.get("push") self.totp: Optional[Dict[str, object]] = payload.get("totp") self.default_template_sid: Optional[str] = payload.get("default_template_sid") + self.whatsapp: Optional[Dict[str, object]] = payload.get("whatsapp") self.verify_event_subscription_enabled: Optional[bool] = payload.get( "verify_event_subscription_enabled" ) @@ -166,6 +168,8 @@ def update( totp_code_length: Union[int, object] = values.unset, totp_skew: Union[int, object] = values.unset, default_template_sid: Union[str, object] = values.unset, + whatsapp_msg_service_sid: Union[str, object] = values.unset, + whatsapp_from: Union[str, object] = values.unset, verify_event_subscription_enabled: Union[bool, object] = values.unset, ) -> "ServiceInstance": """ @@ -188,6 +192,8 @@ def update( :param totp_code_length: Optional configuration for the TOTP factors. Number of digits for generated TOTP codes. Must be between 3 and 8, inclusive. Defaults to 6 :param totp_skew: Optional configuration for the TOTP factors. The number of time-steps, past and future, that are valid for validation of TOTP codes. Must be between 0 and 2, inclusive. Defaults to 1 :param default_template_sid: The default message [template](https://www.twilio.com/docs/verify/api/templates). Will be used for all SMS verifications unless explicitly overriden. SMS channel only. + :param whatsapp_msg_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/services) to associate with the Verification Service. + :param whatsapp_from: The WhatsApp number to use as the sender of the verification messages. This number must be associated with the WhatsApp Message Service. :param verify_event_subscription_enabled: Whether to allow verifications from the service to reach the stream-events sinks if configured :returns: The updated ServiceInstance @@ -210,6 +216,8 @@ def update( totp_code_length=totp_code_length, totp_skew=totp_skew, default_template_sid=default_template_sid, + whatsapp_msg_service_sid=whatsapp_msg_service_sid, + whatsapp_from=whatsapp_from, verify_event_subscription_enabled=verify_event_subscription_enabled, ) @@ -232,6 +240,8 @@ async def update_async( totp_code_length: Union[int, object] = values.unset, totp_skew: Union[int, object] = values.unset, default_template_sid: Union[str, object] = values.unset, + whatsapp_msg_service_sid: Union[str, object] = values.unset, + whatsapp_from: Union[str, object] = values.unset, verify_event_subscription_enabled: Union[bool, object] = values.unset, ) -> "ServiceInstance": """ @@ -254,6 +264,8 @@ async def update_async( :param totp_code_length: Optional configuration for the TOTP factors. Number of digits for generated TOTP codes. Must be between 3 and 8, inclusive. Defaults to 6 :param totp_skew: Optional configuration for the TOTP factors. The number of time-steps, past and future, that are valid for validation of TOTP codes. Must be between 0 and 2, inclusive. Defaults to 1 :param default_template_sid: The default message [template](https://www.twilio.com/docs/verify/api/templates). Will be used for all SMS verifications unless explicitly overriden. SMS channel only. + :param whatsapp_msg_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/services) to associate with the Verification Service. + :param whatsapp_from: The WhatsApp number to use as the sender of the verification messages. This number must be associated with the WhatsApp Message Service. :param verify_event_subscription_enabled: Whether to allow verifications from the service to reach the stream-events sinks if configured :returns: The updated ServiceInstance @@ -276,6 +288,8 @@ async def update_async( totp_code_length=totp_code_length, totp_skew=totp_skew, default_template_sid=default_template_sid, + whatsapp_msg_service_sid=whatsapp_msg_service_sid, + whatsapp_from=whatsapp_from, verify_event_subscription_enabled=verify_event_subscription_enabled, ) @@ -444,6 +458,8 @@ def update( totp_code_length: Union[int, object] = values.unset, totp_skew: Union[int, object] = values.unset, default_template_sid: Union[str, object] = values.unset, + whatsapp_msg_service_sid: Union[str, object] = values.unset, + whatsapp_from: Union[str, object] = values.unset, verify_event_subscription_enabled: Union[bool, object] = values.unset, ) -> ServiceInstance: """ @@ -466,6 +482,8 @@ def update( :param totp_code_length: Optional configuration for the TOTP factors. Number of digits for generated TOTP codes. Must be between 3 and 8, inclusive. Defaults to 6 :param totp_skew: Optional configuration for the TOTP factors. The number of time-steps, past and future, that are valid for validation of TOTP codes. Must be between 0 and 2, inclusive. Defaults to 1 :param default_template_sid: The default message [template](https://www.twilio.com/docs/verify/api/templates). Will be used for all SMS verifications unless explicitly overriden. SMS channel only. + :param whatsapp_msg_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/services) to associate with the Verification Service. + :param whatsapp_from: The WhatsApp number to use as the sender of the verification messages. This number must be associated with the WhatsApp Message Service. :param verify_event_subscription_enabled: Whether to allow verifications from the service to reach the stream-events sinks if configured :returns: The updated ServiceInstance @@ -493,6 +511,8 @@ def update( "Totp.CodeLength": totp_code_length, "Totp.Skew": totp_skew, "DefaultTemplateSid": default_template_sid, + "Whatsapp.MsgServiceSid": whatsapp_msg_service_sid, + "Whatsapp.From": whatsapp_from, "VerifyEventSubscriptionEnabled": serialize.boolean_to_string( verify_event_subscription_enabled ), @@ -526,6 +546,8 @@ async def update_async( totp_code_length: Union[int, object] = values.unset, totp_skew: Union[int, object] = values.unset, default_template_sid: Union[str, object] = values.unset, + whatsapp_msg_service_sid: Union[str, object] = values.unset, + whatsapp_from: Union[str, object] = values.unset, verify_event_subscription_enabled: Union[bool, object] = values.unset, ) -> ServiceInstance: """ @@ -548,6 +570,8 @@ async def update_async( :param totp_code_length: Optional configuration for the TOTP factors. Number of digits for generated TOTP codes. Must be between 3 and 8, inclusive. Defaults to 6 :param totp_skew: Optional configuration for the TOTP factors. The number of time-steps, past and future, that are valid for validation of TOTP codes. Must be between 0 and 2, inclusive. Defaults to 1 :param default_template_sid: The default message [template](https://www.twilio.com/docs/verify/api/templates). Will be used for all SMS verifications unless explicitly overriden. SMS channel only. + :param whatsapp_msg_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/services) to associate with the Verification Service. + :param whatsapp_from: The WhatsApp number to use as the sender of the verification messages. This number must be associated with the WhatsApp Message Service. :param verify_event_subscription_enabled: Whether to allow verifications from the service to reach the stream-events sinks if configured :returns: The updated ServiceInstance @@ -575,6 +599,8 @@ async def update_async( "Totp.CodeLength": totp_code_length, "Totp.Skew": totp_skew, "DefaultTemplateSid": default_template_sid, + "Whatsapp.MsgServiceSid": whatsapp_msg_service_sid, + "Whatsapp.From": whatsapp_from, "VerifyEventSubscriptionEnabled": serialize.boolean_to_string( verify_event_subscription_enabled ), @@ -734,6 +760,8 @@ def create( totp_code_length: Union[int, object] = values.unset, totp_skew: Union[int, object] = values.unset, default_template_sid: Union[str, object] = values.unset, + whatsapp_msg_service_sid: Union[str, object] = values.unset, + whatsapp_from: Union[str, object] = values.unset, verify_event_subscription_enabled: Union[bool, object] = values.unset, ) -> ServiceInstance: """ @@ -756,6 +784,8 @@ def create( :param totp_code_length: Optional configuration for the TOTP factors. Number of digits for generated TOTP codes. Must be between 3 and 8, inclusive. Defaults to 6 :param totp_skew: Optional configuration for the TOTP factors. The number of time-steps, past and future, that are valid for validation of TOTP codes. Must be between 0 and 2, inclusive. Defaults to 1 :param default_template_sid: The default message [template](https://www.twilio.com/docs/verify/api/templates). Will be used for all SMS verifications unless explicitly overriden. SMS channel only. + :param whatsapp_msg_service_sid: The SID of the Messaging Service containing WhatsApp Sender(s) that Verify will use to send WhatsApp messages to your users. + :param whatsapp_from: The number to use as the WhatsApp Sender that Verify will use to send WhatsApp messages to your users.This WhatsApp Sender must be associated with a Messaging Service SID. :param verify_event_subscription_enabled: Whether to allow verifications from the service to reach the stream-events sinks if configured :returns: The created ServiceInstance @@ -784,6 +814,8 @@ def create( "Totp.CodeLength": totp_code_length, "Totp.Skew": totp_skew, "DefaultTemplateSid": default_template_sid, + "Whatsapp.MsgServiceSid": whatsapp_msg_service_sid, + "Whatsapp.From": whatsapp_from, "VerifyEventSubscriptionEnabled": serialize.boolean_to_string( verify_event_subscription_enabled ), @@ -817,6 +849,8 @@ async def create_async( totp_code_length: Union[int, object] = values.unset, totp_skew: Union[int, object] = values.unset, default_template_sid: Union[str, object] = values.unset, + whatsapp_msg_service_sid: Union[str, object] = values.unset, + whatsapp_from: Union[str, object] = values.unset, verify_event_subscription_enabled: Union[bool, object] = values.unset, ) -> ServiceInstance: """ @@ -839,6 +873,8 @@ async def create_async( :param totp_code_length: Optional configuration for the TOTP factors. Number of digits for generated TOTP codes. Must be between 3 and 8, inclusive. Defaults to 6 :param totp_skew: Optional configuration for the TOTP factors. The number of time-steps, past and future, that are valid for validation of TOTP codes. Must be between 0 and 2, inclusive. Defaults to 1 :param default_template_sid: The default message [template](https://www.twilio.com/docs/verify/api/templates). Will be used for all SMS verifications unless explicitly overriden. SMS channel only. + :param whatsapp_msg_service_sid: The SID of the Messaging Service containing WhatsApp Sender(s) that Verify will use to send WhatsApp messages to your users. + :param whatsapp_from: The number to use as the WhatsApp Sender that Verify will use to send WhatsApp messages to your users.This WhatsApp Sender must be associated with a Messaging Service SID. :param verify_event_subscription_enabled: Whether to allow verifications from the service to reach the stream-events sinks if configured :returns: The created ServiceInstance @@ -867,6 +903,8 @@ async def create_async( "Totp.CodeLength": totp_code_length, "Totp.Skew": totp_skew, "DefaultTemplateSid": default_template_sid, + "Whatsapp.MsgServiceSid": whatsapp_msg_service_sid, + "Whatsapp.From": whatsapp_from, "VerifyEventSubscriptionEnabled": serialize.boolean_to_string( verify_event_subscription_enabled ), From d244c079933934e8322086b546ba0e8b25cca85e Mon Sep 17 00:00:00 2001 From: Twilio Date: Thu, 4 Apr 2024 14:56:38 +0000 Subject: [PATCH 04/87] Release 9.0.4 --- setup.py | 2 +- twilio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 1a14afcb7a..91945bfd86 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name="twilio", - version="9.0.3", + version="9.0.4", description="Twilio API client and TwiML generator", author="Twilio", help_center="https://www.twilio.com/help/contact", diff --git a/twilio/__init__.py b/twilio/__init__.py index 6a60af8330..5ed1a81015 100644 --- a/twilio/__init__.py +++ b/twilio/__init__.py @@ -1,2 +1,2 @@ -__version_info__ = ("9", "0", "3") +__version_info__ = ("9", "0", "4") __version__ = ".".join(__version_info__) From 60e09a5d18e446aad2a73b416604ddeaa1f8e350 Mon Sep 17 00:00:00 2001 From: twilio-product-security <67294289+twilio-product-security@users.noreply.github.com> Date: Fri, 5 Apr 2024 07:09:40 -0400 Subject: [PATCH 05/87] fix: requirements.txt to reduce vulnerabilities (#742) The following vulnerabilities are fixed by pinning transitive dependencies: - https://snyk.io/vuln/SNYK-PYTHON-CERTIFI-3164749 - https://snyk.io/vuln/SNYK-PYTHON-CERTIFI-5805047 - https://snyk.io/vuln/SNYK-PYTHON-REQUESTS-5595532 Co-authored-by: snyk-bot Co-authored-by: Shubham --- requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index f2b815e854..c633981931 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,6 @@ pygments>=2.7.4 # not directly required, pinned by Snyk to avoid a vulnerability -requests>=2.0.0 +requests>=2.31.0 PyJWT>=2.0.0, <3.0.0 aiohttp>=3.9.0 aiohttp-retry>=2.8.3 +certifi>=2023.7.22 # not directly required, pinned by Snyk to avoid a vulnerability From 27e3f6f4f386111b9bba98679920b27e6be52c2a Mon Sep 17 00:00:00 2001 From: Twilio Date: Thu, 18 Apr 2024 11:10:12 +0000 Subject: [PATCH 06/87] [Librarian] Regenerated @ bd01257c5bef8696988f5e9f18d803d8ccdb5a0f 0d301f7b8858e2f9dc391bd6803943499955b8f0 --- CHANGES.md | 15 + twilio/rest/api/v2010/account/call/stream.py | 24 +- twilio/rest/content/v1/content/__init__.py | 522 +++++++++++++++++- twilio/rest/flex_api/v2/__init__.py | 8 + twilio/rest/flex_api/v2/flex_user.py | 234 ++++++++ twilio/rest/flex_api/v2/web_channels.py | 22 +- twilio/rest/numbers/v1/__init__.py | 12 + twilio/rest/numbers/v1/porting_port_in.py | 120 +++- .../v1/porting_port_in_phone_number.py | 125 +++++ 9 files changed, 1060 insertions(+), 22 deletions(-) create mode 100644 twilio/rest/flex_api/v2/flex_user.py create mode 100644 twilio/rest/numbers/v1/porting_port_in_phone_number.py diff --git a/CHANGES.md b/CHANGES.md index f35fbb4c48..6af9e1d3f7 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,21 @@ twilio-python Changelog Here you can see the full list of changes between each twilio-python release. +[2024-04-18] Version 9.0.5 +-------------------------- +**Library - Chore** +- [PR #742](https://github.com/twilio/twilio-python/pull/742): [Snyk] Fix for 3 vulnerabilities. Thanks to [@twilio-product-security](https://github.com/twilio-product-security)! + +**Flex** +- Add header `ui_version` to `web_channels` API + +**Messaging** +- Redeploy after failed pipeline + +**Numbers** +- Add Delete Port In request phone number api and Add Delete Port In request api + + [2024-04-04] Version 9.0.4 -------------------------- **Api** diff --git a/twilio/rest/api/v2010/account/call/stream.py b/twilio/rest/api/v2010/account/call/stream.py index a46d8f9757..3975f52d49 100644 --- a/twilio/rest/api/v2010/account/call/stream.py +++ b/twilio/rest/api/v2010/account/call/stream.py @@ -39,7 +39,7 @@ class UpdateStatus(object): :ivar sid: The SID of the Stream resource. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Stream resource. :ivar call_sid: The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Stream resource is associated with. - :ivar name: The user-specified name of this Stream, if one was given when the Stream was created. This may be used to stop the Stream. + :ivar name: The user-specified name of this Stream, if one was given when the Stream was created. This can be used to stop the Stream. :ivar status: :ivar date_updated: The date and time in GMT that this resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. :ivar uri: The URI of the resource, relative to `https://api.twilio.com`. @@ -134,7 +134,7 @@ def __init__(self, version: Version, account_sid: str, call_sid: str, sid: str): :param version: Version that contains the resource :param account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Stream resource. :param call_sid: The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Stream resource is associated with. - :param sid: The SID of the Stream resource, or the `name` used when creating the resource + :param sid: The SID or the `name` of the Stream resource to be stopped """ super().__init__(version) @@ -449,11 +449,11 @@ def create( """ Create the StreamInstance - :param url: Relative or absolute url where WebSocket connection will be established. - :param name: The user-specified name of this Stream, if one was given when the Stream was created. This may be used to stop the Stream. + :param url: Relative or absolute URL where WebSocket connection will be established. + :param name: The user-specified name of this Stream, if one was given when the Stream was created. This can be used to stop the Stream. :param track: - :param status_callback: Absolute URL of the status callback. - :param status_callback_method: The http method for the status_callback (one of GET, POST). + :param status_callback: Absolute URL to which Twilio sends status callback HTTP requests. + :param status_callback_method: The HTTP method Twilio uses when sending `status_callback` requests. Possible values are `GET` and `POST`. Default is `POST`. :param parameter1_name: Parameter name :param parameter1_value: Parameter value :param parameter2_name: Parameter name @@ -1086,11 +1086,11 @@ async def create_async( """ Asynchronously create the StreamInstance - :param url: Relative or absolute url where WebSocket connection will be established. - :param name: The user-specified name of this Stream, if one was given when the Stream was created. This may be used to stop the Stream. + :param url: Relative or absolute URL where WebSocket connection will be established. + :param name: The user-specified name of this Stream, if one was given when the Stream was created. This can be used to stop the Stream. :param track: - :param status_callback: Absolute URL of the status callback. - :param status_callback_method: The http method for the status_callback (one of GET, POST). + :param status_callback: Absolute URL to which Twilio sends status callback HTTP requests. + :param status_callback_method: The HTTP method Twilio uses when sending `status_callback` requests. Possible values are `GET` and `POST`. Default is `POST`. :param parameter1_name: Parameter name :param parameter1_value: Parameter value :param parameter2_name: Parameter name @@ -1518,7 +1518,7 @@ def get(self, sid: str) -> StreamContext: """ Constructs a StreamContext - :param sid: The SID of the Stream resource, or the `name` used when creating the resource + :param sid: The SID or the `name` of the Stream resource to be stopped """ return StreamContext( self._version, @@ -1531,7 +1531,7 @@ def __call__(self, sid: str) -> StreamContext: """ Constructs a StreamContext - :param sid: The SID of the Stream resource, or the `name` used when creating the resource + :param sid: The SID or the `name` of the Stream resource to be stopped """ return StreamContext( self._version, diff --git a/twilio/rest/content/v1/content/__init__.py b/twilio/rest/content/v1/content/__init__.py index b057cb4f86..72e1e82141 100644 --- a/twilio/rest/content/v1/content/__init__.py +++ b/twilio/rest/content/v1/content/__init__.py @@ -20,10 +20,27 @@ from twilio.base.list_resource import ListResource from twilio.base.version import Version from twilio.base.page import Page +from twilio.rest.content.v1.content.approval_create import ApprovalCreateList from twilio.rest.content.v1.content.approval_fetch import ApprovalFetchList class ContentInstance(InstanceResource): + + class AuthenticationActionType(object): + COPY_CODE = "COPY_CODE" + + class CallToActionActionType(object): + URL = "URL" + PHONE_NUMBER = "PHONE_NUMBER" + + class CardActionType(object): + URL = "URL" + PHONE_NUMBER = "PHONE_NUMBER" + QUICK_REPLY = "QUICK_REPLY" + + class QuickReplyActionType(object): + QUICK_REPLY = "QUICK_REPLY" + """ :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. @@ -32,7 +49,7 @@ class ContentInstance(InstanceResource): :ivar friendly_name: A string name used to describe the Content resource. Not visible to the end recipient. :ivar language: Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in. :ivar variables: Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}. - :ivar types: The [Content types](https://www.twilio.com/docs/content/content-types-overview) (e.g. twilio/text) for this Content resource. + :ivar types: The [Content types](https://www.twilio.com/docs/content-api/content-types-overview) (e.g. twilio/text) for this Content resource. :ivar url: The URL of the resource, relative to `https://content.twilio.com`. :ivar links: A list of links related to the Content resource, such as approval_fetch and approval_create """ @@ -113,6 +130,13 @@ async def fetch_async(self) -> "ContentInstance": """ return await self._proxy.fetch_async() + @property + def approval_create(self) -> ApprovalCreateList: + """ + Access the approval_create + """ + return self._proxy.approval_create + @property def approval_fetch(self) -> ApprovalFetchList: """ @@ -147,6 +171,7 @@ def __init__(self, version: Version, sid: str): } self._uri = "/Content/{sid}".format(**self._solution) + self._approval_create: Optional[ApprovalCreateList] = None self._approval_fetch: Optional[ApprovalFetchList] = None def delete(self) -> bool: @@ -211,6 +236,18 @@ async def fetch_async(self) -> ContentInstance: sid=self._solution["sid"], ) + @property + def approval_create(self) -> ApprovalCreateList: + """ + Access the approval_create + """ + if self._approval_create is None: + self._approval_create = ApprovalCreateList( + self._version, + self._solution["sid"], + ) + return self._approval_create + @property def approval_fetch(self) -> ApprovalFetchList: """ @@ -254,6 +291,451 @@ def __repr__(self) -> str: class ContentList(ListResource): + class AuthenticationAction(object): + """ + :ivar type: + :ivar copy_code_text: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.type: Optional["ContentInstance.AuthenticationActionType"] = ( + payload.get("type") + ) + self.copy_code_text: Optional[str] = payload.get("copy_code_text") + + def to_dict(self): + return { + "type": self.type.to_dict(), + "copy_code_text": self.copy_code_text, + } + + class CallToActionAction(object): + """ + :ivar type: + :ivar title: + :ivar url: + :ivar phone: + :ivar id: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.type: Optional["ContentInstance.CallToActionActionType"] = payload.get( + "type" + ) + self.title: Optional[str] = payload.get("title") + self.url: Optional[str] = payload.get("url") + self.phone: Optional[str] = payload.get("phone") + self.id: Optional[str] = payload.get("id") + + def to_dict(self): + return { + "type": self.type.to_dict(), + "title": self.title, + "url": self.url, + "phone": self.phone, + "id": self.id, + } + + class CardAction(object): + """ + :ivar type: + :ivar title: + :ivar url: + :ivar phone: + :ivar id: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.type: Optional["ContentInstance.CardActionType"] = payload.get("type") + self.title: Optional[str] = payload.get("title") + self.url: Optional[str] = payload.get("url") + self.phone: Optional[str] = payload.get("phone") + self.id: Optional[str] = payload.get("id") + + def to_dict(self): + return { + "type": self.type.to_dict(), + "title": self.title, + "url": self.url, + "phone": self.phone, + "id": self.id, + } + + class CatalogItem(object): + """ + :ivar id: + :ivar section_title: + :ivar name: + :ivar media_url: + :ivar price: + :ivar description: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.id: Optional[str] = payload.get("id") + self.section_title: Optional[str] = payload.get("section_title") + self.name: Optional[str] = payload.get("name") + self.media_url: Optional[str] = payload.get("media_url") + self.price: Optional[float] = payload.get("price") + self.description: Optional[str] = payload.get("description") + + def to_dict(self): + return { + "id": self.id, + "section_title": self.section_title, + "name": self.name, + "media_url": self.media_url, + "price": self.price, + "description": self.description, + } + + class ContentCreateRequest(object): + """ + :ivar friendly_name: User defined name of the content + :ivar variables: Key value pairs of variable name to value + :ivar language: Language code for the content + :ivar types: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.variables: Optional[dict[str, str]] = payload.get("variables") + self.language: Optional[str] = payload.get("language") + self.types: Optional[ContentList.Types] = payload.get("types") + + def to_dict(self): + return { + "friendly_name": self.friendly_name, + "variables": self.variables, + "language": self.language, + "types": self.types.to_dict(), + } + + class ListItem(object): + """ + :ivar id: + :ivar item: + :ivar description: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.id: Optional[str] = payload.get("id") + self.item: Optional[str] = payload.get("item") + self.description: Optional[str] = payload.get("description") + + def to_dict(self): + return { + "id": self.id, + "item": self.item, + "description": self.description, + } + + class QuickReplyAction(object): + """ + :ivar type: + :ivar title: + :ivar id: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.type: Optional["ContentInstance.QuickReplyActionType"] = payload.get( + "type" + ) + self.title: Optional[str] = payload.get("title") + self.id: Optional[str] = payload.get("id") + + def to_dict(self): + return { + "type": self.type.to_dict(), + "title": self.title, + "id": self.id, + } + + class TwilioCallToAction(object): + """ + :ivar body: + :ivar actions: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.body: Optional[str] = payload.get("body") + self.actions: Optional[List[ContentList.CallToActionAction]] = payload.get( + "actions" + ) + + def to_dict(self): + return { + "body": self.body, + "actions": [actions.to_dict() for actions in self.actions], + } + + class TwilioCard(object): + """ + :ivar title: + :ivar subtitle: + :ivar media: + :ivar actions: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.title: Optional[str] = payload.get("title") + self.subtitle: Optional[str] = payload.get("subtitle") + self.media: Optional[List[str]] = payload.get("media") + self.actions: Optional[List[ContentList.CardAction]] = payload.get( + "actions" + ) + + def to_dict(self): + return { + "title": self.title, + "subtitle": self.subtitle, + "media": self.media, + "actions": [actions.to_dict() for actions in self.actions], + } + + class TwilioCatalog(object): + """ + :ivar title: + :ivar body: + :ivar subtitle: + :ivar id: + :ivar items: + :ivar dynamic_items: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.title: Optional[str] = payload.get("title") + self.body: Optional[str] = payload.get("body") + self.subtitle: Optional[str] = payload.get("subtitle") + self.id: Optional[str] = payload.get("id") + self.items: Optional[List[ContentList.CatalogItem]] = payload.get("items") + self.dynamic_items: Optional[str] = payload.get("dynamic_items") + + def to_dict(self): + return { + "title": self.title, + "body": self.body, + "subtitle": self.subtitle, + "id": self.id, + "items": [items.to_dict() for items in self.items], + "dynamic_items": self.dynamic_items, + } + + class TwilioListPicker(object): + """ + :ivar body: + :ivar button: + :ivar items: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.body: Optional[str] = payload.get("body") + self.button: Optional[str] = payload.get("button") + self.items: Optional[List[ContentList.ListItem]] = payload.get("items") + + def to_dict(self): + return { + "body": self.body, + "button": self.button, + "items": [items.to_dict() for items in self.items], + } + + class TwilioLocation(object): + """ + :ivar latitude: + :ivar longitude: + :ivar label: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.latitude: Optional[float] = payload.get("latitude") + self.longitude: Optional[float] = payload.get("longitude") + self.label: Optional[str] = payload.get("label") + + def to_dict(self): + return { + "latitude": self.latitude, + "longitude": self.longitude, + "label": self.label, + } + + class TwilioMedia(object): + """ + :ivar body: + :ivar media: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.body: Optional[str] = payload.get("body") + self.media: Optional[List[str]] = payload.get("media") + + def to_dict(self): + return { + "body": self.body, + "media": self.media, + } + + class TwilioQuickReply(object): + """ + :ivar body: + :ivar actions: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.body: Optional[str] = payload.get("body") + self.actions: Optional[List[ContentList.QuickReplyAction]] = payload.get( + "actions" + ) + + def to_dict(self): + return { + "body": self.body, + "actions": [actions.to_dict() for actions in self.actions], + } + + class TwilioText(object): + """ + :ivar body: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.body: Optional[str] = payload.get("body") + + def to_dict(self): + return { + "body": self.body, + } + + class Types(object): + """ + :ivar twilio_text: + :ivar twilio_media: + :ivar twilio_location: + :ivar twilio_list_picker: + :ivar twilio_call_to_action: + :ivar twilio_quick_reply: + :ivar twilio_card: + :ivar twilio_catalog: + :ivar whatsapp_card: + :ivar whatsapp_authentication: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.twilio_text: Optional[ContentList.TwilioText] = payload.get( + "twilio_text" + ) + self.twilio_media: Optional[ContentList.TwilioMedia] = payload.get( + "twilio_media" + ) + self.twilio_location: Optional[ContentList.TwilioLocation] = payload.get( + "twilio_location" + ) + self.twilio_list_picker: Optional[ContentList.TwilioListPicker] = ( + payload.get("twilio_list_picker") + ) + self.twilio_call_to_action: Optional[ContentList.TwilioCallToAction] = ( + payload.get("twilio_call_to_action") + ) + self.twilio_quick_reply: Optional[ContentList.TwilioQuickReply] = ( + payload.get("twilio_quick_reply") + ) + self.twilio_card: Optional[ContentList.TwilioCard] = payload.get( + "twilio_card" + ) + self.twilio_catalog: Optional[ContentList.TwilioCatalog] = payload.get( + "twilio_catalog" + ) + self.whatsapp_card: Optional[ContentList.WhatsappCard] = payload.get( + "whatsapp_card" + ) + self.whatsapp_authentication: Optional[ + ContentList.WhatsappAuthentication + ] = payload.get("whatsapp_authentication") + + def to_dict(self): + return { + "twilio_text": self.twilio_text.to_dict(), + "twilio_media": self.twilio_media.to_dict(), + "twilio_location": self.twilio_location.to_dict(), + "twilio_list_picker": self.twilio_list_picker.to_dict(), + "twilio_call_to_action": self.twilio_call_to_action.to_dict(), + "twilio_quick_reply": self.twilio_quick_reply.to_dict(), + "twilio_card": self.twilio_card.to_dict(), + "twilio_catalog": self.twilio_catalog.to_dict(), + "whatsapp_card": self.whatsapp_card.to_dict(), + "whatsapp_authentication": self.whatsapp_authentication.to_dict(), + } + + class WhatsappAuthentication(object): + """ + :ivar add_security_recommendation: + :ivar code_expiration_minutes: + :ivar actions: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.add_security_recommendation: Optional[bool] = payload.get( + "add_security_recommendation" + ) + self.code_expiration_minutes: Optional[float] = payload.get( + "code_expiration_minutes" + ) + self.actions: Optional[List[ContentList.AuthenticationAction]] = ( + payload.get("actions") + ) + + def to_dict(self): + return { + "add_security_recommendation": self.add_security_recommendation, + "code_expiration_minutes": self.code_expiration_minutes, + "actions": [actions.to_dict() for actions in self.actions], + } + + class WhatsappCard(object): + """ + :ivar body: + :ivar footer: + :ivar media: + :ivar header_text: + :ivar actions: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.body: Optional[str] = payload.get("body") + self.footer: Optional[str] = payload.get("footer") + self.media: Optional[List[str]] = payload.get("media") + self.header_text: Optional[str] = payload.get("header_text") + self.actions: Optional[List[ContentList.CardAction]] = payload.get( + "actions" + ) + + def to_dict(self): + return { + "body": self.body, + "footer": self.footer, + "media": self.media, + "header_text": self.header_text, + "actions": [actions.to_dict() for actions in self.actions], + } + def __init__(self, version: Version): """ Initialize the ContentList @@ -265,6 +747,44 @@ def __init__(self, version: Version): self._uri = "/Content" + def create(self, content_create_request: ContentCreateRequest) -> ContentInstance: + """ + Create the ContentInstance + + :param content_create_request: + + :returns: The created ContentInstance + """ + data = content_create_request.to_dict() + + headers = {"Content-Type": "application/json"} + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return ContentInstance(self._version, payload) + + async def create_async( + self, content_create_request: ContentCreateRequest + ) -> ContentInstance: + """ + Asynchronously create the ContentInstance + + :param content_create_request: + + :returns: The created ContentInstance + """ + data = content_create_request.to_dict() + + headers = {"Content-Type": "application/json"} + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return ContentInstance(self._version, payload) + def stream( self, limit: Optional[int] = None, diff --git a/twilio/rest/flex_api/v2/__init__.py b/twilio/rest/flex_api/v2/__init__.py index 021615e19f..e05ffcdfb5 100644 --- a/twilio/rest/flex_api/v2/__init__.py +++ b/twilio/rest/flex_api/v2/__init__.py @@ -15,6 +15,7 @@ from typing import Optional from twilio.base.version import Version from twilio.base.domain import Domain +from twilio.rest.flex_api.v2.flex_user import FlexUserList from twilio.rest.flex_api.v2.web_channels import WebChannelsList @@ -27,8 +28,15 @@ def __init__(self, domain: Domain): :param domain: The Twilio.flex_api domain """ super().__init__(domain, "v2") + self._flex_user: Optional[FlexUserList] = None self._web_channels: Optional[WebChannelsList] = None + @property + def flex_user(self) -> FlexUserList: + if self._flex_user is None: + self._flex_user = FlexUserList(self) + return self._flex_user + @property def web_channels(self) -> WebChannelsList: if self._web_channels is None: diff --git a/twilio/rest/flex_api/v2/flex_user.py b/twilio/rest/flex_api/v2/flex_user.py new file mode 100644 index 0000000000..1acc75a8a8 --- /dev/null +++ b/twilio/rest/flex_api/v2/flex_user.py @@ -0,0 +1,234 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Flex + 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 datetime import datetime +from typing import Any, Dict, Optional +from twilio.base import deserialize +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class FlexUserInstance(InstanceResource): + """ + :ivar account_sid: The unique SID of the account that created the resource. + :ivar instance_sid: The unique ID created by Twilio to identify a Flex instance. + :ivar user_sid: The unique SID identifier of the Twilio Unified User. + :ivar flex_user_sid: The unique SID identifier of the Flex User. + :ivar worker_sid: The unique SID identifier of the worker. + :ivar workspace_sid: The unique SID identifier of the workspace. + :ivar flex_team_sid: The unique SID identifier of the Flex Team. + :ivar first_name: First name of the User. + :ivar last_name: Last name of the User. + :ivar username: Username of the User. + :ivar email: Email of the User. + :ivar friendly_name: Friendly name of the User. + :ivar created_date: The date that this user was created, given in ISO 8601 format. + :ivar updated_date: The date that this user was updated, given in ISO 8601 format. + :ivar version: The current version of the user. + :ivar url: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + instance_sid: Optional[str] = None, + flex_user_sid: Optional[str] = None, + ): + super().__init__(version) + + self.account_sid: Optional[str] = payload.get("account_sid") + self.instance_sid: Optional[str] = payload.get("instance_sid") + self.user_sid: Optional[str] = payload.get("user_sid") + self.flex_user_sid: Optional[str] = payload.get("flex_user_sid") + self.worker_sid: Optional[str] = payload.get("worker_sid") + self.workspace_sid: Optional[str] = payload.get("workspace_sid") + self.flex_team_sid: Optional[str] = payload.get("flex_team_sid") + self.first_name: Optional[str] = payload.get("first_name") + self.last_name: Optional[str] = payload.get("last_name") + self.username: Optional[str] = payload.get("username") + self.email: Optional[str] = payload.get("email") + self.friendly_name: Optional[str] = payload.get("friendly_name") + 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.version: Optional[int] = deserialize.integer(payload.get("version")) + self.url: Optional[str] = payload.get("url") + + self._solution = { + "instance_sid": instance_sid or self.instance_sid, + "flex_user_sid": flex_user_sid or self.flex_user_sid, + } + self._context: Optional[FlexUserContext] = None + + @property + def _proxy(self) -> "FlexUserContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: FlexUserContext for this FlexUserInstance + """ + if self._context is None: + self._context = FlexUserContext( + self._version, + instance_sid=self._solution["instance_sid"], + flex_user_sid=self._solution["flex_user_sid"], + ) + return self._context + + def fetch(self) -> "FlexUserInstance": + """ + Fetch the FlexUserInstance + + + :returns: The fetched FlexUserInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "FlexUserInstance": + """ + Asynchronous coroutine to fetch the FlexUserInstance + + + :returns: The fetched FlexUserInstance + """ + return await self._proxy.fetch_async() + + 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 FlexUserContext(InstanceContext): + + def __init__(self, version: Version, instance_sid: str, flex_user_sid: str): + """ + Initialize the FlexUserContext + + :param version: Version that contains the resource + :param instance_sid: The unique ID created by Twilio to identify a Flex instance. + :param flex_user_sid: The unique id for the flex user to be retrieved. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "instance_sid": instance_sid, + "flex_user_sid": flex_user_sid, + } + self._uri = "/Instances/{instance_sid}/Users/{flex_user_sid}".format( + **self._solution + ) + + def fetch(self) -> FlexUserInstance: + """ + Fetch the FlexUserInstance + + + :returns: The fetched FlexUserInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return FlexUserInstance( + self._version, + payload, + instance_sid=self._solution["instance_sid"], + flex_user_sid=self._solution["flex_user_sid"], + ) + + async def fetch_async(self) -> FlexUserInstance: + """ + Asynchronous coroutine to fetch the FlexUserInstance + + + :returns: The fetched FlexUserInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return FlexUserInstance( + self._version, + payload, + instance_sid=self._solution["instance_sid"], + flex_user_sid=self._solution["flex_user_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 FlexUserList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the FlexUserList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + def get(self, instance_sid: str, flex_user_sid: str) -> FlexUserContext: + """ + Constructs a FlexUserContext + + :param instance_sid: The unique ID created by Twilio to identify a Flex instance. + :param flex_user_sid: The unique id for the flex user to be retrieved. + """ + return FlexUserContext( + self._version, instance_sid=instance_sid, flex_user_sid=flex_user_sid + ) + + def __call__(self, instance_sid: str, flex_user_sid: str) -> FlexUserContext: + """ + Constructs a FlexUserContext + + :param instance_sid: The unique ID created by Twilio to identify a Flex instance. + :param flex_user_sid: The unique id for the flex user to be retrieved. + """ + return FlexUserContext( + self._version, instance_sid=instance_sid, flex_user_sid=flex_user_sid + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/flex_api/v2/web_channels.py b/twilio/rest/flex_api/v2/web_channels.py index 13e5b28d7a..a4b7b0c31d 100644 --- a/twilio/rest/flex_api/v2/web_channels.py +++ b/twilio/rest/flex_api/v2/web_channels.py @@ -58,6 +58,7 @@ def __init__(self, version: Version): def create( self, address_sid: str, + ui_version: Union[str, object] = values.unset, chat_friendly_name: Union[str, object] = values.unset, customer_friendly_name: Union[str, object] = values.unset, pre_engagement_data: Union[str, object] = values.unset, @@ -66,6 +67,7 @@ def create( Create the WebChannelsInstance :param address_sid: The SID of the Conversations Address. See [Address Configuration Resource](https://www.twilio.com/docs/conversations/api/address-configuration-resource) for configuration details. When a conversation is created on the Flex backend, the callback URL will be set to the corresponding Studio Flow SID or webhook URL in your address configuration. + :param ui_version: The Ui-Version HTTP request header :param chat_friendly_name: The Conversation's friendly name. See the [Conversation resource](https://www.twilio.com/docs/conversations/api/conversation-resource) for an example. :param customer_friendly_name: The Conversation participant's friendly name. See the [Conversation Participant Resource](https://www.twilio.com/docs/conversations/api/conversation-participant-resource) for an example. :param pre_engagement_data: The pre-engagement data. @@ -81,11 +83,14 @@ def create( "PreEngagementData": pre_engagement_data, } ) + headers = values.of( + { + "Ui-Version": ui_version, + } + ) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return WebChannelsInstance(self._version, payload) @@ -93,6 +98,7 @@ def create( async def create_async( self, address_sid: str, + ui_version: Union[str, object] = values.unset, chat_friendly_name: Union[str, object] = values.unset, customer_friendly_name: Union[str, object] = values.unset, pre_engagement_data: Union[str, object] = values.unset, @@ -101,6 +107,7 @@ async def create_async( Asynchronously create the WebChannelsInstance :param address_sid: The SID of the Conversations Address. See [Address Configuration Resource](https://www.twilio.com/docs/conversations/api/address-configuration-resource) for configuration details. When a conversation is created on the Flex backend, the callback URL will be set to the corresponding Studio Flow SID or webhook URL in your address configuration. + :param ui_version: The Ui-Version HTTP request header :param chat_friendly_name: The Conversation's friendly name. See the [Conversation resource](https://www.twilio.com/docs/conversations/api/conversation-resource) for an example. :param customer_friendly_name: The Conversation participant's friendly name. See the [Conversation Participant Resource](https://www.twilio.com/docs/conversations/api/conversation-participant-resource) for an example. :param pre_engagement_data: The pre-engagement data. @@ -116,11 +123,14 @@ async def create_async( "PreEngagementData": pre_engagement_data, } ) + headers = values.of( + { + "Ui-Version": ui_version, + } + ) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return WebChannelsInstance(self._version, payload) diff --git a/twilio/rest/numbers/v1/__init__.py b/twilio/rest/numbers/v1/__init__.py index 9da80f3a34..0bacabb722 100644 --- a/twilio/rest/numbers/v1/__init__.py +++ b/twilio/rest/numbers/v1/__init__.py @@ -20,6 +20,9 @@ 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_port_in_phone_number import ( + PortingPortInPhoneNumberList, +) from twilio.rest.numbers.v1.porting_portability import PortingPortabilityList @@ -37,6 +40,9 @@ def __init__(self, domain: Domain): self._porting_bulk_portabilities: Optional[PortingBulkPortabilityList] = None self._porting_port_ins: Optional[PortingPortInList] = None self._porting_port_ins_fetch: Optional[PortingPortInFetchList] = None + self._porting_port_in_phone_number: Optional[PortingPortInPhoneNumberList] = ( + None + ) self._porting_portabilities: Optional[PortingPortabilityList] = None @property @@ -69,6 +75,12 @@ def porting_port_ins_fetch(self) -> PortingPortInFetchList: self._porting_port_ins_fetch = PortingPortInFetchList(self) return self._porting_port_ins_fetch + @property + def porting_port_in_phone_number(self) -> PortingPortInPhoneNumberList: + if self._porting_port_in_phone_number is None: + self._porting_port_in_phone_number = PortingPortInPhoneNumberList(self) + return self._porting_port_in_phone_number + @property def porting_portabilities(self) -> PortingPortabilityList: if self._porting_portabilities is None: diff --git a/twilio/rest/numbers/v1/porting_port_in.py b/twilio/rest/numbers/v1/porting_port_in.py index 086c630c65..862f578bff 100644 --- a/twilio/rest/numbers/v1/porting_port_in.py +++ b/twilio/rest/numbers/v1/porting_port_in.py @@ -14,7 +14,7 @@ from typing import Any, Dict, Optional, Union from twilio.base import values - +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource from twilio.base.version import Version @@ -26,20 +26,114 @@ class PortingPortInInstance(InstanceResource): :ivar url: """ - def __init__(self, version: Version, payload: Dict[str, Any]): + def __init__( + self, + version: Version, + payload: Dict[str, Any], + port_in_request_sid: Optional[str] = None, + ): super().__init__(version) self.port_in_request_sid: Optional[str] = payload.get("port_in_request_sid") self.url: Optional[str] = payload.get("url") + self._solution = { + "port_in_request_sid": port_in_request_sid or self.port_in_request_sid, + } + self._context: Optional[PortingPortInContext] = None + + @property + def _proxy(self) -> "PortingPortInContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: PortingPortInContext for this PortingPortInInstance + """ + if self._context is None: + self._context = PortingPortInContext( + self._version, + port_in_request_sid=self._solution["port_in_request_sid"], + ) + return self._context + + def delete(self) -> bool: + """ + Deletes the PortingPortInInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the PortingPortInInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + 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 PortingPortInContext(InstanceContext): + + def __init__(self, version: Version, port_in_request_sid: str): + """ + Initialize the PortingPortInContext + + :param version: Version that contains the resource + :param port_in_request_sid: The SID of the Port In request. This is a unique identifier of the port in request. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "port_in_request_sid": port_in_request_sid, + } + self._uri = "/Porting/PortIn/{port_in_request_sid}".format(**self._solution) + + def delete(self) -> bool: + """ + Deletes the PortingPortInInstance - return "" + + :returns: True if delete succeeds, False otherwise + """ + return self._version.delete( + method="DELETE", + uri=self._uri, + ) + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the PortingPortInInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._version.delete_async( + method="DELETE", + uri=self._uri, + ) + + 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 PortingPortInList(ListResource): @@ -95,6 +189,26 @@ async def create_async( return PortingPortInInstance(self._version, payload) + def get(self, port_in_request_sid: str) -> PortingPortInContext: + """ + Constructs a PortingPortInContext + + :param port_in_request_sid: The SID of the Port In request. This is a unique identifier of the port in request. + """ + return PortingPortInContext( + self._version, port_in_request_sid=port_in_request_sid + ) + + def __call__(self, port_in_request_sid: str) -> PortingPortInContext: + """ + Constructs a PortingPortInContext + + :param port_in_request_sid: The SID of the Port In request. This is a unique identifier of the port in request. + """ + return PortingPortInContext( + self._version, port_in_request_sid=port_in_request_sid + ) + def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/numbers/v1/porting_port_in_phone_number.py b/twilio/rest/numbers/v1/porting_port_in_phone_number.py new file mode 100644 index 0000000000..41296c6b65 --- /dev/null +++ b/twilio/rest/numbers/v1/porting_port_in_phone_number.py @@ -0,0 +1,125 @@ +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 twilio.base.instance_context import InstanceContext + +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class PortingPortInPhoneNumberContext(InstanceContext): + + def __init__( + self, version: Version, port_in_request_sid: str, phone_number_sid: str + ): + """ + Initialize the PortingPortInPhoneNumberContext + + :param version: Version that contains the resource + :param port_in_request_sid: The SID of the Port In request. This is a unique identifier of the port in request. + :param phone_number_sid: The SID of the Port In request phone number. This is a unique identifier of the phone number. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "port_in_request_sid": port_in_request_sid, + "phone_number_sid": phone_number_sid, + } + self._uri = "/Porting/PortIn/{port_in_request_sid}/PhoneNumber/{phone_number_sid}".format( + **self._solution + ) + + def delete(self) -> bool: + """ + Deletes the PortingPortInPhoneNumberInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._version.delete( + method="DELETE", + uri=self._uri, + ) + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the PortingPortInPhoneNumberInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._version.delete_async( + method="DELETE", + uri=self._uri, + ) + + 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 PortingPortInPhoneNumberList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the PortingPortInPhoneNumberList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + def get( + self, port_in_request_sid: str, phone_number_sid: str + ) -> PortingPortInPhoneNumberContext: + """ + Constructs a PortingPortInPhoneNumberContext + + :param port_in_request_sid: The SID of the Port In request. This is a unique identifier of the port in request. + :param phone_number_sid: The SID of the Port In request phone number. This is a unique identifier of the phone number. + """ + return PortingPortInPhoneNumberContext( + self._version, + port_in_request_sid=port_in_request_sid, + phone_number_sid=phone_number_sid, + ) + + def __call__( + self, port_in_request_sid: str, phone_number_sid: str + ) -> PortingPortInPhoneNumberContext: + """ + Constructs a PortingPortInPhoneNumberContext + + :param port_in_request_sid: The SID of the Port In request. This is a unique identifier of the port in request. + :param phone_number_sid: The SID of the Port In request phone number. This is a unique identifier of the phone number. + """ + return PortingPortInPhoneNumberContext( + self._version, + port_in_request_sid=port_in_request_sid, + phone_number_sid=phone_number_sid, + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" From 1fb82e5cb84dac237a15a61034278135b6693ac3 Mon Sep 17 00:00:00 2001 From: Twilio Date: Thu, 18 Apr 2024 11:14:44 +0000 Subject: [PATCH 07/87] Release 9.0.5 --- setup.py | 2 +- twilio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 91945bfd86..ed82dddb26 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name="twilio", - version="9.0.4", + version="9.0.5", description="Twilio API client and TwiML generator", author="Twilio", help_center="https://www.twilio.com/help/contact", diff --git a/twilio/__init__.py b/twilio/__init__.py index 5ed1a81015..a5d6bc795f 100644 --- a/twilio/__init__.py +++ b/twilio/__init__.py @@ -1,2 +1,2 @@ -__version_info__ = ("9", "0", "4") +__version_info__ = ("9", "0", "5") __version__ = ".".join(__version_info__) From 4ed7fec29a5baccef722286033361b7092180e3c Mon Sep 17 00:00:00 2001 From: lightiverson <33266555+lightiverson@users.noreply.github.com> Date: Mon, 22 Apr 2024 13:26:24 +0200 Subject: [PATCH 08/87] fix: increase pool_maxsize (#714) (#716) Co-authored-by: Kawish Gajadien Co-authored-by: Shubham --- twilio/http/http_client.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/twilio/http/http_client.py b/twilio/http/http_client.py index 7a1715ad49..9d329c6aa7 100644 --- a/twilio/http/http_client.py +++ b/twilio/http/http_client.py @@ -1,3 +1,4 @@ +import os import logging from typing import Dict, Optional, Tuple @@ -39,7 +40,10 @@ def __init__( self.session = Session() if pool_connections else None if self.session and max_retries is not None: self.session.mount("https://", HTTPAdapter(max_retries=max_retries)) - + if self.session is not None: + self.session.mount( + "https://", HTTPAdapter(pool_maxsize=min(32, os.cpu_count() + 4)) + ) self.request_hooks = request_hooks or hooks.default_hooks() self.proxy = proxy if proxy else {} From 386320522ce86b66ee49a845d2bcaefb904ab595 Mon Sep 17 00:00:00 2001 From: twilio-product-security <67294289+twilio-product-security@users.noreply.github.com> Date: Wed, 22 May 2024 13:53:42 -0400 Subject: [PATCH 09/87] fix: requirements.txt to reduce vulnerabilities (#789) The following vulnerabilities are fixed by pinning transitive dependencies: - https://snyk.io/vuln/SNYK-PYTHON-AIOHTTP-6645291 Co-authored-by: snyk-bot Co-authored-by: Shubham --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index c633981931..a29abc4d1e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ pygments>=2.7.4 # not directly required, pinned by Snyk to avoid a vulnerability requests>=2.31.0 PyJWT>=2.0.0, <3.0.0 -aiohttp>=3.9.0 +aiohttp>=3.9.4 aiohttp-retry>=2.8.3 certifi>=2023.7.22 # not directly required, pinned by Snyk to avoid a vulnerability From 663ca134ddb46cd285790ca7a9c4e14b58f65f3d Mon Sep 17 00:00:00 2001 From: Twilio Date: Fri, 24 May 2024 11:02:53 +0000 Subject: [PATCH 10/87] [Librarian] Regenerated @ 1baa147fbfa3bf2798f86ec43796ef1df42570d4 a3170b07f36450c6d179edf9b044cbf5f6b94e3a --- CHANGES.md | 46 ++ twilio/rest/__init__.py | 15 - .../api/v2010/account/message/__init__.py | 2 +- twilio/rest/content/ContentBase.py | 11 + twilio/rest/content/v2/__init__.py | 51 ++ twilio/rest/content/v2/content.py | 288 ++++++++ .../rest/content/v2/content_and_approvals.py | 288 ++++++++ .../rest/flex_api/v1/interaction/__init__.py | 4 +- .../flex_api/v1/plugin/plugin_versions.py | 4 +- twilio/rest/intelligence/v2/__init__.py | 48 ++ .../rest/intelligence/v2/custom_operator.py | 682 ++++++++++++++++++ twilio/rest/intelligence/v2/operator.py | 462 ++++++++++++ .../intelligence/v2/operator_attachment.py | 245 +++++++ .../intelligence/v2/operator_attachments.py | 187 +++++ twilio/rest/intelligence/v2/operator_type.py | 443 ++++++++++++ .../rest/intelligence/v2/prebuilt_operator.py | 474 ++++++++++++ twilio/rest/intelligence/v2/service.py | 22 +- twilio/rest/messaging/v1/service/__init__.py | 4 - twilio/rest/numbers/v1/__init__.py | 60 +- .../numbers/v1/porting_bulk_portability.py | 252 ------- twilio/rest/numbers/v1/porting_port_in.py | 95 ++- .../rest/numbers/v1/porting_port_in_fetch.py | 223 ------ .../v1/porting_port_in_phone_number.py | 175 ++++- .../v1/porting_webhook_configuration.py | 108 +++ .../porting_webhook_configuration_delete.py | 121 ++++ .../v1/porting_webhook_configuration_fetch.py | 101 +++ .../preview_messaging/PreviewMessagingBase.py | 44 -- twilio/rest/preview_messaging/v1/__init__.py | 51 -- twilio/rest/preview_messaging/v1/broadcast.py | 125 ---- twilio/rest/preview_messaging/v1/message.py | 204 ------ .../taskrouter/v1/workspace/task/__init__.py | 40 + .../v1/compliance_tollfree_inquiries.py | 6 + .../trusthub/v1/customer_profiles/__init__.py | 2 + .../trusthub/v1/trust_products/__init__.py | 2 + twilio/rest/verify/v2/service/__init__.py | 2 +- twilio/rest/verify/v2/service/verification.py | 2 +- .../verify/v2/service/verification_check.py | 2 +- 37 files changed, 3928 insertions(+), 963 deletions(-) create mode 100644 twilio/rest/content/v2/__init__.py create mode 100644 twilio/rest/content/v2/content.py create mode 100644 twilio/rest/content/v2/content_and_approvals.py create mode 100644 twilio/rest/intelligence/v2/custom_operator.py create mode 100644 twilio/rest/intelligence/v2/operator.py create mode 100644 twilio/rest/intelligence/v2/operator_attachment.py create mode 100644 twilio/rest/intelligence/v2/operator_attachments.py create mode 100644 twilio/rest/intelligence/v2/operator_type.py create mode 100644 twilio/rest/intelligence/v2/prebuilt_operator.py delete mode 100644 twilio/rest/numbers/v1/porting_bulk_portability.py delete mode 100644 twilio/rest/numbers/v1/porting_port_in_fetch.py create mode 100644 twilio/rest/numbers/v1/porting_webhook_configuration.py create mode 100644 twilio/rest/numbers/v1/porting_webhook_configuration_delete.py create mode 100644 twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py delete mode 100644 twilio/rest/preview_messaging/PreviewMessagingBase.py delete mode 100644 twilio/rest/preview_messaging/v1/__init__.py delete mode 100644 twilio/rest/preview_messaging/v1/broadcast.py delete mode 100644 twilio/rest/preview_messaging/v1/message.py diff --git a/CHANGES.md b/CHANGES.md index 6af9e1d3f7..a6c5a45f2d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,52 @@ twilio-python Changelog Here you can see the full list of changes between each twilio-python release. +[2024-05-24] Version 9.1.0 +-------------------------- +**Library - Chore** +- [PR #789](https://github.com/twilio/twilio-python/pull/789): [Snyk] Security upgrade aiohttp from 3.8.6 to 3.9.4. Thanks to [@twilio-product-security](https://github.com/twilio-product-security)! + +**Library - Fix** +- [PR #716](https://github.com/twilio/twilio-python/pull/716): Connection pool is full, discarding connection. Thanks to [@lightiverson](https://github.com/lightiverson)! + +**Api** +- Add ie1 as supported region for UserDefinedMessage and UserDefinedMessageSubscription. + +**Flex** +- Adding validated field to `plugin_versions` +- Corrected the data type for `runtime_domain`, `call_recording_webhook_url`, `crm_callback_url`, `crm_fallback_url`, `flex_url` in Flex Configuration +- Making `routing` optional in Create Interactions endpoint + +**Intelligence** +- Expose operator authoring apis to public visibility +- Deleted `language_code` parameter from updating service in v2 **(breaking change)** +- Add read_only_attached_operator_sids to v2 services + +**Numbers** +- Add API endpoint for GET Porting Webhook Configurations By Account SID +- Remove bulk portability api under version `/v1`. **(breaking change)** +- Removed porting_port_in_fetch.json files and move the content into porting_port_in.json files +- Add API endpoint to deleting Webhook Configurations +- Add Get Phone Number by Port in request SID and Phone Number SID api +- Add Create Porting webhook configuration API +- Added bundle_sid and losing_carrier_information fields to Create PortInRequest api to support Japan porting + +**Taskrouter** +- Add back `routing_target` property to tasks +- Add back `ignore_capacity` property to tasks +- Removing `routing_target` property to tasks due to revert +- Removing `ignore_capacity` property to tasks due to revert +- Add `routing_target` property to tasks +- Add `ignore_capacity` property to tasks + +**Trusthub** +- Add new field errors to bundle as part of public API response in customer_profile.json and trust_product.json **(breaking change)** +- Add themeSetId field in compliance_tollfree_inquiry. + +**Verify** +- Update `friendly_name` description on service docs + + [2024-04-18] Version 9.0.5 -------------------------- **Library - Chore** diff --git a/twilio/rest/__init__.py b/twilio/rest/__init__.py index c7f722642a..0d3d96bfec 100644 --- a/twilio/rest/__init__.py +++ b/twilio/rest/__init__.py @@ -27,7 +27,6 @@ from twilio.rest.intelligence import Intelligence from twilio.rest.ip_messaging import IpMessaging from twilio.rest.lookups import Lookups - 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,7 +134,6 @@ def __init__( self._intelligence: Optional["Intelligence"] = None self._ip_messaging: Optional["IpMessaging"] = None self._lookups: Optional["Lookups"] = None - self._preview_messaging: Optional["PreviewMessaging"] = None self._messaging: Optional["Messaging"] = None self._microvisor: Optional["Microvisor"] = None self._monitor: Optional["Monitor"] = None @@ -327,19 +325,6 @@ def lookups(self) -> "Lookups": self._lookups = Lookups(self) return self._lookups - @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/message/__init__.py b/twilio/rest/api/v2010/account/message/__init__.py index 972d80b172..953d3d8008 100644 --- a/twilio/rest/api/v2010/account/message/__init__.py +++ b/twilio/rest/api/v2010/account/message/__init__.py @@ -78,7 +78,7 @@ class UpdateStatus(object): :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) associated with the Message resource :ivar num_media: The number of media files associated with the Message resource. :ivar status: - :ivar messaging_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) associated with the Message resource. The value is `null` if a Messaging Service was not used. + :ivar messaging_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) associated with the Message resource. A unique default value is assigned if a Messaging Service is not used. :ivar sid: The unique, Twilio-provided string that identifies the Message resource. :ivar date_sent: The [RFC 2822](https://datatracker.ietf.org/doc/html/rfc2822#section-3.3) timestamp (in GMT) of when the Message was sent. For an outgoing message, this is when Twilio sent the message. For an incoming message, this is when Twilio sent the HTTP request to your incoming message webhook URL. :ivar date_created: The [RFC 2822](https://datatracker.ietf.org/doc/html/rfc2822#section-3.3) timestamp (in GMT) of when the Message resource was created diff --git a/twilio/rest/content/ContentBase.py b/twilio/rest/content/ContentBase.py index a8511f9fff..8a1ccd5d94 100644 --- a/twilio/rest/content/ContentBase.py +++ b/twilio/rest/content/ContentBase.py @@ -14,6 +14,7 @@ from twilio.base.domain import Domain from twilio.rest import Client from twilio.rest.content.v1 import V1 +from twilio.rest.content.v2 import V2 class ContentBase(Domain): @@ -26,6 +27,7 @@ def __init__(self, twilio: Client): """ super().__init__(twilio, "https://content.twilio.com") self._v1: Optional[V1] = None + self._v2: Optional[V2] = None @property def v1(self) -> V1: @@ -36,6 +38,15 @@ def v1(self) -> V1: self._v1 = V1(self) return self._v1 + @property + def v2(self) -> V2: + """ + :returns: Versions v2 of Content + """ + if self._v2 is None: + self._v2 = V2(self) + return self._v2 + def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/content/v2/__init__.py b/twilio/rest/content/v2/__init__.py new file mode 100644 index 0000000000..ca6d8bcd74 --- /dev/null +++ b/twilio/rest/content/v2/__init__.py @@ -0,0 +1,51 @@ +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 Optional +from twilio.base.version import Version +from twilio.base.domain import Domain +from twilio.rest.content.v2.content import ContentList +from twilio.rest.content.v2.content_and_approvals import ContentAndApprovalsList + + +class V2(Version): + + def __init__(self, domain: Domain): + """ + Initialize the V2 version of Content + + :param domain: The Twilio.content domain + """ + super().__init__(domain, "v2") + self._contents: Optional[ContentList] = None + self._content_and_approvals: Optional[ContentAndApprovalsList] = None + + @property + def contents(self) -> ContentList: + if self._contents is None: + self._contents = ContentList(self) + return self._contents + + @property + def content_and_approvals(self) -> ContentAndApprovalsList: + if self._content_and_approvals is None: + self._content_and_approvals = ContentAndApprovalsList(self) + return self._content_and_approvals + + def __repr__(self) -> str: + """ + Provide a friendly representation + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/content/v2/content.py b/twilio/rest/content/v2/content.py new file mode 100644 index 0000000000..88ae80f1c0 --- /dev/null +++ b/twilio/rest/content/v2/content.py @@ -0,0 +1,288 @@ +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 datetime import datetime +from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator +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 +from twilio.base.page import Page + + +class ContentInstance(InstanceResource): + """ + :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar sid: The unique string that that we created to identify the Content resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/usage/api/account) that created Content resource. + :ivar friendly_name: A string name used to describe the Content resource. Not visible to the end recipient. + :ivar language: Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in. + :ivar variables: Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}. + :ivar types: The [Content types](https://www.twilio.com/docs/content/content-types-overview) (e.g. twilio/text) for this Content resource. + :ivar url: The URL of the resource, relative to `https://content.twilio.com`. + :ivar links: A list of links related to the Content resource, such as approval_fetch and approval_create + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) + + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.language: Optional[str] = payload.get("language") + self.variables: Optional[Dict[str, object]] = payload.get("variables") + self.types: Optional[Dict[str, object]] = payload.get("types") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "" + + +class ContentPage(Page): + + def get_instance(self, payload: Dict[str, Any]) -> ContentInstance: + """ + Build an instance of ContentInstance + + :param payload: Payload response from the API + """ + return ContentInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class ContentList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the ContentList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/Content" + + def stream( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[ContentInstance]: + """ + Streams ContentInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = self.page(page_size=limits["page_size"]) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[ContentInstance]: + """ + Asynchronously streams ContentInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = await self.page_async(page_size=limits["page_size"]) + + return self._version.stream_async(page, limits["limit"]) + + def list( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[ContentInstance]: + """ + Lists ContentInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return list( + self.stream( + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[ContentInstance]: + """ + Asynchronously lists ContentInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return [ + record + async for record in await self.stream_async( + limit=limit, + page_size=page_size, + ) + ] + + def page( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ContentPage: + """ + Retrieve a single page of ContentInstance records from the API. + Request is executed immediately + + :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 + + :returns: Page of ContentInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = self._version.page(method="GET", uri=self._uri, params=data) + return ContentPage(self._version, response) + + async def page_async( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ContentPage: + """ + Asynchronously retrieve a single page of ContentInstance records from the API. + Request is executed immediately + + :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 + + :returns: Page of ContentInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = await self._version.page_async( + method="GET", uri=self._uri, params=data + ) + return ContentPage(self._version, response) + + def get_page(self, target_url: str) -> ContentPage: + """ + Retrieve a specific page of ContentInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of ContentInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return ContentPage(self._version, response) + + async def get_page_async(self, target_url: str) -> ContentPage: + """ + Asynchronously retrieve a specific page of ContentInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of ContentInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return ContentPage(self._version, response) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/content/v2/content_and_approvals.py b/twilio/rest/content/v2/content_and_approvals.py new file mode 100644 index 0000000000..7a3e6d9ccf --- /dev/null +++ b/twilio/rest/content/v2/content_and_approvals.py @@ -0,0 +1,288 @@ +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 datetime import datetime +from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator +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 +from twilio.base.page import Page + + +class ContentAndApprovalsInstance(InstanceResource): + """ + :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar sid: The unique string that that we created to identify the Content resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/usage/api/account) that created Content resource. + :ivar friendly_name: A string name used to describe the Content resource. Not visible to the end recipient. + :ivar language: Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in. + :ivar variables: Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}. + :ivar types: The [Content types](https://www.twilio.com/docs/content/content-types-overview) (e.g. twilio/text) for this Content resource. + :ivar approval_requests: The submitted information and approval request status of the Content resource. + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) + + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.language: Optional[str] = payload.get("language") + self.variables: Optional[Dict[str, object]] = payload.get("variables") + self.types: Optional[Dict[str, object]] = payload.get("types") + self.approval_requests: Optional[Dict[str, object]] = payload.get( + "approval_requests" + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "" + + +class ContentAndApprovalsPage(Page): + + def get_instance(self, payload: Dict[str, Any]) -> ContentAndApprovalsInstance: + """ + Build an instance of ContentAndApprovalsInstance + + :param payload: Payload response from the API + """ + return ContentAndApprovalsInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class ContentAndApprovalsList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the ContentAndApprovalsList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/ContentAndApprovals" + + def stream( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[ContentAndApprovalsInstance]: + """ + Streams ContentAndApprovalsInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = self.page(page_size=limits["page_size"]) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[ContentAndApprovalsInstance]: + """ + Asynchronously streams ContentAndApprovalsInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = await self.page_async(page_size=limits["page_size"]) + + return self._version.stream_async(page, limits["limit"]) + + def list( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[ContentAndApprovalsInstance]: + """ + Lists ContentAndApprovalsInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return list( + self.stream( + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[ContentAndApprovalsInstance]: + """ + Asynchronously lists ContentAndApprovalsInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return [ + record + async for record in await self.stream_async( + limit=limit, + page_size=page_size, + ) + ] + + def page( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ContentAndApprovalsPage: + """ + Retrieve a single page of ContentAndApprovalsInstance records from the API. + Request is executed immediately + + :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 + + :returns: Page of ContentAndApprovalsInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = self._version.page(method="GET", uri=self._uri, params=data) + return ContentAndApprovalsPage(self._version, response) + + async def page_async( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ContentAndApprovalsPage: + """ + Asynchronously retrieve a single page of ContentAndApprovalsInstance records from the API. + Request is executed immediately + + :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 + + :returns: Page of ContentAndApprovalsInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = await self._version.page_async( + method="GET", uri=self._uri, params=data + ) + return ContentAndApprovalsPage(self._version, response) + + def get_page(self, target_url: str) -> ContentAndApprovalsPage: + """ + Retrieve a specific page of ContentAndApprovalsInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of ContentAndApprovalsInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return ContentAndApprovalsPage(self._version, response) + + async def get_page_async(self, target_url: str) -> ContentAndApprovalsPage: + """ + Asynchronously retrieve a specific page of ContentAndApprovalsInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of ContentAndApprovalsInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return ContentAndApprovalsPage(self._version, response) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/flex_api/v1/interaction/__init__.py b/twilio/rest/flex_api/v1/interaction/__init__.py index 992cc9b015..069b05309f 100644 --- a/twilio/rest/flex_api/v1/interaction/__init__.py +++ b/twilio/rest/flex_api/v1/interaction/__init__.py @@ -198,7 +198,7 @@ def __init__(self, version: Version): def create( self, channel: object, - routing: object, + routing: Union[object, object] = values.unset, interaction_context_sid: Union[str, object] = values.unset, ) -> InteractionInstance: """ @@ -230,7 +230,7 @@ def create( async def create_async( self, channel: object, - routing: object, + routing: Union[object, object] = values.unset, interaction_context_sid: Union[str, object] = values.unset, ) -> InteractionInstance: """ diff --git a/twilio/rest/flex_api/v1/plugin/plugin_versions.py b/twilio/rest/flex_api/v1/plugin/plugin_versions.py index 96313c84dd..1e5b5683b6 100644 --- a/twilio/rest/flex_api/v1/plugin/plugin_versions.py +++ b/twilio/rest/flex_api/v1/plugin/plugin_versions.py @@ -30,8 +30,9 @@ class PluginVersionsInstance(InstanceResource): :ivar version: The unique version of this Flex Plugin Version. :ivar plugin_url: The URL of where the Flex Plugin Version JavaScript bundle is hosted on. :ivar changelog: A changelog that describes the changes this Flex Plugin Version brings. - :ivar private: Whether to inject credentials while accessing this Plugin Version. The default value is false. + :ivar private: Whether the Flex Plugin Version is validated. The default value is false. :ivar archived: Whether the Flex Plugin Version is archived. The default value is false. + :ivar validated: :ivar date_created: The date and time in GMT when the Flex Plugin Version was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. :ivar url: The absolute URL of the Flex Plugin Version resource. """ @@ -53,6 +54,7 @@ def __init__( self.changelog: Optional[str] = payload.get("changelog") self.private: Optional[bool] = payload.get("private") self.archived: Optional[bool] = payload.get("archived") + self.validated: Optional[bool] = payload.get("validated") self.date_created: Optional[datetime] = deserialize.iso8601_datetime( payload.get("date_created") ) diff --git a/twilio/rest/intelligence/v2/__init__.py b/twilio/rest/intelligence/v2/__init__.py index e20b125ced..4999146f93 100644 --- a/twilio/rest/intelligence/v2/__init__.py +++ b/twilio/rest/intelligence/v2/__init__.py @@ -15,6 +15,12 @@ from typing import Optional from twilio.base.version import Version from twilio.base.domain import Domain +from twilio.rest.intelligence.v2.custom_operator import CustomOperatorList +from twilio.rest.intelligence.v2.operator import OperatorList +from twilio.rest.intelligence.v2.operator_attachment import OperatorAttachmentList +from twilio.rest.intelligence.v2.operator_attachments import OperatorAttachmentsList +from twilio.rest.intelligence.v2.operator_type import OperatorTypeList +from twilio.rest.intelligence.v2.prebuilt_operator import PrebuiltOperatorList from twilio.rest.intelligence.v2.service import ServiceList from twilio.rest.intelligence.v2.transcript import TranscriptList @@ -28,9 +34,51 @@ def __init__(self, domain: Domain): :param domain: The Twilio.intelligence domain """ super().__init__(domain, "v2") + self._custom_operators: Optional[CustomOperatorList] = None + self._operators: Optional[OperatorList] = None + self._operator_attachment: Optional[OperatorAttachmentList] = None + self._operator_attachments: Optional[OperatorAttachmentsList] = None + self._operator_type: Optional[OperatorTypeList] = None + self._prebuilt_operators: Optional[PrebuiltOperatorList] = None self._services: Optional[ServiceList] = None self._transcripts: Optional[TranscriptList] = None + @property + def custom_operators(self) -> CustomOperatorList: + if self._custom_operators is None: + self._custom_operators = CustomOperatorList(self) + return self._custom_operators + + @property + def operators(self) -> OperatorList: + if self._operators is None: + self._operators = OperatorList(self) + return self._operators + + @property + def operator_attachment(self) -> OperatorAttachmentList: + if self._operator_attachment is None: + self._operator_attachment = OperatorAttachmentList(self) + return self._operator_attachment + + @property + def operator_attachments(self) -> OperatorAttachmentsList: + if self._operator_attachments is None: + self._operator_attachments = OperatorAttachmentsList(self) + return self._operator_attachments + + @property + def operator_type(self) -> OperatorTypeList: + if self._operator_type is None: + self._operator_type = OperatorTypeList(self) + return self._operator_type + + @property + def prebuilt_operators(self) -> PrebuiltOperatorList: + if self._prebuilt_operators is None: + self._prebuilt_operators = PrebuiltOperatorList(self) + return self._prebuilt_operators + @property def services(self) -> ServiceList: if self._services is None: diff --git a/twilio/rest/intelligence/v2/custom_operator.py b/twilio/rest/intelligence/v2/custom_operator.py new file mode 100644 index 0000000000..6966dc5d08 --- /dev/null +++ b/twilio/rest/intelligence/v2/custom_operator.py @@ -0,0 +1,682 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Intelligence + 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 datetime import datetime +from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator +from twilio.base import deserialize, serialize, values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version +from twilio.base.page import Page + + +class CustomOperatorInstance(InstanceResource): + + class Availability(object): + INTERNAL = "internal" + BETA = "beta" + PUBLIC = "public" + RETIRED = "retired" + + """ + :ivar account_sid: The unique SID identifier of the Account the Custom Operator belongs to. + :ivar sid: A 34 character string that uniquely identifies this Custom Operator. + :ivar friendly_name: A human-readable name of this resource, up to 64 characters. + :ivar description: A human-readable description of this resource, longer than the friendly name. + :ivar author: The creator of the Custom Operator. Custom Operators can only be created by a Twilio Account. + :ivar operator_type: Operator Type for this Operator. References an existing Operator Type resource. + :ivar version: Numeric Custom Operator version. Incremented with each update on the resource, used to ensure integrity when updating the Custom Operator. + :ivar availability: + :ivar config: Operator configuration, following the schema defined by the Operator Type. Only available on Operators created by the Account. + :ivar date_created: The date that this Custom Operator was created, given in ISO 8601 format. + :ivar date_updated: The date that this Custom Operator was updated, given in ISO 8601 format. + :ivar url: The URL of this resource. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): + super().__init__(version) + + self.account_sid: Optional[str] = payload.get("account_sid") + self.sid: Optional[str] = payload.get("sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.description: Optional[str] = payload.get("description") + self.author: Optional[str] = payload.get("author") + self.operator_type: Optional[str] = payload.get("operator_type") + self.version: Optional[int] = deserialize.integer(payload.get("version")) + self.availability: Optional["CustomOperatorInstance.Availability"] = ( + payload.get("availability") + ) + self.config: Optional[Dict[str, object]] = payload.get("config") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.url: Optional[str] = payload.get("url") + + self._solution = { + "sid": sid or self.sid, + } + self._context: Optional[CustomOperatorContext] = None + + @property + def _proxy(self) -> "CustomOperatorContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: CustomOperatorContext for this CustomOperatorInstance + """ + if self._context is None: + self._context = CustomOperatorContext( + self._version, + sid=self._solution["sid"], + ) + return self._context + + def delete(self) -> bool: + """ + Deletes the CustomOperatorInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the CustomOperatorInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def fetch(self) -> "CustomOperatorInstance": + """ + Fetch the CustomOperatorInstance + + + :returns: The fetched CustomOperatorInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "CustomOperatorInstance": + """ + Asynchronous coroutine to fetch the CustomOperatorInstance + + + :returns: The fetched CustomOperatorInstance + """ + return await self._proxy.fetch_async() + + def update( + self, + friendly_name: str, + config: object, + if_match: Union[str, object] = values.unset, + ) -> "CustomOperatorInstance": + """ + Update the CustomOperatorInstance + + :param friendly_name: A human-readable name of this resource, up to 64 characters. + :param config: Operator configuration, following the schema defined by the Operator Type. + :param if_match: The If-Match HTTP request header + + :returns: The updated CustomOperatorInstance + """ + return self._proxy.update( + friendly_name=friendly_name, + config=config, + if_match=if_match, + ) + + async def update_async( + self, + friendly_name: str, + config: object, + if_match: Union[str, object] = values.unset, + ) -> "CustomOperatorInstance": + """ + Asynchronous coroutine to update the CustomOperatorInstance + + :param friendly_name: A human-readable name of this resource, up to 64 characters. + :param config: Operator configuration, following the schema defined by the Operator Type. + :param if_match: The If-Match HTTP request header + + :returns: The updated CustomOperatorInstance + """ + return await self._proxy.update_async( + friendly_name=friendly_name, + config=config, + if_match=if_match, + ) + + 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 CustomOperatorContext(InstanceContext): + + def __init__(self, version: Version, sid: str): + """ + Initialize the CustomOperatorContext + + :param version: Version that contains the resource + :param sid: A 34 character string that uniquely identifies this Custom Operator. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "sid": sid, + } + self._uri = "/Operators/Custom/{sid}".format(**self._solution) + + def delete(self) -> bool: + """ + Deletes the CustomOperatorInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._version.delete( + method="DELETE", + uri=self._uri, + ) + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the CustomOperatorInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._version.delete_async( + method="DELETE", + uri=self._uri, + ) + + def fetch(self) -> CustomOperatorInstance: + """ + Fetch the CustomOperatorInstance + + + :returns: The fetched CustomOperatorInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return CustomOperatorInstance( + self._version, + payload, + sid=self._solution["sid"], + ) + + async def fetch_async(self) -> CustomOperatorInstance: + """ + Asynchronous coroutine to fetch the CustomOperatorInstance + + + :returns: The fetched CustomOperatorInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return CustomOperatorInstance( + self._version, + payload, + sid=self._solution["sid"], + ) + + def update( + self, + friendly_name: str, + config: object, + if_match: Union[str, object] = values.unset, + ) -> CustomOperatorInstance: + """ + Update the CustomOperatorInstance + + :param friendly_name: A human-readable name of this resource, up to 64 characters. + :param config: Operator configuration, following the schema defined by the Operator Type. + :param if_match: The If-Match HTTP request header + + :returns: The updated CustomOperatorInstance + """ + data = values.of( + { + "FriendlyName": friendly_name, + "Config": serialize.object(config), + } + ) + headers = values.of( + { + "If-Match": if_match, + } + ) + + payload = self._version.update( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return CustomOperatorInstance(self._version, payload, sid=self._solution["sid"]) + + async def update_async( + self, + friendly_name: str, + config: object, + if_match: Union[str, object] = values.unset, + ) -> CustomOperatorInstance: + """ + Asynchronous coroutine to update the CustomOperatorInstance + + :param friendly_name: A human-readable name of this resource, up to 64 characters. + :param config: Operator configuration, following the schema defined by the Operator Type. + :param if_match: The If-Match HTTP request header + + :returns: The updated CustomOperatorInstance + """ + data = values.of( + { + "FriendlyName": friendly_name, + "Config": serialize.object(config), + } + ) + headers = values.of( + { + "If-Match": if_match, + } + ) + + payload = await self._version.update_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return CustomOperatorInstance(self._version, payload, sid=self._solution["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 CustomOperatorPage(Page): + + def get_instance(self, payload: Dict[str, Any]) -> CustomOperatorInstance: + """ + Build an instance of CustomOperatorInstance + + :param payload: Payload response from the API + """ + return CustomOperatorInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class CustomOperatorList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the CustomOperatorList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/Operators/Custom" + + def create( + self, friendly_name: str, operator_type: str, config: object + ) -> CustomOperatorInstance: + """ + Create the CustomOperatorInstance + + :param friendly_name: A human readable description of the new Operator, up to 64 characters. + :param operator_type: Operator Type for this Operator. References an existing Operator Type resource. + :param config: Operator configuration, following the schema defined by the Operator Type. + + :returns: The created CustomOperatorInstance + """ + + data = values.of( + { + "FriendlyName": friendly_name, + "OperatorType": operator_type, + "Config": serialize.object(config), + } + ) + + payload = self._version.create( + method="POST", + uri=self._uri, + data=data, + ) + + return CustomOperatorInstance(self._version, payload) + + async def create_async( + self, friendly_name: str, operator_type: str, config: object + ) -> CustomOperatorInstance: + """ + Asynchronously create the CustomOperatorInstance + + :param friendly_name: A human readable description of the new Operator, up to 64 characters. + :param operator_type: Operator Type for this Operator. References an existing Operator Type resource. + :param config: Operator configuration, following the schema defined by the Operator Type. + + :returns: The created CustomOperatorInstance + """ + + data = values.of( + { + "FriendlyName": friendly_name, + "OperatorType": operator_type, + "Config": serialize.object(config), + } + ) + + payload = await self._version.create_async( + method="POST", + uri=self._uri, + data=data, + ) + + return CustomOperatorInstance(self._version, payload) + + def stream( + self, + availability: Union[ + "CustomOperatorInstance.Availability", object + ] = values.unset, + language_code: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[CustomOperatorInstance]: + """ + Streams CustomOperatorInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param "CustomOperatorInstance.Availability" availability: Returns Custom Operators with the provided availability type. Possible values: internal, beta, public, retired. + :param str language_code: Returns Custom Operators that support the provided language code. + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = self.page( + availability=availability, + language_code=language_code, + page_size=limits["page_size"], + ) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + availability: Union[ + "CustomOperatorInstance.Availability", object + ] = values.unset, + language_code: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[CustomOperatorInstance]: + """ + Asynchronously streams CustomOperatorInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param "CustomOperatorInstance.Availability" availability: Returns Custom Operators with the provided availability type. Possible values: internal, beta, public, retired. + :param str language_code: Returns Custom Operators that support the provided language code. + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = await self.page_async( + availability=availability, + language_code=language_code, + page_size=limits["page_size"], + ) + + return self._version.stream_async(page, limits["limit"]) + + def list( + self, + availability: Union[ + "CustomOperatorInstance.Availability", object + ] = values.unset, + language_code: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[CustomOperatorInstance]: + """ + Lists CustomOperatorInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param "CustomOperatorInstance.Availability" availability: Returns Custom Operators with the provided availability type. Possible values: internal, beta, public, retired. + :param str language_code: Returns Custom Operators that support the provided language code. + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return list( + self.stream( + availability=availability, + language_code=language_code, + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + availability: Union[ + "CustomOperatorInstance.Availability", object + ] = values.unset, + language_code: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[CustomOperatorInstance]: + """ + Asynchronously lists CustomOperatorInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param "CustomOperatorInstance.Availability" availability: Returns Custom Operators with the provided availability type. Possible values: internal, beta, public, retired. + :param str language_code: Returns Custom Operators that support the provided language code. + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return [ + record + async for record in await self.stream_async( + availability=availability, + language_code=language_code, + limit=limit, + page_size=page_size, + ) + ] + + def page( + self, + availability: Union[ + "CustomOperatorInstance.Availability", object + ] = values.unset, + language_code: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> CustomOperatorPage: + """ + Retrieve a single page of CustomOperatorInstance records from the API. + Request is executed immediately + + :param availability: Returns Custom Operators with the provided availability type. Possible values: internal, beta, public, retired. + :param language_code: Returns Custom Operators that support the provided language code. + :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 + + :returns: Page of CustomOperatorInstance + """ + data = values.of( + { + "Availability": availability, + "LanguageCode": language_code, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = self._version.page(method="GET", uri=self._uri, params=data) + return CustomOperatorPage(self._version, response) + + async def page_async( + self, + availability: Union[ + "CustomOperatorInstance.Availability", object + ] = values.unset, + language_code: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> CustomOperatorPage: + """ + Asynchronously retrieve a single page of CustomOperatorInstance records from the API. + Request is executed immediately + + :param availability: Returns Custom Operators with the provided availability type. Possible values: internal, beta, public, retired. + :param language_code: Returns Custom Operators that support the provided language code. + :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 + + :returns: Page of CustomOperatorInstance + """ + data = values.of( + { + "Availability": availability, + "LanguageCode": language_code, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = await self._version.page_async( + method="GET", uri=self._uri, params=data + ) + return CustomOperatorPage(self._version, response) + + def get_page(self, target_url: str) -> CustomOperatorPage: + """ + Retrieve a specific page of CustomOperatorInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of CustomOperatorInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return CustomOperatorPage(self._version, response) + + async def get_page_async(self, target_url: str) -> CustomOperatorPage: + """ + Asynchronously retrieve a specific page of CustomOperatorInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of CustomOperatorInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return CustomOperatorPage(self._version, response) + + def get(self, sid: str) -> CustomOperatorContext: + """ + Constructs a CustomOperatorContext + + :param sid: A 34 character string that uniquely identifies this Custom Operator. + """ + return CustomOperatorContext(self._version, sid=sid) + + def __call__(self, sid: str) -> CustomOperatorContext: + """ + Constructs a CustomOperatorContext + + :param sid: A 34 character string that uniquely identifies this Custom Operator. + """ + return CustomOperatorContext(self._version, sid=sid) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/intelligence/v2/operator.py b/twilio/rest/intelligence/v2/operator.py new file mode 100644 index 0000000000..6618c4a6c0 --- /dev/null +++ b/twilio/rest/intelligence/v2/operator.py @@ -0,0 +1,462 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Intelligence + 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 datetime import datetime +from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator +from twilio.base import deserialize, values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version +from twilio.base.page import Page + + +class OperatorInstance(InstanceResource): + + class Availability(object): + INTERNAL = "internal" + BETA = "beta" + PUBLIC = "public" + RETIRED = "retired" + + """ + :ivar account_sid: The unique SID identifier of the Account the Operator belongs to. + :ivar sid: A 34 character string that uniquely identifies this Operator. + :ivar friendly_name: A human-readable name of this resource, up to 64 characters. + :ivar description: A human-readable description of this resource, longer than the friendly name. + :ivar author: The creator of the Operator. Either Twilio or the creating Account. + :ivar operator_type: Operator Type for this Operator. References an existing Operator Type resource. + :ivar version: Numeric Operator version. Incremented with each update on the resource, used to ensure integrity when updating the Operator. + :ivar availability: + :ivar config: Operator configuration, following the schema defined by the Operator Type. Only available on Custom Operators created by the Account. + :ivar date_created: The date that this Operator was created, given in ISO 8601 format. + :ivar date_updated: The date that this Operator was updated, given in ISO 8601 format. + :ivar url: The URL of this resource. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): + super().__init__(version) + + self.account_sid: Optional[str] = payload.get("account_sid") + self.sid: Optional[str] = payload.get("sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.description: Optional[str] = payload.get("description") + self.author: Optional[str] = payload.get("author") + self.operator_type: Optional[str] = payload.get("operator_type") + self.version: Optional[int] = deserialize.integer(payload.get("version")) + self.availability: Optional["OperatorInstance.Availability"] = payload.get( + "availability" + ) + self.config: Optional[Dict[str, object]] = payload.get("config") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.url: Optional[str] = payload.get("url") + + self._solution = { + "sid": sid or self.sid, + } + self._context: Optional[OperatorContext] = None + + @property + def _proxy(self) -> "OperatorContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: OperatorContext for this OperatorInstance + """ + if self._context is None: + self._context = OperatorContext( + self._version, + sid=self._solution["sid"], + ) + return self._context + + def fetch(self) -> "OperatorInstance": + """ + Fetch the OperatorInstance + + + :returns: The fetched OperatorInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "OperatorInstance": + """ + Asynchronous coroutine to fetch the OperatorInstance + + + :returns: The fetched OperatorInstance + """ + return await self._proxy.fetch_async() + + 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 OperatorContext(InstanceContext): + + def __init__(self, version: Version, sid: str): + """ + Initialize the OperatorContext + + :param version: Version that contains the resource + :param sid: A 34 character string that uniquely identifies this Operator. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "sid": sid, + } + self._uri = "/Operators/{sid}".format(**self._solution) + + def fetch(self) -> OperatorInstance: + """ + Fetch the OperatorInstance + + + :returns: The fetched OperatorInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return OperatorInstance( + self._version, + payload, + sid=self._solution["sid"], + ) + + async def fetch_async(self) -> OperatorInstance: + """ + Asynchronous coroutine to fetch the OperatorInstance + + + :returns: The fetched OperatorInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return OperatorInstance( + self._version, + payload, + sid=self._solution["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 OperatorPage(Page): + + def get_instance(self, payload: Dict[str, Any]) -> OperatorInstance: + """ + Build an instance of OperatorInstance + + :param payload: Payload response from the API + """ + return OperatorInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class OperatorList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the OperatorList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/Operators" + + def stream( + self, + availability: Union["OperatorInstance.Availability", object] = values.unset, + language_code: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[OperatorInstance]: + """ + Streams OperatorInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param "OperatorInstance.Availability" availability: Returns Operators with the provided availability type. Possible values: internal, beta, public, retired. + :param str language_code: Returns Operators that support the provided language code. + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = self.page( + availability=availability, + language_code=language_code, + page_size=limits["page_size"], + ) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + availability: Union["OperatorInstance.Availability", object] = values.unset, + language_code: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[OperatorInstance]: + """ + Asynchronously streams OperatorInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param "OperatorInstance.Availability" availability: Returns Operators with the provided availability type. Possible values: internal, beta, public, retired. + :param str language_code: Returns Operators that support the provided language code. + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = await self.page_async( + availability=availability, + language_code=language_code, + page_size=limits["page_size"], + ) + + return self._version.stream_async(page, limits["limit"]) + + def list( + self, + availability: Union["OperatorInstance.Availability", object] = values.unset, + language_code: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[OperatorInstance]: + """ + Lists OperatorInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param "OperatorInstance.Availability" availability: Returns Operators with the provided availability type. Possible values: internal, beta, public, retired. + :param str language_code: Returns Operators that support the provided language code. + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return list( + self.stream( + availability=availability, + language_code=language_code, + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + availability: Union["OperatorInstance.Availability", object] = values.unset, + language_code: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[OperatorInstance]: + """ + Asynchronously lists OperatorInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param "OperatorInstance.Availability" availability: Returns Operators with the provided availability type. Possible values: internal, beta, public, retired. + :param str language_code: Returns Operators that support the provided language code. + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return [ + record + async for record in await self.stream_async( + availability=availability, + language_code=language_code, + limit=limit, + page_size=page_size, + ) + ] + + def page( + self, + availability: Union["OperatorInstance.Availability", object] = values.unset, + language_code: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> OperatorPage: + """ + Retrieve a single page of OperatorInstance records from the API. + Request is executed immediately + + :param availability: Returns Operators with the provided availability type. Possible values: internal, beta, public, retired. + :param language_code: Returns Operators that support the provided language code. + :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 + + :returns: Page of OperatorInstance + """ + data = values.of( + { + "Availability": availability, + "LanguageCode": language_code, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = self._version.page(method="GET", uri=self._uri, params=data) + return OperatorPage(self._version, response) + + async def page_async( + self, + availability: Union["OperatorInstance.Availability", object] = values.unset, + language_code: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> OperatorPage: + """ + Asynchronously retrieve a single page of OperatorInstance records from the API. + Request is executed immediately + + :param availability: Returns Operators with the provided availability type. Possible values: internal, beta, public, retired. + :param language_code: Returns Operators that support the provided language code. + :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 + + :returns: Page of OperatorInstance + """ + data = values.of( + { + "Availability": availability, + "LanguageCode": language_code, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = await self._version.page_async( + method="GET", uri=self._uri, params=data + ) + return OperatorPage(self._version, response) + + def get_page(self, target_url: str) -> OperatorPage: + """ + Retrieve a specific page of OperatorInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of OperatorInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return OperatorPage(self._version, response) + + async def get_page_async(self, target_url: str) -> OperatorPage: + """ + Asynchronously retrieve a specific page of OperatorInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of OperatorInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return OperatorPage(self._version, response) + + def get(self, sid: str) -> OperatorContext: + """ + Constructs a OperatorContext + + :param sid: A 34 character string that uniquely identifies this Operator. + """ + return OperatorContext(self._version, sid=sid) + + def __call__(self, sid: str) -> OperatorContext: + """ + Constructs a OperatorContext + + :param sid: A 34 character string that uniquely identifies this Operator. + """ + return OperatorContext(self._version, sid=sid) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/intelligence/v2/operator_attachment.py b/twilio/rest/intelligence/v2/operator_attachment.py new file mode 100644 index 0000000000..4ab8b48c10 --- /dev/null +++ b/twilio/rest/intelligence/v2/operator_attachment.py @@ -0,0 +1,245 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Intelligence + 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 import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class OperatorAttachmentInstance(InstanceResource): + """ + :ivar service_sid: The unique SID identifier of the Service. + :ivar operator_sid: The unique SID identifier of the Operator. + :ivar url: The URL of this resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + service_sid: Optional[str] = None, + operator_sid: Optional[str] = None, + ): + super().__init__(version) + + self.service_sid: Optional[str] = payload.get("service_sid") + self.operator_sid: Optional[str] = payload.get("operator_sid") + self.url: Optional[str] = payload.get("url") + + self._solution = { + "service_sid": service_sid or self.service_sid, + "operator_sid": operator_sid or self.operator_sid, + } + self._context: Optional[OperatorAttachmentContext] = None + + @property + def _proxy(self) -> "OperatorAttachmentContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: OperatorAttachmentContext for this OperatorAttachmentInstance + """ + if self._context is None: + self._context = OperatorAttachmentContext( + self._version, + service_sid=self._solution["service_sid"], + operator_sid=self._solution["operator_sid"], + ) + return self._context + + def create(self) -> "OperatorAttachmentInstance": + """ + Create the OperatorAttachmentInstance + + + :returns: The created OperatorAttachmentInstance + """ + return self._proxy.create() + + async def create_async(self) -> "OperatorAttachmentInstance": + """ + Asynchronous coroutine to create the OperatorAttachmentInstance + + + :returns: The created OperatorAttachmentInstance + """ + return await self._proxy.create_async() + + def delete(self) -> bool: + """ + Deletes the OperatorAttachmentInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the OperatorAttachmentInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + 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 OperatorAttachmentContext(InstanceContext): + + def __init__(self, version: Version, service_sid: str, operator_sid: str): + """ + Initialize the OperatorAttachmentContext + + :param version: Version that contains the resource + :param service_sid: The unique SID identifier of the Service. + :param operator_sid: The unique SID identifier of the Operator. Allows both Custom and Pre-built Operators. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "service_sid": service_sid, + "operator_sid": operator_sid, + } + self._uri = "/Services/{service_sid}/Operators/{operator_sid}".format( + **self._solution + ) + + def create(self) -> OperatorAttachmentInstance: + """ + Create the OperatorAttachmentInstance + + + :returns: The created OperatorAttachmentInstance + """ + data = values.of({}) + + payload = self._version.create(method="POST", uri=self._uri, data=data) + + return OperatorAttachmentInstance( + self._version, + payload, + service_sid=self._solution["service_sid"], + operator_sid=self._solution["operator_sid"], + ) + + async def create_async(self) -> OperatorAttachmentInstance: + """ + Asynchronous coroutine to create the OperatorAttachmentInstance + + + :returns: The created OperatorAttachmentInstance + """ + data = values.of({}) + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data + ) + + return OperatorAttachmentInstance( + self._version, + payload, + service_sid=self._solution["service_sid"], + operator_sid=self._solution["operator_sid"], + ) + + def delete(self) -> bool: + """ + Deletes the OperatorAttachmentInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._version.delete( + method="DELETE", + uri=self._uri, + ) + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the OperatorAttachmentInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._version.delete_async( + method="DELETE", + uri=self._uri, + ) + + 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 OperatorAttachmentList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the OperatorAttachmentList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + def get(self, service_sid: str, operator_sid: str) -> OperatorAttachmentContext: + """ + Constructs a OperatorAttachmentContext + + :param service_sid: The unique SID identifier of the Service. + :param operator_sid: The unique SID identifier of the Operator. Allows both Custom and Pre-built Operators. + """ + return OperatorAttachmentContext( + self._version, service_sid=service_sid, operator_sid=operator_sid + ) + + def __call__( + self, service_sid: str, operator_sid: str + ) -> OperatorAttachmentContext: + """ + Constructs a OperatorAttachmentContext + + :param service_sid: The unique SID identifier of the Service. + :param operator_sid: The unique SID identifier of the Operator. Allows both Custom and Pre-built Operators. + """ + return OperatorAttachmentContext( + self._version, service_sid=service_sid, operator_sid=operator_sid + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/intelligence/v2/operator_attachments.py b/twilio/rest/intelligence/v2/operator_attachments.py new file mode 100644 index 0000000000..2500ef7224 --- /dev/null +++ b/twilio/rest/intelligence/v2/operator_attachments.py @@ -0,0 +1,187 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Intelligence + 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_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class OperatorAttachmentsInstance(InstanceResource): + """ + :ivar service_sid: The unique SID identifier of the Service. + :ivar operator_sids: List of Operator SIDs attached to the service. Includes both Custom and Pre-built Operators. + :ivar url: The URL of this resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + service_sid: Optional[str] = None, + ): + super().__init__(version) + + self.service_sid: Optional[str] = payload.get("service_sid") + self.operator_sids: Optional[List[str]] = payload.get("operator_sids") + self.url: Optional[str] = payload.get("url") + + self._solution = { + "service_sid": service_sid or self.service_sid, + } + self._context: Optional[OperatorAttachmentsContext] = None + + @property + def _proxy(self) -> "OperatorAttachmentsContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: OperatorAttachmentsContext for this OperatorAttachmentsInstance + """ + if self._context is None: + self._context = OperatorAttachmentsContext( + self._version, + service_sid=self._solution["service_sid"], + ) + return self._context + + def fetch(self) -> "OperatorAttachmentsInstance": + """ + Fetch the OperatorAttachmentsInstance + + + :returns: The fetched OperatorAttachmentsInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "OperatorAttachmentsInstance": + """ + Asynchronous coroutine to fetch the OperatorAttachmentsInstance + + + :returns: The fetched OperatorAttachmentsInstance + """ + return await self._proxy.fetch_async() + + 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 OperatorAttachmentsContext(InstanceContext): + + def __init__(self, version: Version, service_sid: str): + """ + Initialize the OperatorAttachmentsContext + + :param version: Version that contains the resource + :param service_sid: The unique SID identifier of the Service. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "service_sid": service_sid, + } + self._uri = "/Services/{service_sid}/Operators".format(**self._solution) + + def fetch(self) -> OperatorAttachmentsInstance: + """ + Fetch the OperatorAttachmentsInstance + + + :returns: The fetched OperatorAttachmentsInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return OperatorAttachmentsInstance( + self._version, + payload, + service_sid=self._solution["service_sid"], + ) + + async def fetch_async(self) -> OperatorAttachmentsInstance: + """ + Asynchronous coroutine to fetch the OperatorAttachmentsInstance + + + :returns: The fetched OperatorAttachmentsInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return OperatorAttachmentsInstance( + self._version, + payload, + service_sid=self._solution["service_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 OperatorAttachmentsList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the OperatorAttachmentsList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + def get(self, service_sid: str) -> OperatorAttachmentsContext: + """ + Constructs a OperatorAttachmentsContext + + :param service_sid: The unique SID identifier of the Service. + """ + return OperatorAttachmentsContext(self._version, service_sid=service_sid) + + def __call__(self, service_sid: str) -> OperatorAttachmentsContext: + """ + Constructs a OperatorAttachmentsContext + + :param service_sid: The unique SID identifier of the Service. + """ + return OperatorAttachmentsContext(self._version, service_sid=service_sid) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/intelligence/v2/operator_type.py b/twilio/rest/intelligence/v2/operator_type.py new file mode 100644 index 0000000000..9884df0aee --- /dev/null +++ b/twilio/rest/intelligence/v2/operator_type.py @@ -0,0 +1,443 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Intelligence + 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 datetime import datetime +from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator +from twilio.base import deserialize, values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version +from twilio.base.page import Page + + +class OperatorTypeInstance(InstanceResource): + + class Availability(object): + INTERNAL = "internal" + BETA = "beta" + PUBLIC = "public" + RETIRED = "retired" + + class OutputType(object): + TEXT_CLASSIFICATION = "text-classification" + TEXT_EXTRACTION = "text-extraction" + TEXT_EXTRACTION_NORMALIZED = "text-extraction-normalized" + TEXT_GENERATION = "text-generation" + + class Provider(object): + TWILIO = "twilio" + AMAZON = "amazon" + OPENAI = "openai" + + """ + :ivar name: A unique name that references an Operator's Operator Type. + :ivar sid: A 34 character string that uniquely identifies this Operator Type. + :ivar friendly_name: A human-readable name of this resource, up to 64 characters. + :ivar description: A human-readable description of this resource, longer than the friendly name. + :ivar docs_link: Additional documentation for the Operator Type. + :ivar output_type: + :ivar supported_languages: List of languages this Operator Type supports. + :ivar provider: + :ivar availability: + :ivar configurable: Operators can be created from configurable Operator Types. + :ivar config_schema: JSON Schema for configuring an Operator with this Operator Type. Following https://json-schema.org/ + :ivar date_created: The date that this Operator Type was created, given in ISO 8601 format. + :ivar date_updated: The date that this Operator Type was updated, given in ISO 8601 format. + :ivar url: The URL of this resource. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): + super().__init__(version) + + self.name: Optional[str] = payload.get("name") + self.sid: Optional[str] = payload.get("sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.description: Optional[str] = payload.get("description") + self.docs_link: Optional[str] = payload.get("docs_link") + self.output_type: Optional["OperatorTypeInstance.OutputType"] = payload.get( + "output_type" + ) + self.supported_languages: Optional[List[str]] = payload.get( + "supported_languages" + ) + self.provider: Optional["OperatorTypeInstance.Provider"] = payload.get( + "provider" + ) + self.availability: Optional["OperatorTypeInstance.Availability"] = payload.get( + "availability" + ) + self.configurable: Optional[bool] = payload.get("configurable") + self.config_schema: Optional[Dict[str, object]] = payload.get("config_schema") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.url: Optional[str] = payload.get("url") + + self._solution = { + "sid": sid or self.sid, + } + self._context: Optional[OperatorTypeContext] = None + + @property + def _proxy(self) -> "OperatorTypeContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: OperatorTypeContext for this OperatorTypeInstance + """ + if self._context is None: + self._context = OperatorTypeContext( + self._version, + sid=self._solution["sid"], + ) + return self._context + + def fetch(self) -> "OperatorTypeInstance": + """ + Fetch the OperatorTypeInstance + + + :returns: The fetched OperatorTypeInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "OperatorTypeInstance": + """ + Asynchronous coroutine to fetch the OperatorTypeInstance + + + :returns: The fetched OperatorTypeInstance + """ + return await self._proxy.fetch_async() + + 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 OperatorTypeContext(InstanceContext): + + def __init__(self, version: Version, sid: str): + """ + Initialize the OperatorTypeContext + + :param version: Version that contains the resource + :param sid: A 34 character string that uniquely identifies this Operator Type. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "sid": sid, + } + self._uri = "/OperatorTypes/{sid}".format(**self._solution) + + def fetch(self) -> OperatorTypeInstance: + """ + Fetch the OperatorTypeInstance + + + :returns: The fetched OperatorTypeInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return OperatorTypeInstance( + self._version, + payload, + sid=self._solution["sid"], + ) + + async def fetch_async(self) -> OperatorTypeInstance: + """ + Asynchronous coroutine to fetch the OperatorTypeInstance + + + :returns: The fetched OperatorTypeInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return OperatorTypeInstance( + self._version, + payload, + sid=self._solution["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 OperatorTypePage(Page): + + def get_instance(self, payload: Dict[str, Any]) -> OperatorTypeInstance: + """ + Build an instance of OperatorTypeInstance + + :param payload: Payload response from the API + """ + return OperatorTypeInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class OperatorTypeList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the OperatorTypeList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/OperatorTypes" + + def stream( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[OperatorTypeInstance]: + """ + Streams OperatorTypeInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = self.page(page_size=limits["page_size"]) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[OperatorTypeInstance]: + """ + Asynchronously streams OperatorTypeInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = await self.page_async(page_size=limits["page_size"]) + + return self._version.stream_async(page, limits["limit"]) + + def list( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[OperatorTypeInstance]: + """ + Lists OperatorTypeInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return list( + self.stream( + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[OperatorTypeInstance]: + """ + Asynchronously lists OperatorTypeInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return [ + record + async for record in await self.stream_async( + limit=limit, + page_size=page_size, + ) + ] + + def page( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> OperatorTypePage: + """ + Retrieve a single page of OperatorTypeInstance records from the API. + Request is executed immediately + + :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 + + :returns: Page of OperatorTypeInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = self._version.page(method="GET", uri=self._uri, params=data) + return OperatorTypePage(self._version, response) + + async def page_async( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> OperatorTypePage: + """ + Asynchronously retrieve a single page of OperatorTypeInstance records from the API. + Request is executed immediately + + :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 + + :returns: Page of OperatorTypeInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = await self._version.page_async( + method="GET", uri=self._uri, params=data + ) + return OperatorTypePage(self._version, response) + + def get_page(self, target_url: str) -> OperatorTypePage: + """ + Retrieve a specific page of OperatorTypeInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of OperatorTypeInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return OperatorTypePage(self._version, response) + + async def get_page_async(self, target_url: str) -> OperatorTypePage: + """ + Asynchronously retrieve a specific page of OperatorTypeInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of OperatorTypeInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return OperatorTypePage(self._version, response) + + def get(self, sid: str) -> OperatorTypeContext: + """ + Constructs a OperatorTypeContext + + :param sid: A 34 character string that uniquely identifies this Operator Type. + """ + return OperatorTypeContext(self._version, sid=sid) + + def __call__(self, sid: str) -> OperatorTypeContext: + """ + Constructs a OperatorTypeContext + + :param sid: A 34 character string that uniquely identifies this Operator Type. + """ + return OperatorTypeContext(self._version, sid=sid) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/intelligence/v2/prebuilt_operator.py b/twilio/rest/intelligence/v2/prebuilt_operator.py new file mode 100644 index 0000000000..e00ceecac5 --- /dev/null +++ b/twilio/rest/intelligence/v2/prebuilt_operator.py @@ -0,0 +1,474 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Intelligence + 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 datetime import datetime +from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator +from twilio.base import deserialize, values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version +from twilio.base.page import Page + + +class PrebuiltOperatorInstance(InstanceResource): + + class Availability(object): + INTERNAL = "internal" + BETA = "beta" + PUBLIC = "public" + RETIRED = "retired" + + """ + :ivar account_sid: The unique SID identifier of the Account the Pre-built Operator belongs to. + :ivar sid: A 34 character string that uniquely identifies this Pre-built Operator. + :ivar friendly_name: A human-readable name of this resource, up to 64 characters. + :ivar description: A human-readable description of this resource, longer than the friendly name. + :ivar author: The creator of the Operator. Pre-built Operators can only be created by Twilio. + :ivar operator_type: Operator Type for this Operator. References an existing Operator Type resource. + :ivar version: Numeric Operator version. Incremented with each update on the resource, used to ensure integrity when updating the Operator. + :ivar availability: + :ivar config: Operator configuration, following the schema defined by the Operator Type. Only available on Custom Operators created by the Account, will be empty for Pre-Built Operators. + :ivar date_created: The date that this Pre-built Operator was created, given in ISO 8601 format. + :ivar date_updated: The date that this Pre-built Operator was updated, given in ISO 8601 format. + :ivar url: The URL of this resource. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): + super().__init__(version) + + self.account_sid: Optional[str] = payload.get("account_sid") + self.sid: Optional[str] = payload.get("sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.description: Optional[str] = payload.get("description") + self.author: Optional[str] = payload.get("author") + self.operator_type: Optional[str] = payload.get("operator_type") + self.version: Optional[int] = deserialize.integer(payload.get("version")) + self.availability: Optional["PrebuiltOperatorInstance.Availability"] = ( + payload.get("availability") + ) + self.config: Optional[Dict[str, object]] = payload.get("config") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.url: Optional[str] = payload.get("url") + + self._solution = { + "sid": sid or self.sid, + } + self._context: Optional[PrebuiltOperatorContext] = None + + @property + def _proxy(self) -> "PrebuiltOperatorContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: PrebuiltOperatorContext for this PrebuiltOperatorInstance + """ + if self._context is None: + self._context = PrebuiltOperatorContext( + self._version, + sid=self._solution["sid"], + ) + return self._context + + def fetch(self) -> "PrebuiltOperatorInstance": + """ + Fetch the PrebuiltOperatorInstance + + + :returns: The fetched PrebuiltOperatorInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "PrebuiltOperatorInstance": + """ + Asynchronous coroutine to fetch the PrebuiltOperatorInstance + + + :returns: The fetched PrebuiltOperatorInstance + """ + return await self._proxy.fetch_async() + + 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 PrebuiltOperatorContext(InstanceContext): + + def __init__(self, version: Version, sid: str): + """ + Initialize the PrebuiltOperatorContext + + :param version: Version that contains the resource + :param sid: A 34 character string that uniquely identifies this Pre-built Operator. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "sid": sid, + } + self._uri = "/Operators/PreBuilt/{sid}".format(**self._solution) + + def fetch(self) -> PrebuiltOperatorInstance: + """ + Fetch the PrebuiltOperatorInstance + + + :returns: The fetched PrebuiltOperatorInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return PrebuiltOperatorInstance( + self._version, + payload, + sid=self._solution["sid"], + ) + + async def fetch_async(self) -> PrebuiltOperatorInstance: + """ + Asynchronous coroutine to fetch the PrebuiltOperatorInstance + + + :returns: The fetched PrebuiltOperatorInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return PrebuiltOperatorInstance( + self._version, + payload, + sid=self._solution["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 PrebuiltOperatorPage(Page): + + def get_instance(self, payload: Dict[str, Any]) -> PrebuiltOperatorInstance: + """ + Build an instance of PrebuiltOperatorInstance + + :param payload: Payload response from the API + """ + return PrebuiltOperatorInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class PrebuiltOperatorList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the PrebuiltOperatorList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/Operators/PreBuilt" + + def stream( + self, + availability: Union[ + "PrebuiltOperatorInstance.Availability", object + ] = values.unset, + language_code: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[PrebuiltOperatorInstance]: + """ + Streams PrebuiltOperatorInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param "PrebuiltOperatorInstance.Availability" availability: Returns Pre-built Operators with the provided availability type. Possible values: internal, beta, public, retired. + :param str language_code: Returns Pre-built Operators that support the provided language code. + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = self.page( + availability=availability, + language_code=language_code, + page_size=limits["page_size"], + ) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + availability: Union[ + "PrebuiltOperatorInstance.Availability", object + ] = values.unset, + language_code: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[PrebuiltOperatorInstance]: + """ + Asynchronously streams PrebuiltOperatorInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param "PrebuiltOperatorInstance.Availability" availability: Returns Pre-built Operators with the provided availability type. Possible values: internal, beta, public, retired. + :param str language_code: Returns Pre-built Operators that support the provided language code. + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = await self.page_async( + availability=availability, + language_code=language_code, + page_size=limits["page_size"], + ) + + return self._version.stream_async(page, limits["limit"]) + + def list( + self, + availability: Union[ + "PrebuiltOperatorInstance.Availability", object + ] = values.unset, + language_code: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[PrebuiltOperatorInstance]: + """ + Lists PrebuiltOperatorInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param "PrebuiltOperatorInstance.Availability" availability: Returns Pre-built Operators with the provided availability type. Possible values: internal, beta, public, retired. + :param str language_code: Returns Pre-built Operators that support the provided language code. + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return list( + self.stream( + availability=availability, + language_code=language_code, + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + availability: Union[ + "PrebuiltOperatorInstance.Availability", object + ] = values.unset, + language_code: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[PrebuiltOperatorInstance]: + """ + Asynchronously lists PrebuiltOperatorInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param "PrebuiltOperatorInstance.Availability" availability: Returns Pre-built Operators with the provided availability type. Possible values: internal, beta, public, retired. + :param str language_code: Returns Pre-built Operators that support the provided language code. + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return [ + record + async for record in await self.stream_async( + availability=availability, + language_code=language_code, + limit=limit, + page_size=page_size, + ) + ] + + def page( + self, + availability: Union[ + "PrebuiltOperatorInstance.Availability", object + ] = values.unset, + language_code: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> PrebuiltOperatorPage: + """ + Retrieve a single page of PrebuiltOperatorInstance records from the API. + Request is executed immediately + + :param availability: Returns Pre-built Operators with the provided availability type. Possible values: internal, beta, public, retired. + :param language_code: Returns Pre-built Operators that support the provided language code. + :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 + + :returns: Page of PrebuiltOperatorInstance + """ + data = values.of( + { + "Availability": availability, + "LanguageCode": language_code, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = self._version.page(method="GET", uri=self._uri, params=data) + return PrebuiltOperatorPage(self._version, response) + + async def page_async( + self, + availability: Union[ + "PrebuiltOperatorInstance.Availability", object + ] = values.unset, + language_code: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> PrebuiltOperatorPage: + """ + Asynchronously retrieve a single page of PrebuiltOperatorInstance records from the API. + Request is executed immediately + + :param availability: Returns Pre-built Operators with the provided availability type. Possible values: internal, beta, public, retired. + :param language_code: Returns Pre-built Operators that support the provided language code. + :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 + + :returns: Page of PrebuiltOperatorInstance + """ + data = values.of( + { + "Availability": availability, + "LanguageCode": language_code, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = await self._version.page_async( + method="GET", uri=self._uri, params=data + ) + return PrebuiltOperatorPage(self._version, response) + + def get_page(self, target_url: str) -> PrebuiltOperatorPage: + """ + Retrieve a specific page of PrebuiltOperatorInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of PrebuiltOperatorInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return PrebuiltOperatorPage(self._version, response) + + async def get_page_async(self, target_url: str) -> PrebuiltOperatorPage: + """ + Asynchronously retrieve a specific page of PrebuiltOperatorInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of PrebuiltOperatorInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return PrebuiltOperatorPage(self._version, response) + + def get(self, sid: str) -> PrebuiltOperatorContext: + """ + Constructs a PrebuiltOperatorContext + + :param sid: A 34 character string that uniquely identifies this Pre-built Operator. + """ + return PrebuiltOperatorContext(self._version, sid=sid) + + def __call__(self, sid: str) -> PrebuiltOperatorContext: + """ + Constructs a PrebuiltOperatorContext + + :param sid: A 34 character string that uniquely identifies this Pre-built Operator. + """ + return PrebuiltOperatorContext(self._version, sid=sid) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/intelligence/v2/service.py b/twilio/rest/intelligence/v2/service.py index d983be5b2e..7ded7b9b77 100644 --- a/twilio/rest/intelligence/v2/service.py +++ b/twilio/rest/intelligence/v2/service.py @@ -38,12 +38,13 @@ class HttpMethod(object): :ivar date_created: The date that this Service was created, given in ISO 8601 format. :ivar date_updated: The date that this Service was updated, given in ISO 8601 format. :ivar friendly_name: A human readable description of this resource, up to 64 characters. - :ivar language_code: The default language code of the audio. + :ivar language_code: The language code set during Service creation determines the Transcription language for all call recordings processed by that Service. The default is en-US if no language code is set. A Service can only support one language code, and it cannot be updated once it's set. :ivar sid: A 34 character string that uniquely identifies this Service. :ivar unique_name: Provides a unique and addressable name to be assigned to this Service, assigned by the developer, to be optionally used in addition to SID. :ivar url: The URL of this resource. :ivar webhook_url: The URL Twilio will request when executing the Webhook. :ivar webhook_http_method: + :ivar read_only_attached_operator_sids: Operator sids attached to this service, read only :ivar version: The version number of this Service. """ @@ -72,6 +73,9 @@ def __init__( self.webhook_http_method: Optional["ServiceInstance.HttpMethod"] = payload.get( "webhook_http_method" ) + self.read_only_attached_operator_sids: Optional[List[str]] = payload.get( + "read_only_attached_operator_sids" + ) self.version: Optional[int] = deserialize.integer(payload.get("version")) self._solution = { @@ -136,7 +140,6 @@ def update( auto_transcribe: Union[bool, object] = values.unset, data_logging: Union[bool, object] = values.unset, friendly_name: Union[str, object] = values.unset, - language_code: Union[str, object] = values.unset, unique_name: Union[str, object] = values.unset, auto_redaction: Union[bool, object] = values.unset, media_redaction: Union[bool, object] = values.unset, @@ -150,7 +153,6 @@ def update( :param auto_transcribe: Instructs the Speech Recognition service to automatically transcribe all recordings made on the account. :param data_logging: Data logging allows Twilio to improve the quality of the speech recognition & language understanding services through using customer data to refine, fine tune and evaluate machine learning models. Note: Data logging cannot be activated via API, only via www.twilio.com, as it requires additional consent. :param friendly_name: A human readable description of this resource, up to 64 characters. - :param language_code: The default language code of the audio. :param unique_name: Provides a unique and addressable name to be assigned to this Service, assigned by the developer, to be optionally used in addition to SID. :param auto_redaction: Instructs the Speech Recognition service to automatically redact PII from all transcripts made on this service. :param media_redaction: Instructs the Speech Recognition service to automatically redact PII from all transcripts media made on this service. The auto_redaction flag must be enabled, results in error otherwise. @@ -164,7 +166,6 @@ def update( auto_transcribe=auto_transcribe, data_logging=data_logging, friendly_name=friendly_name, - language_code=language_code, unique_name=unique_name, auto_redaction=auto_redaction, media_redaction=media_redaction, @@ -178,7 +179,6 @@ async def update_async( auto_transcribe: Union[bool, object] = values.unset, data_logging: Union[bool, object] = values.unset, friendly_name: Union[str, object] = values.unset, - language_code: Union[str, object] = values.unset, unique_name: Union[str, object] = values.unset, auto_redaction: Union[bool, object] = values.unset, media_redaction: Union[bool, object] = values.unset, @@ -192,7 +192,6 @@ async def update_async( :param auto_transcribe: Instructs the Speech Recognition service to automatically transcribe all recordings made on the account. :param data_logging: Data logging allows Twilio to improve the quality of the speech recognition & language understanding services through using customer data to refine, fine tune and evaluate machine learning models. Note: Data logging cannot be activated via API, only via www.twilio.com, as it requires additional consent. :param friendly_name: A human readable description of this resource, up to 64 characters. - :param language_code: The default language code of the audio. :param unique_name: Provides a unique and addressable name to be assigned to this Service, assigned by the developer, to be optionally used in addition to SID. :param auto_redaction: Instructs the Speech Recognition service to automatically redact PII from all transcripts made on this service. :param media_redaction: Instructs the Speech Recognition service to automatically redact PII from all transcripts media made on this service. The auto_redaction flag must be enabled, results in error otherwise. @@ -206,7 +205,6 @@ async def update_async( auto_transcribe=auto_transcribe, data_logging=data_logging, friendly_name=friendly_name, - language_code=language_code, unique_name=unique_name, auto_redaction=auto_redaction, media_redaction=media_redaction, @@ -309,7 +307,6 @@ def update( auto_transcribe: Union[bool, object] = values.unset, data_logging: Union[bool, object] = values.unset, friendly_name: Union[str, object] = values.unset, - language_code: Union[str, object] = values.unset, unique_name: Union[str, object] = values.unset, auto_redaction: Union[bool, object] = values.unset, media_redaction: Union[bool, object] = values.unset, @@ -323,7 +320,6 @@ def update( :param auto_transcribe: Instructs the Speech Recognition service to automatically transcribe all recordings made on the account. :param data_logging: Data logging allows Twilio to improve the quality of the speech recognition & language understanding services through using customer data to refine, fine tune and evaluate machine learning models. Note: Data logging cannot be activated via API, only via www.twilio.com, as it requires additional consent. :param friendly_name: A human readable description of this resource, up to 64 characters. - :param language_code: The default language code of the audio. :param unique_name: Provides a unique and addressable name to be assigned to this Service, assigned by the developer, to be optionally used in addition to SID. :param auto_redaction: Instructs the Speech Recognition service to automatically redact PII from all transcripts made on this service. :param media_redaction: Instructs the Speech Recognition service to automatically redact PII from all transcripts media made on this service. The auto_redaction flag must be enabled, results in error otherwise. @@ -337,7 +333,6 @@ def update( "AutoTranscribe": serialize.boolean_to_string(auto_transcribe), "DataLogging": serialize.boolean_to_string(data_logging), "FriendlyName": friendly_name, - "LanguageCode": language_code, "UniqueName": unique_name, "AutoRedaction": serialize.boolean_to_string(auto_redaction), "MediaRedaction": serialize.boolean_to_string(media_redaction), @@ -363,7 +358,6 @@ async def update_async( auto_transcribe: Union[bool, object] = values.unset, data_logging: Union[bool, object] = values.unset, friendly_name: Union[str, object] = values.unset, - language_code: Union[str, object] = values.unset, unique_name: Union[str, object] = values.unset, auto_redaction: Union[bool, object] = values.unset, media_redaction: Union[bool, object] = values.unset, @@ -377,7 +371,6 @@ async def update_async( :param auto_transcribe: Instructs the Speech Recognition service to automatically transcribe all recordings made on the account. :param data_logging: Data logging allows Twilio to improve the quality of the speech recognition & language understanding services through using customer data to refine, fine tune and evaluate machine learning models. Note: Data logging cannot be activated via API, only via www.twilio.com, as it requires additional consent. :param friendly_name: A human readable description of this resource, up to 64 characters. - :param language_code: The default language code of the audio. :param unique_name: Provides a unique and addressable name to be assigned to this Service, assigned by the developer, to be optionally used in addition to SID. :param auto_redaction: Instructs the Speech Recognition service to automatically redact PII from all transcripts made on this service. :param media_redaction: Instructs the Speech Recognition service to automatically redact PII from all transcripts media made on this service. The auto_redaction flag must be enabled, results in error otherwise. @@ -391,7 +384,6 @@ async def update_async( "AutoTranscribe": serialize.boolean_to_string(auto_transcribe), "DataLogging": serialize.boolean_to_string(data_logging), "FriendlyName": friendly_name, - "LanguageCode": language_code, "UniqueName": unique_name, "AutoRedaction": serialize.boolean_to_string(auto_redaction), "MediaRedaction": serialize.boolean_to_string(media_redaction), @@ -472,7 +464,7 @@ def create( :param auto_transcribe: Instructs the Speech Recognition service to automatically transcribe all recordings made on the account. :param data_logging: Data logging allows Twilio to improve the quality of the speech recognition & language understanding services through using customer data to refine, fine tune and evaluate machine learning models. Note: Data logging cannot be activated via API, only via www.twilio.com, as it requires additional consent. :param friendly_name: A human readable description of this resource, up to 64 characters. - :param language_code: The default language code of the audio. + :param language_code: The language code set during Service creation determines the Transcription language for all call recordings processed by that Service. The default is en-US if no language code is set. A Service can only support one language code, and it cannot be updated once it's set. :param auto_redaction: Instructs the Speech Recognition service to automatically redact PII from all transcripts made on this service. :param media_redaction: Instructs the Speech Recognition service to automatically redact PII from all transcripts media made on this service. The auto_redaction flag must be enabled, results in error otherwise. :param webhook_url: The URL Twilio will request when executing the Webhook. @@ -522,7 +514,7 @@ async def create_async( :param auto_transcribe: Instructs the Speech Recognition service to automatically transcribe all recordings made on the account. :param data_logging: Data logging allows Twilio to improve the quality of the speech recognition & language understanding services through using customer data to refine, fine tune and evaluate machine learning models. Note: Data logging cannot be activated via API, only via www.twilio.com, as it requires additional consent. :param friendly_name: A human readable description of this resource, up to 64 characters. - :param language_code: The default language code of the audio. + :param language_code: The language code set during Service creation determines the Transcription language for all call recordings processed by that Service. The default is en-US if no language code is set. A Service can only support one language code, and it cannot be updated once it's set. :param auto_redaction: Instructs the Speech Recognition service to automatically redact PII from all transcripts made on this service. :param media_redaction: Instructs the Speech Recognition service to automatically redact PII from all transcripts media made on this service. The auto_redaction flag must be enabled, results in error otherwise. :param webhook_url: The URL Twilio will request when executing the Webhook. diff --git a/twilio/rest/messaging/v1/service/__init__.py b/twilio/rest/messaging/v1/service/__init__.py index f7351843b6..75c798f4c4 100644 --- a/twilio/rest/messaging/v1/service/__init__.py +++ b/twilio/rest/messaging/v1/service/__init__.py @@ -61,7 +61,6 @@ class ScanMessageContent(object): :ivar usecase: A string that describes the scenario in which the Messaging Service will be used. Possible values are `notifications`, `marketing`, `verification`, `discussion`, `poll`, `undeclared`. :ivar us_app_to_person_registered: Whether US A2P campaign is registered for this Service. :ivar use_inbound_webhook_on_number: A boolean value that indicates either the webhook url configured on the phone number will be used or `inbound_request_url`/`fallback_url` url will be called when a message is received from the phone number. If this field is enabled then the webhook url defined on the phone number will override the `inbound_request_url`/`fallback_url` defined for the Messaging Service. - :ivar sending_windows: A list of Sending Windows, which indicate defined time ranges in which a message can be sent, in the UTC time zone. Each window is defined by two strings, labeled \"start_time\" and \"end_time\". """ def __init__( @@ -108,9 +107,6 @@ def __init__( self.use_inbound_webhook_on_number: Optional[bool] = payload.get( "use_inbound_webhook_on_number" ) - self.sending_windows: Optional[Dict[str, object]] = payload.get( - "sending_windows" - ) self._solution = { "sid": sid or self.sid, diff --git a/twilio/rest/numbers/v1/__init__.py b/twilio/rest/numbers/v1/__init__.py index 0bacabb722..7466d170dd 100644 --- a/twilio/rest/numbers/v1/__init__.py +++ b/twilio/rest/numbers/v1/__init__.py @@ -17,13 +17,20 @@ 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_port_in_phone_number import ( PortingPortInPhoneNumberList, ) from twilio.rest.numbers.v1.porting_portability import PortingPortabilityList +from twilio.rest.numbers.v1.porting_webhook_configuration import ( + PortingWebhookConfigurationList, +) +from twilio.rest.numbers.v1.porting_webhook_configuration_delete import ( + PortingWebhookConfigurationDeleteList, +) +from twilio.rest.numbers.v1.porting_webhook_configuration_fetch import ( + PortingWebhookConfigurationFetchList, +) class V1(Version): @@ -37,13 +44,20 @@ 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_fetch: Optional[PortingPortInFetchList] = None self._porting_port_in_phone_number: Optional[PortingPortInPhoneNumberList] = ( None ) self._porting_portabilities: Optional[PortingPortabilityList] = None + self._porting_webhook_configurations: Optional[ + PortingWebhookConfigurationList + ] = None + self._porting_webhook_configurations_delete: Optional[ + PortingWebhookConfigurationDeleteList + ] = None + self._porting_webhook_configuration_fetch: Optional[ + PortingWebhookConfigurationFetchList + ] = None @property def bulk_eligibilities(self) -> BulkEligibilityList: @@ -57,24 +71,12 @@ def eligibilities(self) -> EligibilityList: 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_fetch(self) -> PortingPortInFetchList: - if self._porting_port_ins_fetch is None: - self._porting_port_ins_fetch = PortingPortInFetchList(self) - return self._porting_port_ins_fetch - @property def porting_port_in_phone_number(self) -> PortingPortInPhoneNumberList: if self._porting_port_in_phone_number is None: @@ -87,6 +89,32 @@ def porting_portabilities(self) -> PortingPortabilityList: self._porting_portabilities = PortingPortabilityList(self) return self._porting_portabilities + @property + def porting_webhook_configurations(self) -> PortingWebhookConfigurationList: + if self._porting_webhook_configurations is None: + self._porting_webhook_configurations = PortingWebhookConfigurationList(self) + return self._porting_webhook_configurations + + @property + def porting_webhook_configurations_delete( + self, + ) -> PortingWebhookConfigurationDeleteList: + if self._porting_webhook_configurations_delete is None: + self._porting_webhook_configurations_delete = ( + PortingWebhookConfigurationDeleteList(self) + ) + return self._porting_webhook_configurations_delete + + @property + def porting_webhook_configuration_fetch( + self, + ) -> PortingWebhookConfigurationFetchList: + if self._porting_webhook_configuration_fetch is None: + self._porting_webhook_configuration_fetch = ( + PortingWebhookConfigurationFetchList(self) + ) + return self._porting_webhook_configuration_fetch + def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/numbers/v1/porting_bulk_portability.py b/twilio/rest/numbers/v1/porting_bulk_portability.py deleted file mode 100644 index c3fedcd5bb..0000000000 --- a/twilio/rest/numbers/v1/porting_bulk_portability.py +++ /dev/null @@ -1,252 +0,0 @@ -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 datetime import datetime -from typing import Any, Dict, List, Optional -from twilio.base import deserialize, serialize, values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.version import Version - - -class PortingBulkPortabilityInstance(InstanceResource): - - class Status(object): - IN_PROGRESS = "in-progress" - COMPLETED = "completed" - EXPIRED = "expired" - - """ - :ivar sid: A 34 character string that uniquely identifies this Portability check. - :ivar status: - :ivar datetime_created: The date that the Portability check was created, given in ISO 8601 format. - :ivar phone_numbers: Contains a list with all the information of the requested phone numbers. Each phone number contains the following properties: `phone_number`: The phone number which portability is to be checked. `portable`: Boolean flag specifying if phone number is portable or not. `not_portable_reason`: Reason why the phone number cannot be ported into Twilio, `null` otherwise. `not_portable_reason_code`: The Portability Reason Code for the phone number if it cannot be ported in Twilio, `null` otherwise. `pin_and_account_number_required`: Boolean flag specifying if PIN and account number is required for the phone number. `number_type`: The type of the requested phone number. `country` Country the phone number belongs to. `messaging_carrier` Current messaging carrier of the phone number. `voice_carrier` Current voice carrier of the phone number. - :ivar url: This is the url of the request that you're trying to reach out to locate the resource. - """ - - def __init__( - self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None - ): - super().__init__(version) - - self.sid: Optional[str] = payload.get("sid") - self.status: Optional["PortingBulkPortabilityInstance.Status"] = payload.get( - "status" - ) - self.datetime_created: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("datetime_created") - ) - self.phone_numbers: Optional[List[Dict[str, object]]] = payload.get( - "phone_numbers" - ) - self.url: Optional[str] = payload.get("url") - - self._solution = { - "sid": sid or self.sid, - } - self._context: Optional[PortingBulkPortabilityContext] = None - - @property - def _proxy(self) -> "PortingBulkPortabilityContext": - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: PortingBulkPortabilityContext for this PortingBulkPortabilityInstance - """ - if self._context is None: - self._context = PortingBulkPortabilityContext( - self._version, - sid=self._solution["sid"], - ) - return self._context - - def fetch(self) -> "PortingBulkPortabilityInstance": - """ - Fetch the PortingBulkPortabilityInstance - - - :returns: The fetched PortingBulkPortabilityInstance - """ - return self._proxy.fetch() - - async def fetch_async(self) -> "PortingBulkPortabilityInstance": - """ - Asynchronous coroutine to fetch the PortingBulkPortabilityInstance - - - :returns: The fetched PortingBulkPortabilityInstance - """ - return await self._proxy.fetch_async() - - 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 PortingBulkPortabilityContext(InstanceContext): - - def __init__(self, version: Version, sid: str): - """ - Initialize the PortingBulkPortabilityContext - - :param version: Version that contains the resource - :param sid: A 34 character string that uniquely identifies the Portability check. - """ - super().__init__(version) - - # Path Solution - self._solution = { - "sid": sid, - } - self._uri = "/Porting/Portability/{sid}".format(**self._solution) - - def fetch(self) -> PortingBulkPortabilityInstance: - """ - Fetch the PortingBulkPortabilityInstance - - - :returns: The fetched PortingBulkPortabilityInstance - """ - - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) - - return PortingBulkPortabilityInstance( - self._version, - payload, - sid=self._solution["sid"], - ) - - async def fetch_async(self) -> PortingBulkPortabilityInstance: - """ - Asynchronous coroutine to fetch the PortingBulkPortabilityInstance - - - :returns: The fetched PortingBulkPortabilityInstance - """ - - payload = await self._version.fetch_async( - method="GET", - uri=self._uri, - ) - - return PortingBulkPortabilityInstance( - self._version, - payload, - sid=self._solution["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 PortingBulkPortabilityList(ListResource): - - def __init__(self, version: Version): - """ - Initialize the PortingBulkPortabilityList - - :param version: Version that contains the resource - - """ - super().__init__(version) - - self._uri = "/Porting/Portability" - - def create(self, phone_numbers: List[str]) -> PortingBulkPortabilityInstance: - """ - Create the PortingBulkPortabilityInstance - - :param phone_numbers: The phone numbers which portability is to be checked. This should be a list of strings. Phone numbers are in E.164 format (e.g. +16175551212). . - - :returns: The created PortingBulkPortabilityInstance - """ - - data = values.of( - { - "PhoneNumbers": serialize.map(phone_numbers, lambda e: e), - } - ) - - payload = self._version.create( - method="POST", - uri=self._uri, - data=data, - ) - - return PortingBulkPortabilityInstance(self._version, payload) - - async def create_async( - self, phone_numbers: List[str] - ) -> PortingBulkPortabilityInstance: - """ - Asynchronously create the PortingBulkPortabilityInstance - - :param phone_numbers: The phone numbers which portability is to be checked. This should be a list of strings. Phone numbers are in E.164 format (e.g. +16175551212). . - - :returns: The created PortingBulkPortabilityInstance - """ - - data = values.of( - { - "PhoneNumbers": serialize.map(phone_numbers, lambda e: e), - } - ) - - payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, - ) - - return PortingBulkPortabilityInstance(self._version, payload) - - def get(self, sid: str) -> PortingBulkPortabilityContext: - """ - Constructs a PortingBulkPortabilityContext - - :param sid: A 34 character string that uniquely identifies the Portability check. - """ - return PortingBulkPortabilityContext(self._version, sid=sid) - - def __call__(self, sid: str) -> PortingBulkPortabilityContext: - """ - Constructs a PortingBulkPortabilityContext - - :param sid: A 34 character string that uniquely identifies the Portability check. - """ - return PortingBulkPortabilityContext(self._version, sid=sid) - - 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 index 862f578bff..e9988a7d6b 100644 --- a/twilio/rest/numbers/v1/porting_port_in.py +++ b/twilio/rest/numbers/v1/porting_port_in.py @@ -12,8 +12,9 @@ Do not edit the class manually. """ -from typing import Any, Dict, Optional, Union -from twilio.base import values +from datetime import date +from typing import Any, Dict, List, Optional, Union +from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -23,7 +24,16 @@ 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: + :ivar url: The URL of this Port In request + :ivar account_sid: The Account SID that the numbers will be added to after they are ported into Twilio. + :ivar notification_emails: List of emails for getting notifications about the LOA signing process. Allowed Max 10 emails. + :ivar target_port_in_date: Minimum number of days in the future (at least 2 days) needs to be established with the Ops team for validation. + :ivar target_port_in_time_range_start: Minimum hour in the future needs to be established with the Ops team for validation. + :ivar target_port_in_time_range_end: Maximum hour in the future needs to be established with the Ops team for validation. + :ivar port_in_request_status: The status of the port in request. The possible values are: In progress, Completed, Expired, In review, Waiting for Signature, Action Required, and Canceled. + :ivar losing_carrier_information: The information for the losing carrier. + :ivar phone_numbers: The list of phone numbers to Port in. Phone numbers are in E.164 format (e.g. +16175551212). + :ivar documents: The list of documents SID referencing a utility bills """ def __init__( @@ -36,6 +46,29 @@ def __init__( self.port_in_request_sid: Optional[str] = payload.get("port_in_request_sid") self.url: Optional[str] = payload.get("url") + self.account_sid: Optional[str] = payload.get("account_sid") + self.notification_emails: Optional[List[str]] = payload.get( + "notification_emails" + ) + self.target_port_in_date: Optional[date] = deserialize.iso8601_date( + payload.get("target_port_in_date") + ) + self.target_port_in_time_range_start: Optional[str] = payload.get( + "target_port_in_time_range_start" + ) + self.target_port_in_time_range_end: Optional[str] = payload.get( + "target_port_in_time_range_end" + ) + self.port_in_request_status: Optional[str] = payload.get( + "port_in_request_status" + ) + self.losing_carrier_information: Optional[Dict[str, object]] = payload.get( + "losing_carrier_information" + ) + self.phone_numbers: Optional[List[Dict[str, object]]] = payload.get( + "phone_numbers" + ) + self.documents: Optional[List[str]] = payload.get("documents") self._solution = { "port_in_request_sid": port_in_request_sid or self.port_in_request_sid, @@ -75,6 +108,24 @@ async def delete_async(self) -> bool: """ return await self._proxy.delete_async() + def fetch(self) -> "PortingPortInInstance": + """ + Fetch the PortingPortInInstance + + + :returns: The fetched PortingPortInInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "PortingPortInInstance": + """ + Asynchronous coroutine to fetch the PortingPortInInstance + + + :returns: The fetched PortingPortInInstance + """ + return await self._proxy.fetch_async() + def __repr__(self) -> str: """ Provide a friendly representation @@ -126,6 +177,44 @@ async def delete_async(self) -> bool: uri=self._uri, ) + def fetch(self) -> PortingPortInInstance: + """ + Fetch the PortingPortInInstance + + + :returns: The fetched PortingPortInInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return PortingPortInInstance( + self._version, + payload, + port_in_request_sid=self._solution["port_in_request_sid"], + ) + + async def fetch_async(self) -> PortingPortInInstance: + """ + Asynchronous coroutine to fetch the PortingPortInInstance + + + :returns: The fetched PortingPortInInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return PortingPortInInstance( + self._version, + payload, + port_in_request_sid=self._solution["port_in_request_sid"], + ) + def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/numbers/v1/porting_port_in_fetch.py b/twilio/rest/numbers/v1/porting_port_in_fetch.py deleted file mode 100644 index dc0b79c252..0000000000 --- a/twilio/rest/numbers/v1/porting_port_in_fetch.py +++ /dev/null @@ -1,223 +0,0 @@ -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 datetime import date -from typing import Any, Dict, List, Optional -from twilio.base import deserialize -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.version import Version - - -class PortingPortInFetchInstance(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: The URL of this Port In request - :ivar account_sid: The Account SID that the numbers will be added to after they are ported into Twilio. - :ivar notification_emails: List of emails for getting notifications about the LOA signing process. Allowed Max 10 emails. - :ivar target_port_in_date: Minimum number of days in the future (at least 2 days) needs to be established with the Ops team for validation. - :ivar target_port_in_time_range_start: Minimum hour in the future needs to be established with the Ops team for validation. - :ivar target_port_in_time_range_end: Maximum hour in the future needs to be established with the Ops team for validation. - :ivar port_in_request_status: The status of the port in request. The possible values are: In progress, Completed, Expired, In review, Waiting for Signature, Action Required, and Canceled. - :ivar losing_carrier_information: The information for the losing carrier. - :ivar phone_numbers: The list of phone numbers to Port in. Phone numbers are in E.164 format (e.g. +16175551212). - :ivar documents: The list of documents SID referencing a utility bills - """ - - def __init__( - self, - version: Version, - payload: Dict[str, Any], - port_in_request_sid: Optional[str] = None, - ): - super().__init__(version) - - self.port_in_request_sid: Optional[str] = payload.get("port_in_request_sid") - self.url: Optional[str] = payload.get("url") - self.account_sid: Optional[str] = payload.get("account_sid") - self.notification_emails: Optional[List[str]] = payload.get( - "notification_emails" - ) - self.target_port_in_date: Optional[date] = deserialize.iso8601_date( - payload.get("target_port_in_date") - ) - self.target_port_in_time_range_start: Optional[str] = payload.get( - "target_port_in_time_range_start" - ) - self.target_port_in_time_range_end: Optional[str] = payload.get( - "target_port_in_time_range_end" - ) - self.port_in_request_status: Optional[str] = payload.get( - "port_in_request_status" - ) - self.losing_carrier_information: Optional[Dict[str, object]] = payload.get( - "losing_carrier_information" - ) - self.phone_numbers: Optional[List[Dict[str, object]]] = payload.get( - "phone_numbers" - ) - self.documents: Optional[List[str]] = payload.get("documents") - - self._solution = { - "port_in_request_sid": port_in_request_sid or self.port_in_request_sid, - } - self._context: Optional[PortingPortInFetchContext] = None - - @property - def _proxy(self) -> "PortingPortInFetchContext": - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: PortingPortInFetchContext for this PortingPortInFetchInstance - """ - if self._context is None: - self._context = PortingPortInFetchContext( - self._version, - port_in_request_sid=self._solution["port_in_request_sid"], - ) - return self._context - - def fetch(self) -> "PortingPortInFetchInstance": - """ - Fetch the PortingPortInFetchInstance - - - :returns: The fetched PortingPortInFetchInstance - """ - return self._proxy.fetch() - - async def fetch_async(self) -> "PortingPortInFetchInstance": - """ - Asynchronous coroutine to fetch the PortingPortInFetchInstance - - - :returns: The fetched PortingPortInFetchInstance - """ - return await self._proxy.fetch_async() - - 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 PortingPortInFetchContext(InstanceContext): - - def __init__(self, version: Version, port_in_request_sid: str): - """ - Initialize the PortingPortInFetchContext - - :param version: Version that contains the resource - :param port_in_request_sid: The SID of the Port In request. This is a unique identifier of the port in request. - """ - super().__init__(version) - - # Path Solution - self._solution = { - "port_in_request_sid": port_in_request_sid, - } - self._uri = "/Porting/PortIn/{port_in_request_sid}".format(**self._solution) - - def fetch(self) -> PortingPortInFetchInstance: - """ - Fetch the PortingPortInFetchInstance - - - :returns: The fetched PortingPortInFetchInstance - """ - - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) - - return PortingPortInFetchInstance( - self._version, - payload, - port_in_request_sid=self._solution["port_in_request_sid"], - ) - - async def fetch_async(self) -> PortingPortInFetchInstance: - """ - Asynchronous coroutine to fetch the PortingPortInFetchInstance - - - :returns: The fetched PortingPortInFetchInstance - """ - - payload = await self._version.fetch_async( - method="GET", - uri=self._uri, - ) - - return PortingPortInFetchInstance( - self._version, - payload, - port_in_request_sid=self._solution["port_in_request_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 PortingPortInFetchList(ListResource): - - def __init__(self, version: Version): - """ - Initialize the PortingPortInFetchList - - :param version: Version that contains the resource - - """ - super().__init__(version) - - def get(self, port_in_request_sid: str) -> PortingPortInFetchContext: - """ - Constructs a PortingPortInFetchContext - - :param port_in_request_sid: The SID of the Port In request. This is a unique identifier of the port in request. - """ - return PortingPortInFetchContext( - self._version, port_in_request_sid=port_in_request_sid - ) - - def __call__(self, port_in_request_sid: str) -> PortingPortInFetchContext: - """ - Constructs a PortingPortInFetchContext - - :param port_in_request_sid: The SID of the Port In request. This is a unique identifier of the port in request. - """ - return PortingPortInFetchContext( - self._version, port_in_request_sid=port_in_request_sid - ) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" diff --git a/twilio/rest/numbers/v1/porting_port_in_phone_number.py b/twilio/rest/numbers/v1/porting_port_in_phone_number.py index 41296c6b65..48b90eea4f 100644 --- a/twilio/rest/numbers/v1/porting_port_in_phone_number.py +++ b/twilio/rest/numbers/v1/porting_port_in_phone_number.py @@ -12,12 +12,139 @@ Do not edit the class manually. """ +from datetime import datetime +from typing import Any, Dict, Optional +from twilio.base import deserialize from twilio.base.instance_context import InstanceContext - +from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource from twilio.base.version import Version +class PortingPortInPhoneNumberInstance(InstanceResource): + """ + :ivar port_in_request_sid: The SID of the Port In request. This is a unique identifier of the port in request. + :ivar phone_number_sid: The SID of the Port In request phone number. This is a unique identifier of the phone number. + :ivar url: + :ivar account_sid: The SID of the account that the phone number belongs to. + :ivar phone_number_type: The type of the phone number. + :ivar date_created: The date when the phone number was created. + :ivar country: The country of the phone number. + :ivar missing_required_fields: The phone number is missing required fields. + :ivar status_last_time_updated_timestamp: The timestamp when the status was last updated. + :ivar phone_number: The phone number. + :ivar portable: The phone number is portable. + :ivar not_portability_reason: The reason why the phone number is not portable. + :ivar not_portability_reason_code: The code of the reason why the phone number is not portable. + :ivar port_in_phone_number_status: The status of the phone number in the port in request. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + port_in_request_sid: Optional[str] = None, + phone_number_sid: Optional[str] = None, + ): + super().__init__(version) + + self.port_in_request_sid: Optional[str] = payload.get("port_in_request_sid") + self.phone_number_sid: Optional[str] = payload.get("phone_number_sid") + self.url: Optional[str] = payload.get("url") + self.account_sid: Optional[str] = payload.get("account_sid") + self.phone_number_type: Optional[str] = payload.get("phone_number_type") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.country: Optional[str] = payload.get("country") + self.missing_required_fields: Optional[bool] = payload.get( + "missing_required_fields" + ) + self.status_last_time_updated_timestamp: Optional[datetime] = ( + deserialize.iso8601_datetime( + payload.get("status_last_time_updated_timestamp") + ) + ) + self.phone_number: Optional[str] = payload.get("phone_number") + self.portable: Optional[bool] = payload.get("portable") + self.not_portability_reason: Optional[str] = payload.get( + "not_portability_reason" + ) + self.not_portability_reason_code: Optional[str] = payload.get( + "not_portability_reason_code" + ) + self.port_in_phone_number_status: Optional[str] = payload.get( + "port_in_phone_number_status" + ) + + self._solution = { + "port_in_request_sid": port_in_request_sid or self.port_in_request_sid, + "phone_number_sid": phone_number_sid or self.phone_number_sid, + } + self._context: Optional[PortingPortInPhoneNumberContext] = None + + @property + def _proxy(self) -> "PortingPortInPhoneNumberContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: PortingPortInPhoneNumberContext for this PortingPortInPhoneNumberInstance + """ + if self._context is None: + self._context = PortingPortInPhoneNumberContext( + self._version, + port_in_request_sid=self._solution["port_in_request_sid"], + phone_number_sid=self._solution["phone_number_sid"], + ) + return self._context + + def delete(self) -> bool: + """ + Deletes the PortingPortInPhoneNumberInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the PortingPortInPhoneNumberInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def fetch(self) -> "PortingPortInPhoneNumberInstance": + """ + Fetch the PortingPortInPhoneNumberInstance + + + :returns: The fetched PortingPortInPhoneNumberInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "PortingPortInPhoneNumberInstance": + """ + Asynchronous coroutine to fetch the PortingPortInPhoneNumberInstance + + + :returns: The fetched PortingPortInPhoneNumberInstance + """ + return await self._proxy.fetch_async() + + 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 PortingPortInPhoneNumberContext(InstanceContext): def __init__( @@ -28,7 +155,7 @@ def __init__( :param version: Version that contains the resource :param port_in_request_sid: The SID of the Port In request. This is a unique identifier of the port in request. - :param phone_number_sid: The SID of the Port In request phone number. This is a unique identifier of the phone number. + :param phone_number_sid: The SID of the Phone number. This is a unique identifier of the phone number. """ super().__init__(version) @@ -65,6 +192,46 @@ async def delete_async(self) -> bool: uri=self._uri, ) + def fetch(self) -> PortingPortInPhoneNumberInstance: + """ + Fetch the PortingPortInPhoneNumberInstance + + + :returns: The fetched PortingPortInPhoneNumberInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return PortingPortInPhoneNumberInstance( + self._version, + payload, + port_in_request_sid=self._solution["port_in_request_sid"], + phone_number_sid=self._solution["phone_number_sid"], + ) + + async def fetch_async(self) -> PortingPortInPhoneNumberInstance: + """ + Asynchronous coroutine to fetch the PortingPortInPhoneNumberInstance + + + :returns: The fetched PortingPortInPhoneNumberInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return PortingPortInPhoneNumberInstance( + self._version, + payload, + port_in_request_sid=self._solution["port_in_request_sid"], + phone_number_sid=self._solution["phone_number_sid"], + ) + def __repr__(self) -> str: """ Provide a friendly representation @@ -93,7 +260,7 @@ def get( Constructs a PortingPortInPhoneNumberContext :param port_in_request_sid: The SID of the Port In request. This is a unique identifier of the port in request. - :param phone_number_sid: The SID of the Port In request phone number. This is a unique identifier of the phone number. + :param phone_number_sid: The SID of the Phone number. This is a unique identifier of the phone number. """ return PortingPortInPhoneNumberContext( self._version, @@ -108,7 +275,7 @@ def __call__( Constructs a PortingPortInPhoneNumberContext :param port_in_request_sid: The SID of the Port In request. This is a unique identifier of the port in request. - :param phone_number_sid: The SID of the Port In request phone number. This is a unique identifier of the phone number. + :param phone_number_sid: The SID of the Phone number. This is a unique identifier of the phone number. """ return PortingPortInPhoneNumberContext( self._version, diff --git a/twilio/rest/numbers/v1/porting_webhook_configuration.py b/twilio/rest/numbers/v1/porting_webhook_configuration.py new file mode 100644 index 0000000000..d1daabfd7e --- /dev/null +++ b/twilio/rest/numbers/v1/porting_webhook_configuration.py @@ -0,0 +1,108 @@ +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, Union +from twilio.base import values + +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class PortingWebhookConfigurationInstance(InstanceResource): + """ + :ivar url: The URL of the webhook configuration request + :ivar port_in_target_url: Webhook URL to send a request when a port in request or port in phone number event happens + :ivar port_out_target_url: Webhook URL to send a request when a port out phone number event happens + :ivar notifications_of: List of notification events to send a request to the webhook URL + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) + + self.url: Optional[str] = payload.get("url") + self.port_in_target_url: Optional[str] = payload.get("port_in_target_url") + self.port_out_target_url: Optional[str] = payload.get("port_out_target_url") + self.notifications_of: Optional[List[str]] = payload.get("notifications_of") + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "" + + +class PortingWebhookConfigurationList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the PortingWebhookConfigurationList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/Porting/Configuration/Webhook" + + def create( + self, body: Union[object, object] = values.unset + ) -> PortingWebhookConfigurationInstance: + """ + Create the PortingWebhookConfigurationInstance + + :param body: + + :returns: The created PortingWebhookConfigurationInstance + """ + data = body.to_dict() + + headers = {"Content-Type": "application/json"} + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return PortingWebhookConfigurationInstance(self._version, payload) + + async def create_async( + self, body: Union[object, object] = values.unset + ) -> PortingWebhookConfigurationInstance: + """ + Asynchronously create the PortingWebhookConfigurationInstance + + :param body: + + :returns: The created PortingWebhookConfigurationInstance + """ + data = body.to_dict() + + headers = {"Content-Type": "application/json"} + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return PortingWebhookConfigurationInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/numbers/v1/porting_webhook_configuration_delete.py b/twilio/rest/numbers/v1/porting_webhook_configuration_delete.py new file mode 100644 index 0000000000..beb011128f --- /dev/null +++ b/twilio/rest/numbers/v1/porting_webhook_configuration_delete.py @@ -0,0 +1,121 @@ +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 twilio.base.instance_context import InstanceContext + +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class PortingWebhookConfigurationDeleteContext(InstanceContext): + + def __init__( + self, + version: Version, + webhook_type: "PortingWebhookConfigurationDeleteInstance.WebhookType", + ): + """ + Initialize the PortingWebhookConfigurationDeleteContext + + :param version: Version that contains the resource + :param webhook_type: The of the webhook type of the configuration to be deleted + """ + super().__init__(version) + + # Path Solution + self._solution = { + "webhook_type": webhook_type, + } + self._uri = "/Porting/Configuration/Webhook/{webhook_type}".format( + **self._solution + ) + + def delete(self) -> bool: + """ + Deletes the PortingWebhookConfigurationDeleteInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._version.delete( + method="DELETE", + uri=self._uri, + ) + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the PortingWebhookConfigurationDeleteInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._version.delete_async( + method="DELETE", + uri=self._uri, + ) + + 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 PortingWebhookConfigurationDeleteList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the PortingWebhookConfigurationDeleteList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + def get( + self, webhook_type: "PortingWebhookConfigurationDeleteInstance.WebhookType" + ) -> PortingWebhookConfigurationDeleteContext: + """ + Constructs a PortingWebhookConfigurationDeleteContext + + :param webhook_type: The of the webhook type of the configuration to be deleted + """ + return PortingWebhookConfigurationDeleteContext( + self._version, webhook_type=webhook_type + ) + + def __call__( + self, webhook_type: "PortingWebhookConfigurationDeleteInstance.WebhookType" + ) -> PortingWebhookConfigurationDeleteContext: + """ + Constructs a PortingWebhookConfigurationDeleteContext + + :param webhook_type: The of the webhook type of the configuration to be deleted + """ + return PortingWebhookConfigurationDeleteContext( + self._version, webhook_type=webhook_type + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py b/twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py new file mode 100644 index 0000000000..46c053b65a --- /dev/null +++ b/twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py @@ -0,0 +1,101 @@ +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 datetime import datetime +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 PortingWebhookConfigurationFetchInstance(InstanceResource): + """ + :ivar url: The URL of the webhook configuration request + :ivar port_in_target_url: Webhook URL to send a request when a port in request or port in phone number event happens + :ivar port_out_target_url: Webhook URL to send a request when a port out phone number event happens + :ivar notifications_of: List of notification events to send a request to the webhook URL + :ivar port_in_target_date_created: Creation date for the port in webhook configuration + :ivar port_out_target_date_created: Creation date for the port out webhook configuration + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) + + self.url: Optional[str] = payload.get("url") + self.port_in_target_url: Optional[str] = payload.get("port_in_target_url") + self.port_out_target_url: Optional[str] = payload.get("port_out_target_url") + self.notifications_of: Optional[List[str]] = payload.get("notifications_of") + self.port_in_target_date_created: Optional[datetime] = ( + deserialize.iso8601_datetime(payload.get("port_in_target_date_created")) + ) + self.port_out_target_date_created: Optional[datetime] = ( + deserialize.iso8601_datetime(payload.get("port_out_target_date_created")) + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "" + + +class PortingWebhookConfigurationFetchList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the PortingWebhookConfigurationFetchList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/Porting/Configuration/Webhook" + + def fetch(self) -> PortingWebhookConfigurationFetchInstance: + """ + Asynchronously fetch the PortingWebhookConfigurationFetchInstance + + + :returns: The fetched PortingWebhookConfigurationFetchInstance + """ + + payload = self._version.fetch(method="GET", uri=self._uri) + + return PortingWebhookConfigurationFetchInstance(self._version, payload) + + async def fetch_async(self) -> PortingWebhookConfigurationFetchInstance: + """ + Asynchronously fetch the PortingWebhookConfigurationFetchInstance + + + :returns: The fetched PortingWebhookConfigurationFetchInstance + """ + + payload = await self._version.fetch_async(method="GET", uri=self._uri) + + return PortingWebhookConfigurationFetchInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/preview_messaging/PreviewMessagingBase.py b/twilio/rest/preview_messaging/PreviewMessagingBase.py deleted file mode 100644 index 12b19f4cf1..0000000000 --- a/twilio/rest/preview_messaging/PreviewMessagingBase.py +++ /dev/null @@ -1,44 +0,0 @@ -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/v1/__init__.py b/twilio/rest/preview_messaging/v1/__init__.py deleted file mode 100644 index 424af648e8..0000000000 --- a/twilio/rest/preview_messaging/v1/__init__.py +++ /dev/null @@ -1,51 +0,0 @@ -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 deleted file mode 100644 index e41e066bad..0000000000 --- a/twilio/rest/preview_messaging/v1/broadcast.py +++ /dev/null @@ -1,125 +0,0 @@ -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 deleted file mode 100644 index 0d2822e002..0000000000 --- a/twilio/rest/preview_messaging/v1/message.py +++ /dev/null @@ -1,204 +0,0 @@ -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/__init__.py b/twilio/rest/taskrouter/v1/workspace/task/__init__.py index f5c306b65a..9d35415ae3 100644 --- a/twilio/rest/taskrouter/v1/workspace/task/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/task/__init__.py @@ -56,6 +56,8 @@ class Status(object): :ivar url: The absolute URL of the Task resource. :ivar links: The URLs of related resources. :ivar virtual_start_time: The date and time in GMT indicating the ordering for routing of the Task specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar ignore_capacity: A boolean indicating if a new task should respect a worker's capacity during assignment + :ivar routing_target: A SID of a Worker, Queue, or Workflow to route a Task to """ def __init__( @@ -105,6 +107,8 @@ def __init__( self.virtual_start_time: Optional[datetime] = deserialize.iso8601_datetime( payload.get("virtual_start_time") ) + self.ignore_capacity: Optional[bool] = payload.get("ignore_capacity") + self.routing_target: Optional[str] = payload.get("routing_target") self._solution = { "workspace_sid": workspace_sid, @@ -518,6 +522,9 @@ def create( workflow_sid: Union[str, object] = values.unset, attributes: Union[str, object] = values.unset, virtual_start_time: Union[datetime, object] = values.unset, + routing_target: Union[str, object] = values.unset, + ignore_capacity: Union[str, object] = values.unset, + task_queue_sid: Union[str, object] = values.unset, ) -> TaskInstance: """ Create the TaskInstance @@ -528,6 +535,9 @@ def create( :param workflow_sid: The SID of the Workflow that you would like to handle routing for the new Task. If there is only one Workflow defined for the Workspace that you are posting the new task to, this parameter is optional. :param attributes: A URL-encoded JSON string with the attributes of the new task. This value is passed to the Workflow's `assignment_callback_url` when the Task is assigned to a Worker. For example: `{ \\\"task_type\\\": \\\"call\\\", \\\"twilio_call_sid\\\": \\\"CAxxx\\\", \\\"customer_ticket_number\\\": \\\"12345\\\" }`. :param virtual_start_time: The virtual start time to assign the new task and override the default. When supplied, the new task will have this virtual start time. When not supplied, the new task will have the virtual start time equal to `date_created`. Value can't be in the future. + :param routing_target: A SID of a Worker, Queue, or Workflow to route a Task to + :param ignore_capacity: A boolean indicating if a new task should respect a worker's capacity during assignment + :param task_queue_sid: The SID of the TaskQueue in which the Task belongs :returns: The created TaskInstance """ @@ -540,6 +550,9 @@ def create( "WorkflowSid": workflow_sid, "Attributes": attributes, "VirtualStartTime": serialize.iso8601_datetime(virtual_start_time), + "RoutingTarget": routing_target, + "IgnoreCapacity": ignore_capacity, + "TaskQueueSid": task_queue_sid, } ) @@ -561,6 +574,9 @@ async def create_async( workflow_sid: Union[str, object] = values.unset, attributes: Union[str, object] = values.unset, virtual_start_time: Union[datetime, object] = values.unset, + routing_target: Union[str, object] = values.unset, + ignore_capacity: Union[str, object] = values.unset, + task_queue_sid: Union[str, object] = values.unset, ) -> TaskInstance: """ Asynchronously create the TaskInstance @@ -571,6 +587,9 @@ async def create_async( :param workflow_sid: The SID of the Workflow that you would like to handle routing for the new Task. If there is only one Workflow defined for the Workspace that you are posting the new task to, this parameter is optional. :param attributes: A URL-encoded JSON string with the attributes of the new task. This value is passed to the Workflow's `assignment_callback_url` when the Task is assigned to a Worker. For example: `{ \\\"task_type\\\": \\\"call\\\", \\\"twilio_call_sid\\\": \\\"CAxxx\\\", \\\"customer_ticket_number\\\": \\\"12345\\\" }`. :param virtual_start_time: The virtual start time to assign the new task and override the default. When supplied, the new task will have this virtual start time. When not supplied, the new task will have the virtual start time equal to `date_created`. Value can't be in the future. + :param routing_target: A SID of a Worker, Queue, or Workflow to route a Task to + :param ignore_capacity: A boolean indicating if a new task should respect a worker's capacity during assignment + :param task_queue_sid: The SID of the TaskQueue in which the Task belongs :returns: The created TaskInstance """ @@ -583,6 +602,9 @@ async def create_async( "WorkflowSid": workflow_sid, "Attributes": attributes, "VirtualStartTime": serialize.iso8601_datetime(virtual_start_time), + "RoutingTarget": routing_target, + "IgnoreCapacity": ignore_capacity, + "TaskQueueSid": task_queue_sid, } ) @@ -605,6 +627,7 @@ def stream( task_queue_sid: Union[str, object] = values.unset, task_queue_name: Union[str, object] = values.unset, evaluate_task_attributes: Union[str, object] = values.unset, + routing_target: Union[str, object] = values.unset, ordering: Union[str, object] = values.unset, has_addons: Union[bool, object] = values.unset, limit: Optional[int] = None, @@ -623,6 +646,7 @@ def stream( :param str task_queue_sid: The SID of the TaskQueue with the Tasks to read. Returns the Tasks waiting in the TaskQueue identified by this SID. :param str task_queue_name: The `friendly_name` of the TaskQueue with the Tasks to read. Returns the Tasks waiting in the TaskQueue identified by this friendly name. :param str evaluate_task_attributes: The attributes of the Tasks to read. Returns the Tasks that match the attributes specified in this parameter. + :param str routing_target: A SID of a Worker, Queue, or Workflow to route a Task to :param str ordering: How to order the returned Task resources. By default, Tasks are sorted by ascending DateCreated. This value is specified as: `Attribute:Order`, where `Attribute` can be either `DateCreated`, `Priority`, or `VirtualStartTime` and `Order` can be either `asc` or `desc`. For example, `Priority:desc` returns Tasks ordered in descending order of their Priority. Pairings of sort orders can be specified in a comma-separated list such as `Priority:desc,DateCreated:asc`, which returns the Tasks in descending Priority order and ascending DateCreated Order. The only ordering pairing not allowed is DateCreated and VirtualStartTime. :param bool has_addons: Whether to read Tasks with Add-ons. If `true`, returns only Tasks with Add-ons. If `false`, returns only Tasks without Add-ons. :param limit: Upper limit for the number of records to return. stream() @@ -643,6 +667,7 @@ def stream( task_queue_sid=task_queue_sid, task_queue_name=task_queue_name, evaluate_task_attributes=evaluate_task_attributes, + routing_target=routing_target, ordering=ordering, has_addons=has_addons, page_size=limits["page_size"], @@ -659,6 +684,7 @@ async def stream_async( task_queue_sid: Union[str, object] = values.unset, task_queue_name: Union[str, object] = values.unset, evaluate_task_attributes: Union[str, object] = values.unset, + routing_target: Union[str, object] = values.unset, ordering: Union[str, object] = values.unset, has_addons: Union[bool, object] = values.unset, limit: Optional[int] = None, @@ -677,6 +703,7 @@ async def stream_async( :param str task_queue_sid: The SID of the TaskQueue with the Tasks to read. Returns the Tasks waiting in the TaskQueue identified by this SID. :param str task_queue_name: The `friendly_name` of the TaskQueue with the Tasks to read. Returns the Tasks waiting in the TaskQueue identified by this friendly name. :param str evaluate_task_attributes: The attributes of the Tasks to read. Returns the Tasks that match the attributes specified in this parameter. + :param str routing_target: A SID of a Worker, Queue, or Workflow to route a Task to :param str ordering: How to order the returned Task resources. By default, Tasks are sorted by ascending DateCreated. This value is specified as: `Attribute:Order`, where `Attribute` can be either `DateCreated`, `Priority`, or `VirtualStartTime` and `Order` can be either `asc` or `desc`. For example, `Priority:desc` returns Tasks ordered in descending order of their Priority. Pairings of sort orders can be specified in a comma-separated list such as `Priority:desc,DateCreated:asc`, which returns the Tasks in descending Priority order and ascending DateCreated Order. The only ordering pairing not allowed is DateCreated and VirtualStartTime. :param bool has_addons: Whether to read Tasks with Add-ons. If `true`, returns only Tasks with Add-ons. If `false`, returns only Tasks without Add-ons. :param limit: Upper limit for the number of records to return. stream() @@ -697,6 +724,7 @@ async def stream_async( task_queue_sid=task_queue_sid, task_queue_name=task_queue_name, evaluate_task_attributes=evaluate_task_attributes, + routing_target=routing_target, ordering=ordering, has_addons=has_addons, page_size=limits["page_size"], @@ -713,6 +741,7 @@ def list( task_queue_sid: Union[str, object] = values.unset, task_queue_name: Union[str, object] = values.unset, evaluate_task_attributes: Union[str, object] = values.unset, + routing_target: Union[str, object] = values.unset, ordering: Union[str, object] = values.unset, has_addons: Union[bool, object] = values.unset, limit: Optional[int] = None, @@ -730,6 +759,7 @@ def list( :param str task_queue_sid: The SID of the TaskQueue with the Tasks to read. Returns the Tasks waiting in the TaskQueue identified by this SID. :param str task_queue_name: The `friendly_name` of the TaskQueue with the Tasks to read. Returns the Tasks waiting in the TaskQueue identified by this friendly name. :param str evaluate_task_attributes: The attributes of the Tasks to read. Returns the Tasks that match the attributes specified in this parameter. + :param str routing_target: A SID of a Worker, Queue, or Workflow to route a Task to :param str ordering: How to order the returned Task resources. By default, Tasks are sorted by ascending DateCreated. This value is specified as: `Attribute:Order`, where `Attribute` can be either `DateCreated`, `Priority`, or `VirtualStartTime` and `Order` can be either `asc` or `desc`. For example, `Priority:desc` returns Tasks ordered in descending order of their Priority. Pairings of sort orders can be specified in a comma-separated list such as `Priority:desc,DateCreated:asc`, which returns the Tasks in descending Priority order and ascending DateCreated Order. The only ordering pairing not allowed is DateCreated and VirtualStartTime. :param bool has_addons: Whether to read Tasks with Add-ons. If `true`, returns only Tasks with Add-ons. If `false`, returns only Tasks without Add-ons. :param limit: Upper limit for the number of records to return. list() guarantees @@ -750,6 +780,7 @@ def list( task_queue_sid=task_queue_sid, task_queue_name=task_queue_name, evaluate_task_attributes=evaluate_task_attributes, + routing_target=routing_target, ordering=ordering, has_addons=has_addons, limit=limit, @@ -766,6 +797,7 @@ async def list_async( task_queue_sid: Union[str, object] = values.unset, task_queue_name: Union[str, object] = values.unset, evaluate_task_attributes: Union[str, object] = values.unset, + routing_target: Union[str, object] = values.unset, ordering: Union[str, object] = values.unset, has_addons: Union[bool, object] = values.unset, limit: Optional[int] = None, @@ -783,6 +815,7 @@ async def list_async( :param str task_queue_sid: The SID of the TaskQueue with the Tasks to read. Returns the Tasks waiting in the TaskQueue identified by this SID. :param str task_queue_name: The `friendly_name` of the TaskQueue with the Tasks to read. Returns the Tasks waiting in the TaskQueue identified by this friendly name. :param str evaluate_task_attributes: The attributes of the Tasks to read. Returns the Tasks that match the attributes specified in this parameter. + :param str routing_target: A SID of a Worker, Queue, or Workflow to route a Task to :param str ordering: How to order the returned Task resources. By default, Tasks are sorted by ascending DateCreated. This value is specified as: `Attribute:Order`, where `Attribute` can be either `DateCreated`, `Priority`, or `VirtualStartTime` and `Order` can be either `asc` or `desc`. For example, `Priority:desc` returns Tasks ordered in descending order of their Priority. Pairings of sort orders can be specified in a comma-separated list such as `Priority:desc,DateCreated:asc`, which returns the Tasks in descending Priority order and ascending DateCreated Order. The only ordering pairing not allowed is DateCreated and VirtualStartTime. :param bool has_addons: Whether to read Tasks with Add-ons. If `true`, returns only Tasks with Add-ons. If `false`, returns only Tasks without Add-ons. :param limit: Upper limit for the number of records to return. list() guarantees @@ -804,6 +837,7 @@ async def list_async( task_queue_sid=task_queue_sid, task_queue_name=task_queue_name, evaluate_task_attributes=evaluate_task_attributes, + routing_target=routing_target, ordering=ordering, has_addons=has_addons, limit=limit, @@ -820,6 +854,7 @@ def page( task_queue_sid: Union[str, object] = values.unset, task_queue_name: Union[str, object] = values.unset, evaluate_task_attributes: Union[str, object] = values.unset, + routing_target: Union[str, object] = values.unset, ordering: Union[str, object] = values.unset, has_addons: Union[bool, object] = values.unset, page_token: Union[str, object] = values.unset, @@ -837,6 +872,7 @@ def page( :param task_queue_sid: The SID of the TaskQueue with the Tasks to read. Returns the Tasks waiting in the TaskQueue identified by this SID. :param task_queue_name: The `friendly_name` of the TaskQueue with the Tasks to read. Returns the Tasks waiting in the TaskQueue identified by this friendly name. :param evaluate_task_attributes: The attributes of the Tasks to read. Returns the Tasks that match the attributes specified in this parameter. + :param routing_target: A SID of a Worker, Queue, or Workflow to route a Task to :param ordering: How to order the returned Task resources. By default, Tasks are sorted by ascending DateCreated. This value is specified as: `Attribute:Order`, where `Attribute` can be either `DateCreated`, `Priority`, or `VirtualStartTime` and `Order` can be either `asc` or `desc`. For example, `Priority:desc` returns Tasks ordered in descending order of their Priority. Pairings of sort orders can be specified in a comma-separated list such as `Priority:desc,DateCreated:asc`, which returns the Tasks in descending Priority order and ascending DateCreated Order. The only ordering pairing not allowed is DateCreated and VirtualStartTime. :param has_addons: Whether to read Tasks with Add-ons. If `true`, returns only Tasks with Add-ons. If `false`, returns only Tasks without Add-ons. :param page_token: PageToken provided by the API @@ -854,6 +890,7 @@ def page( "TaskQueueSid": task_queue_sid, "TaskQueueName": task_queue_name, "EvaluateTaskAttributes": evaluate_task_attributes, + "RoutingTarget": routing_target, "Ordering": ordering, "HasAddons": serialize.boolean_to_string(has_addons), "PageToken": page_token, @@ -874,6 +911,7 @@ async def page_async( task_queue_sid: Union[str, object] = values.unset, task_queue_name: Union[str, object] = values.unset, evaluate_task_attributes: Union[str, object] = values.unset, + routing_target: Union[str, object] = values.unset, ordering: Union[str, object] = values.unset, has_addons: Union[bool, object] = values.unset, page_token: Union[str, object] = values.unset, @@ -891,6 +929,7 @@ async def page_async( :param task_queue_sid: The SID of the TaskQueue with the Tasks to read. Returns the Tasks waiting in the TaskQueue identified by this SID. :param task_queue_name: The `friendly_name` of the TaskQueue with the Tasks to read. Returns the Tasks waiting in the TaskQueue identified by this friendly name. :param evaluate_task_attributes: The attributes of the Tasks to read. Returns the Tasks that match the attributes specified in this parameter. + :param routing_target: A SID of a Worker, Queue, or Workflow to route a Task to :param ordering: How to order the returned Task resources. By default, Tasks are sorted by ascending DateCreated. This value is specified as: `Attribute:Order`, where `Attribute` can be either `DateCreated`, `Priority`, or `VirtualStartTime` and `Order` can be either `asc` or `desc`. For example, `Priority:desc` returns Tasks ordered in descending order of their Priority. Pairings of sort orders can be specified in a comma-separated list such as `Priority:desc,DateCreated:asc`, which returns the Tasks in descending Priority order and ascending DateCreated Order. The only ordering pairing not allowed is DateCreated and VirtualStartTime. :param has_addons: Whether to read Tasks with Add-ons. If `true`, returns only Tasks with Add-ons. If `false`, returns only Tasks without Add-ons. :param page_token: PageToken provided by the API @@ -908,6 +947,7 @@ async def page_async( "TaskQueueSid": task_queue_sid, "TaskQueueName": task_queue_name, "EvaluateTaskAttributes": evaluate_task_attributes, + "RoutingTarget": routing_target, "Ordering": ordering, "HasAddons": serialize.boolean_to_string(has_addons), "PageToken": page_token, diff --git a/twilio/rest/trusthub/v1/compliance_tollfree_inquiries.py b/twilio/rest/trusthub/v1/compliance_tollfree_inquiries.py index 6c9d5b3d9b..490f68b4e6 100644 --- a/twilio/rest/trusthub/v1/compliance_tollfree_inquiries.py +++ b/twilio/rest/trusthub/v1/compliance_tollfree_inquiries.py @@ -92,6 +92,7 @@ def create( business_contact_last_name: Union[str, object] = values.unset, business_contact_email: Union[str, object] = values.unset, business_contact_phone: Union[str, object] = values.unset, + theme_set_id: Union[str, object] = values.unset, ) -> ComplianceTollfreeInquiriesInstance: """ Create the ComplianceTollfreeInquiriesInstance @@ -117,6 +118,7 @@ def create( :param business_contact_last_name: The last name of the contact for the business or organization using the Tollfree number. :param business_contact_email: The email address of the contact for the business or organization using the Tollfree number. :param business_contact_phone: The phone number of the contact for the business or organization using the Tollfree number. + :param theme_set_id: Theme id for styling the inquiry form. :returns: The created ComplianceTollfreeInquiriesInstance """ @@ -144,6 +146,7 @@ def create( "BusinessContactLastName": business_contact_last_name, "BusinessContactEmail": business_contact_email, "BusinessContactPhone": business_contact_phone, + "ThemeSetId": theme_set_id, } ) @@ -180,6 +183,7 @@ async def create_async( business_contact_last_name: Union[str, object] = values.unset, business_contact_email: Union[str, object] = values.unset, business_contact_phone: Union[str, object] = values.unset, + theme_set_id: Union[str, object] = values.unset, ) -> ComplianceTollfreeInquiriesInstance: """ Asynchronously create the ComplianceTollfreeInquiriesInstance @@ -205,6 +209,7 @@ async def create_async( :param business_contact_last_name: The last name of the contact for the business or organization using the Tollfree number. :param business_contact_email: The email address of the contact for the business or organization using the Tollfree number. :param business_contact_phone: The phone number of the contact for the business or organization using the Tollfree number. + :param theme_set_id: Theme id for styling the inquiry form. :returns: The created ComplianceTollfreeInquiriesInstance """ @@ -232,6 +237,7 @@ async def create_async( "BusinessContactLastName": business_contact_last_name, "BusinessContactEmail": business_contact_email, "BusinessContactPhone": business_contact_phone, + "ThemeSetId": theme_set_id, } ) diff --git a/twilio/rest/trusthub/v1/customer_profiles/__init__.py b/twilio/rest/trusthub/v1/customer_profiles/__init__.py index a16ae0e73b..5365092777 100644 --- a/twilio/rest/trusthub/v1/customer_profiles/__init__.py +++ b/twilio/rest/trusthub/v1/customer_profiles/__init__.py @@ -53,6 +53,7 @@ class Status(object): :ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. :ivar url: The absolute URL of the Customer-Profile resource. :ivar links: The URLs of the Assigned Items of the Customer-Profile resource. + :ivar errors: The error codes associated with the rejection of the Customer-Profile. """ def __init__( @@ -78,6 +79,7 @@ def __init__( ) self.url: Optional[str] = payload.get("url") self.links: Optional[Dict[str, object]] = payload.get("links") + self.errors: Optional[List[Dict[str, object]]] = payload.get("errors") self._solution = { "sid": sid or self.sid, diff --git a/twilio/rest/trusthub/v1/trust_products/__init__.py b/twilio/rest/trusthub/v1/trust_products/__init__.py index b74e8e842e..35f233cc7a 100644 --- a/twilio/rest/trusthub/v1/trust_products/__init__.py +++ b/twilio/rest/trusthub/v1/trust_products/__init__.py @@ -53,6 +53,7 @@ class Status(object): :ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. :ivar url: The absolute URL of the Trust Product resource. :ivar links: The URLs of the Assigned Items of the Trust Product resource. + :ivar errors: The error codes associated with the rejection of the Trust Product. """ def __init__( @@ -78,6 +79,7 @@ def __init__( ) self.url: Optional[str] = payload.get("url") self.links: Optional[Dict[str, object]] = payload.get("links") + self.errors: Optional[List[Dict[str, object]]] = payload.get("errors") self._solution = { "sid": sid or self.sid, diff --git a/twilio/rest/verify/v2/service/__init__.py b/twilio/rest/verify/v2/service/__init__.py index 7ea0b0ab56..36d7c1058b 100644 --- a/twilio/rest/verify/v2/service/__init__.py +++ b/twilio/rest/verify/v2/service/__init__.py @@ -35,7 +35,7 @@ class ServiceInstance(InstanceResource): """ :ivar sid: The unique string that we created to identify the Service resource. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. - :ivar friendly_name: The string that you assigned to describe the verification service. It can be up to 32 characters long. **This value should not contain PII.** + :ivar friendly_name: The name that appears in the body of your verification messages. It can be up to 30 characters long and can include letters, numbers, spaces, dashes, underscores. Phone numbers, special characters or links are NOT allowed. **This value should not contain PII.** :ivar code_length: The length of the verification code to generate. :ivar lookup_enabled: Whether to perform a lookup with each verification started and return info about the phone number. :ivar psd2_enabled: Whether to pass PSD2 transaction parameters when starting a verification. diff --git a/twilio/rest/verify/v2/service/verification.py b/twilio/rest/verify/v2/service/verification.py index 1c42043a3d..3ab719551b 100644 --- a/twilio/rest/verify/v2/service/verification.py +++ b/twilio/rest/verify/v2/service/verification.py @@ -44,7 +44,7 @@ class Status(object): :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Verification resource. :ivar to: The phone number or [email](https://www.twilio.com/docs/verify/email) being verified. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). :ivar channel: - :ivar status: The status of the verification. One of: `pending`, `approved`, or `canceled` + :ivar status: The status of the verification. Can be: `pending`, `approved`, `canceled`, `max_attempts_reached`, `deleted`, `failed` or `expired`. :ivar valid: Use \"status\" instead. Legacy property indicating whether the verification was successful. :ivar lookup: Information about the phone number being verified. :ivar amount: The amount of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. diff --git a/twilio/rest/verify/v2/service/verification_check.py b/twilio/rest/verify/v2/service/verification_check.py index 9cd92487e4..9744b1bbab 100644 --- a/twilio/rest/verify/v2/service/verification_check.py +++ b/twilio/rest/verify/v2/service/verification_check.py @@ -36,7 +36,7 @@ class Channel(object): :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the VerificationCheck resource. :ivar to: The phone number or [email](https://www.twilio.com/docs/verify/email) being verified. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). :ivar channel: - :ivar status: The status of the verification. Can be: `pending`, `approved`, or `canceled`. + :ivar status: The status of the verification. Can be: `pending`, `approved`, `canceled`, `max_attempts_reached`, `deleted`, `failed` or `expired`. :ivar valid: Use \"status\" instead. Legacy property indicating whether the verification was successful. :ivar amount: The amount of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. :ivar payee: The payee of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. From 6760ac2b5ffb0a6b54636a3ad3a81a220a6b4c52 Mon Sep 17 00:00:00 2001 From: Twilio Date: Fri, 24 May 2024 11:07:39 +0000 Subject: [PATCH 11/87] Release 9.1.0 --- setup.py | 2 +- twilio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index ed82dddb26..6745e08343 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name="twilio", - version="9.0.5", + version="9.1.0", description="Twilio API client and TwiML generator", author="Twilio", help_center="https://www.twilio.com/help/contact", diff --git a/twilio/__init__.py b/twilio/__init__.py index a5d6bc795f..f6647e7a8f 100644 --- a/twilio/__init__.py +++ b/twilio/__init__.py @@ -1,2 +1,2 @@ -__version_info__ = ("9", "0", "5") +__version_info__ = ("9", "1", "0") __version__ = ".".join(__version_info__) From f20b62e6e6a5c8138cc848d51f041e65e2e8394d Mon Sep 17 00:00:00 2001 From: Twilio Date: Thu, 6 Jun 2024 11:41:18 +0000 Subject: [PATCH 12/87] [Librarian] Regenerated @ b8a450aff168b5449d658833256ca2354e3ecbbc df505752cdef00170b029d7b720bbc359933bf82 --- CHANGES.md | 12 + twilio/rest/__init__.py | 15 + .../api/v2010/account/message/__init__.py | 8 +- twilio/rest/content/v1/legacy_content.py | 2 +- twilio/rest/content/v2/content.py | 172 ++++- .../rest/content/v2/content_and_approvals.py | 172 ++++- twilio/rest/marketplace/MarketplaceBase.py | 44 ++ twilio/rest/marketplace/v1/__init__.py | 59 ++ .../v1/available_add_on/__init__.py | 424 +++++++++++ .../available_add_on_extension.py | 431 ++++++++++++ .../v1/installed_add_on/__init__.py | 664 ++++++++++++++++++ .../installed_add_on_extension.py | 511 ++++++++++++++ .../installed_add_on_usage.py | 166 +++++ .../marketplace/v1/module_data_management.py | 325 +++++++++ .../messaging/v1/tollfree_verification.py | 37 + twilio/rest/numbers/v1/__init__.py | 12 + .../v1/signing_request_configuration.py | 116 +++ 17 files changed, 3159 insertions(+), 11 deletions(-) create mode 100644 twilio/rest/marketplace/MarketplaceBase.py create mode 100644 twilio/rest/marketplace/v1/__init__.py create mode 100644 twilio/rest/marketplace/v1/available_add_on/__init__.py create mode 100644 twilio/rest/marketplace/v1/available_add_on/available_add_on_extension.py create mode 100644 twilio/rest/marketplace/v1/installed_add_on/__init__.py create mode 100644 twilio/rest/marketplace/v1/installed_add_on/installed_add_on_extension.py create mode 100644 twilio/rest/marketplace/v1/installed_add_on/installed_add_on_usage.py create mode 100644 twilio/rest/marketplace/v1/module_data_management.py create mode 100644 twilio/rest/numbers/v1/signing_request_configuration.py diff --git a/CHANGES.md b/CHANGES.md index a6c5a45f2d..1dfa5043a6 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,18 @@ twilio-python Changelog Here you can see the full list of changes between each twilio-python release. +[2024-06-06] Version 9.1.1 +-------------------------- +**Api** +- Mark MaxPrice as obsolete + +**Lookups** +- Update examples for `phone_number_quality_score` + +**Messaging** +- List tollfree verifications on parent account and all sub-accounts + + [2024-05-24] Version 9.1.0 -------------------------- **Library - Chore** diff --git a/twilio/rest/__init__.py b/twilio/rest/__init__.py index 0d3d96bfec..2dc0a4930f 100644 --- a/twilio/rest/__init__.py +++ b/twilio/rest/__init__.py @@ -27,6 +27,7 @@ from twilio.rest.intelligence import Intelligence from twilio.rest.ip_messaging import IpMessaging from twilio.rest.lookups import Lookups + from twilio.rest.marketplace import Marketplace from twilio.rest.messaging import Messaging from twilio.rest.microvisor import Microvisor from twilio.rest.monitor import Monitor @@ -134,6 +135,7 @@ def __init__( self._intelligence: Optional["Intelligence"] = None self._ip_messaging: Optional["IpMessaging"] = None self._lookups: Optional["Lookups"] = None + self._marketplace: Optional["Marketplace"] = None self._messaging: Optional["Messaging"] = None self._microvisor: Optional["Microvisor"] = None self._monitor: Optional["Monitor"] = None @@ -325,6 +327,19 @@ def lookups(self) -> "Lookups": self._lookups = Lookups(self) return self._lookups + @property + def marketplace(self) -> "Marketplace": + """ + Access the Marketplace Twilio Domain + + :returns: Marketplace Twilio Domain + """ + if self._marketplace is None: + from twilio.rest.marketplace import Marketplace + + self._marketplace = Marketplace(self) + return self._marketplace + @property def messaging(self) -> "Messaging": """ diff --git a/twilio/rest/api/v2010/account/message/__init__.py b/twilio/rest/api/v2010/account/message/__init__.py index 953d3d8008..ff0ed8561f 100644 --- a/twilio/rest/api/v2010/account/message/__init__.py +++ b/twilio/rest/api/v2010/account/message/__init__.py @@ -509,10 +509,10 @@ def create( :param to: The recipient's phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (for SMS/MMS) or [channel address](https://www.twilio.com/docs/messaging/channels), e.g. `whatsapp:+15552229999`. :param status_callback: The URL of the endpoint to which Twilio sends [Message status callback requests](https://www.twilio.com/docs/sms/api/message-resource#twilios-request-to-the-statuscallback-url). URL must contain a valid hostname and underscores are not allowed. If you include this parameter with the `messaging_service_sid`, Twilio uses this URL instead of the Status Callback URL of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource). :param application_sid: The SID of the associated [TwiML Application](https://www.twilio.com/docs/usage/api/applications). [Message status callback requests](https://www.twilio.com/docs/sms/api/message-resource#twilios-request-to-the-statuscallback-url) are sent to the TwiML App's `message_status_callback` URL. Note that the `status_callback` parameter of a request takes priority over the `application_sid` parameter; if both are included `application_sid` is ignored. - :param max_price: [DEPRECATED] This parameter will no longer have any effect as of 2024-06-03. + :param max_price: [OBSOLETE] This parameter will no longer have any effect as of 2024-06-03. :param provide_feedback: Boolean indicating whether or not you intend to provide delivery confirmation feedback to Twilio (used in conjunction with the [Message Feedback subresource](https://www.twilio.com/docs/sms/api/message-feedback-resource)). Default value is `false`. :param attempt: Total number of attempts made (including this request) to send the message regardless of the provider used - :param validity_period: The maximum length in seconds that the Message can remain in Twilio's outgoing message queue. If a queued Message exceeds the `validity_period`, the Message is not sent. Accepted values are integers from `1` to `14400`. Default value is `14400`. A `validity_period` greater than `5` is recommended. [Learn more about the validity period](https://www.twilio.com/blog/take-more-control-of-outbound-messages-using-validity-period-html) + :param validity_period: The maximum length in seconds that the Message can remain in Twilio's outgoing message queue. If a queued Message exceeds the `validity_period`, the Message is not sent. Accepted values are integers from `1` to `36000`. Default value is `36000`. A `validity_period` greater than `5` is recommended. [Learn more about the validity period](https://www.twilio.com/blog/take-more-control-of-outbound-messages-using-validity-period-html) :param force_delivery: Reserved :param content_retention: :param address_retention: @@ -607,10 +607,10 @@ async def create_async( :param to: The recipient's phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (for SMS/MMS) or [channel address](https://www.twilio.com/docs/messaging/channels), e.g. `whatsapp:+15552229999`. :param status_callback: The URL of the endpoint to which Twilio sends [Message status callback requests](https://www.twilio.com/docs/sms/api/message-resource#twilios-request-to-the-statuscallback-url). URL must contain a valid hostname and underscores are not allowed. If you include this parameter with the `messaging_service_sid`, Twilio uses this URL instead of the Status Callback URL of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource). :param application_sid: The SID of the associated [TwiML Application](https://www.twilio.com/docs/usage/api/applications). [Message status callback requests](https://www.twilio.com/docs/sms/api/message-resource#twilios-request-to-the-statuscallback-url) are sent to the TwiML App's `message_status_callback` URL. Note that the `status_callback` parameter of a request takes priority over the `application_sid` parameter; if both are included `application_sid` is ignored. - :param max_price: [DEPRECATED] This parameter will no longer have any effect as of 2024-06-03. + :param max_price: [OBSOLETE] This parameter will no longer have any effect as of 2024-06-03. :param provide_feedback: Boolean indicating whether or not you intend to provide delivery confirmation feedback to Twilio (used in conjunction with the [Message Feedback subresource](https://www.twilio.com/docs/sms/api/message-feedback-resource)). Default value is `false`. :param attempt: Total number of attempts made (including this request) to send the message regardless of the provider used - :param validity_period: The maximum length in seconds that the Message can remain in Twilio's outgoing message queue. If a queued Message exceeds the `validity_period`, the Message is not sent. Accepted values are integers from `1` to `14400`. Default value is `14400`. A `validity_period` greater than `5` is recommended. [Learn more about the validity period](https://www.twilio.com/blog/take-more-control-of-outbound-messages-using-validity-period-html) + :param validity_period: The maximum length in seconds that the Message can remain in Twilio's outgoing message queue. If a queued Message exceeds the `validity_period`, the Message is not sent. Accepted values are integers from `1` to `36000`. Default value is `36000`. A `validity_period` greater than `5` is recommended. [Learn more about the validity period](https://www.twilio.com/blog/take-more-control-of-outbound-messages-using-validity-period-html) :param force_delivery: Reserved :param content_retention: :param address_retention: diff --git a/twilio/rest/content/v1/legacy_content.py b/twilio/rest/content/v1/legacy_content.py index cfb4ac698d..5705c33b0b 100644 --- a/twilio/rest/content/v1/legacy_content.py +++ b/twilio/rest/content/v1/legacy_content.py @@ -31,7 +31,7 @@ class LegacyContentInstance(InstanceResource): :ivar friendly_name: A string name used to describe the Content resource. Not visible to the end recipient. :ivar language: Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in. :ivar variables: Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}. - :ivar types: The [Content types](https://www.twilio.com/docs/content-api/content-types-overview) (e.g. twilio/text) for this Content resource. + :ivar types: The [Content types](https://www.twilio.com/docs/content/content-types-overview) (e.g. twilio/text) for this Content resource. :ivar legacy_template_name: The string name of the legacy content template associated with this Content resource, unique across all template names for its account. Only lowercase letters, numbers and underscores are allowed :ivar legacy_body: The string body field of the legacy content template associated with this Content resource :ivar url: The URL of the resource, relative to `https://content.twilio.com`. diff --git a/twilio/rest/content/v2/content.py b/twilio/rest/content/v2/content.py index 88ae80f1c0..c8abf4dcda 100644 --- a/twilio/rest/content/v2/content.py +++ b/twilio/rest/content/v2/content.py @@ -14,7 +14,7 @@ from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -98,6 +98,15 @@ def __init__(self, version: Version): def stream( self, + sort_by_date: Union[str, object] = values.unset, + sort_by_content_name: Union[str, object] = values.unset, + date_created_after: Union[datetime, object] = values.unset, + date_created_before: Union[datetime, object] = values.unset, + content_name: Union[str, object] = values.unset, + content: Union[str, object] = values.unset, + language: Union[List[str], object] = values.unset, + content_type: Union[List[str], object] = values.unset, + channel_eligibility: Union[List[str], object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> Iterator[ContentInstance]: @@ -107,6 +116,15 @@ def stream( is reached. The results are returned as a generator, so this operation is memory efficient. + :param str sort_by_date: Whether to sort by ascending or descending date updated + :param str sort_by_content_name: Whether to sort by ascending or descending content name + :param datetime date_created_after: Filter by >=[date-time] + :param datetime date_created_before: Filter by <=[date-time] + :param str content_name: Filter by Regex Pattern in content name + :param str content: Filter by Regex Pattern in template content + :param List[str] language: Filter by array of valid language(s) + :param List[str] content_type: Filter by array of contentType(s) + :param List[str] channel_eligibility: Filter by array of ChannelEligibility(s), where ChannelEligibility=: :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 @@ -117,12 +135,32 @@ def stream( :returns: Generator that will yield up to limit results """ limits = self._version.read_limits(limit, page_size) - page = self.page(page_size=limits["page_size"]) + page = self.page( + sort_by_date=sort_by_date, + sort_by_content_name=sort_by_content_name, + date_created_after=date_created_after, + date_created_before=date_created_before, + content_name=content_name, + content=content, + language=language, + content_type=content_type, + channel_eligibility=channel_eligibility, + page_size=limits["page_size"], + ) return self._version.stream(page, limits["limit"]) async def stream_async( self, + sort_by_date: Union[str, object] = values.unset, + sort_by_content_name: Union[str, object] = values.unset, + date_created_after: Union[datetime, object] = values.unset, + date_created_before: Union[datetime, object] = values.unset, + content_name: Union[str, object] = values.unset, + content: Union[str, object] = values.unset, + language: Union[List[str], object] = values.unset, + content_type: Union[List[str], object] = values.unset, + channel_eligibility: Union[List[str], object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> AsyncIterator[ContentInstance]: @@ -132,6 +170,15 @@ async def stream_async( is reached. The results are returned as a generator, so this operation is memory efficient. + :param str sort_by_date: Whether to sort by ascending or descending date updated + :param str sort_by_content_name: Whether to sort by ascending or descending content name + :param datetime date_created_after: Filter by >=[date-time] + :param datetime date_created_before: Filter by <=[date-time] + :param str content_name: Filter by Regex Pattern in content name + :param str content: Filter by Regex Pattern in template content + :param List[str] language: Filter by array of valid language(s) + :param List[str] content_type: Filter by array of contentType(s) + :param List[str] channel_eligibility: Filter by array of ChannelEligibility(s), where ChannelEligibility=: :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 @@ -142,12 +189,32 @@ async def stream_async( :returns: Generator that will yield up to limit results """ limits = self._version.read_limits(limit, page_size) - page = await self.page_async(page_size=limits["page_size"]) + page = await self.page_async( + sort_by_date=sort_by_date, + sort_by_content_name=sort_by_content_name, + date_created_after=date_created_after, + date_created_before=date_created_before, + content_name=content_name, + content=content, + language=language, + content_type=content_type, + channel_eligibility=channel_eligibility, + page_size=limits["page_size"], + ) return self._version.stream_async(page, limits["limit"]) def list( self, + sort_by_date: Union[str, object] = values.unset, + sort_by_content_name: Union[str, object] = values.unset, + date_created_after: Union[datetime, object] = values.unset, + date_created_before: Union[datetime, object] = values.unset, + content_name: Union[str, object] = values.unset, + content: Union[str, object] = values.unset, + language: Union[List[str], object] = values.unset, + content_type: Union[List[str], object] = values.unset, + channel_eligibility: Union[List[str], object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> List[ContentInstance]: @@ -156,6 +223,15 @@ def list( Unlike stream(), this operation is eager and will load `limit` records into memory before returning. + :param str sort_by_date: Whether to sort by ascending or descending date updated + :param str sort_by_content_name: Whether to sort by ascending or descending content name + :param datetime date_created_after: Filter by >=[date-time] + :param datetime date_created_before: Filter by <=[date-time] + :param str content_name: Filter by Regex Pattern in content name + :param str content: Filter by Regex Pattern in template content + :param List[str] language: Filter by array of valid language(s) + :param List[str] content_type: Filter by array of contentType(s) + :param List[str] channel_eligibility: Filter by array of ChannelEligibility(s), where ChannelEligibility=: :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 @@ -167,6 +243,15 @@ def list( """ return list( self.stream( + sort_by_date=sort_by_date, + sort_by_content_name=sort_by_content_name, + date_created_after=date_created_after, + date_created_before=date_created_before, + content_name=content_name, + content=content, + language=language, + content_type=content_type, + channel_eligibility=channel_eligibility, limit=limit, page_size=page_size, ) @@ -174,6 +259,15 @@ def list( async def list_async( self, + sort_by_date: Union[str, object] = values.unset, + sort_by_content_name: Union[str, object] = values.unset, + date_created_after: Union[datetime, object] = values.unset, + date_created_before: Union[datetime, object] = values.unset, + content_name: Union[str, object] = values.unset, + content: Union[str, object] = values.unset, + language: Union[List[str], object] = values.unset, + content_type: Union[List[str], object] = values.unset, + channel_eligibility: Union[List[str], object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> List[ContentInstance]: @@ -182,6 +276,15 @@ async def list_async( Unlike stream(), this operation is eager and will load `limit` records into memory before returning. + :param str sort_by_date: Whether to sort by ascending or descending date updated + :param str sort_by_content_name: Whether to sort by ascending or descending content name + :param datetime date_created_after: Filter by >=[date-time] + :param datetime date_created_before: Filter by <=[date-time] + :param str content_name: Filter by Regex Pattern in content name + :param str content: Filter by Regex Pattern in template content + :param List[str] language: Filter by array of valid language(s) + :param List[str] content_type: Filter by array of contentType(s) + :param List[str] channel_eligibility: Filter by array of ChannelEligibility(s), where ChannelEligibility=: :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 @@ -194,6 +297,15 @@ async def list_async( return [ record async for record in await self.stream_async( + sort_by_date=sort_by_date, + sort_by_content_name=sort_by_content_name, + date_created_after=date_created_after, + date_created_before=date_created_before, + content_name=content_name, + content=content, + language=language, + content_type=content_type, + channel_eligibility=channel_eligibility, limit=limit, page_size=page_size, ) @@ -201,6 +313,15 @@ async def list_async( def page( self, + sort_by_date: Union[str, object] = values.unset, + sort_by_content_name: Union[str, object] = values.unset, + date_created_after: Union[datetime, object] = values.unset, + date_created_before: Union[datetime, object] = values.unset, + content_name: Union[str, object] = values.unset, + content: Union[str, object] = values.unset, + language: Union[List[str], object] = values.unset, + content_type: Union[List[str], object] = values.unset, + channel_eligibility: Union[List[str], object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, page_size: Union[int, object] = values.unset, @@ -209,6 +330,15 @@ def page( Retrieve a single page of ContentInstance records from the API. Request is executed immediately + :param sort_by_date: Whether to sort by ascending or descending date updated + :param sort_by_content_name: Whether to sort by ascending or descending content name + :param date_created_after: Filter by >=[date-time] + :param date_created_before: Filter by <=[date-time] + :param content_name: Filter by Regex Pattern in content name + :param content: Filter by Regex Pattern in template content + :param language: Filter by array of valid language(s) + :param content_type: Filter by array of contentType(s) + :param channel_eligibility: Filter by array of ChannelEligibility(s), where ChannelEligibility=: :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 @@ -217,6 +347,15 @@ def page( """ data = values.of( { + "SortByDate": sort_by_date, + "SortByContentName": sort_by_content_name, + "DateCreatedAfter": serialize.iso8601_datetime(date_created_after), + "DateCreatedBefore": serialize.iso8601_datetime(date_created_before), + "ContentName": content_name, + "Content": content, + "Language": serialize.map(language, lambda e: e), + "ContentType": serialize.map(content_type, lambda e: e), + "ChannelEligibility": serialize.map(channel_eligibility, lambda e: e), "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -228,6 +367,15 @@ def page( async def page_async( self, + sort_by_date: Union[str, object] = values.unset, + sort_by_content_name: Union[str, object] = values.unset, + date_created_after: Union[datetime, object] = values.unset, + date_created_before: Union[datetime, object] = values.unset, + content_name: Union[str, object] = values.unset, + content: Union[str, object] = values.unset, + language: Union[List[str], object] = values.unset, + content_type: Union[List[str], object] = values.unset, + channel_eligibility: Union[List[str], object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, page_size: Union[int, object] = values.unset, @@ -236,6 +384,15 @@ async def page_async( Asynchronously retrieve a single page of ContentInstance records from the API. Request is executed immediately + :param sort_by_date: Whether to sort by ascending or descending date updated + :param sort_by_content_name: Whether to sort by ascending or descending content name + :param date_created_after: Filter by >=[date-time] + :param date_created_before: Filter by <=[date-time] + :param content_name: Filter by Regex Pattern in content name + :param content: Filter by Regex Pattern in template content + :param language: Filter by array of valid language(s) + :param content_type: Filter by array of contentType(s) + :param channel_eligibility: Filter by array of ChannelEligibility(s), where ChannelEligibility=: :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 @@ -244,6 +401,15 @@ async def page_async( """ data = values.of( { + "SortByDate": sort_by_date, + "SortByContentName": sort_by_content_name, + "DateCreatedAfter": serialize.iso8601_datetime(date_created_after), + "DateCreatedBefore": serialize.iso8601_datetime(date_created_before), + "ContentName": content_name, + "Content": content, + "Language": serialize.map(language, lambda e: e), + "ContentType": serialize.map(content_type, lambda e: e), + "ChannelEligibility": serialize.map(channel_eligibility, lambda e: e), "PageToken": page_token, "Page": page_number, "PageSize": page_size, diff --git a/twilio/rest/content/v2/content_and_approvals.py b/twilio/rest/content/v2/content_and_approvals.py index 7a3e6d9ccf..4c081b9e22 100644 --- a/twilio/rest/content/v2/content_and_approvals.py +++ b/twilio/rest/content/v2/content_and_approvals.py @@ -14,7 +14,7 @@ from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -98,6 +98,15 @@ def __init__(self, version: Version): def stream( self, + sort_by_date: Union[str, object] = values.unset, + sort_by_content_name: Union[str, object] = values.unset, + date_created_after: Union[datetime, object] = values.unset, + date_created_before: Union[datetime, object] = values.unset, + content_name: Union[str, object] = values.unset, + content: Union[str, object] = values.unset, + language: Union[List[str], object] = values.unset, + content_type: Union[List[str], object] = values.unset, + channel_eligibility: Union[List[str], object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> Iterator[ContentAndApprovalsInstance]: @@ -107,6 +116,15 @@ def stream( is reached. The results are returned as a generator, so this operation is memory efficient. + :param str sort_by_date: Whether to sort by ascending or descending date updated + :param str sort_by_content_name: Whether to sort by ascending or descending content name + :param datetime date_created_after: Filter by >=[date-time] + :param datetime date_created_before: Filter by <=[date-time] + :param str content_name: Filter by Regex Pattern in content name + :param str content: Filter by Regex Pattern in template content + :param List[str] language: Filter by array of valid language(s) + :param List[str] content_type: Filter by array of contentType(s) + :param List[str] channel_eligibility: Filter by array of ChannelEligibility(s), where ChannelEligibility=: :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 @@ -117,12 +135,32 @@ def stream( :returns: Generator that will yield up to limit results """ limits = self._version.read_limits(limit, page_size) - page = self.page(page_size=limits["page_size"]) + page = self.page( + sort_by_date=sort_by_date, + sort_by_content_name=sort_by_content_name, + date_created_after=date_created_after, + date_created_before=date_created_before, + content_name=content_name, + content=content, + language=language, + content_type=content_type, + channel_eligibility=channel_eligibility, + page_size=limits["page_size"], + ) return self._version.stream(page, limits["limit"]) async def stream_async( self, + sort_by_date: Union[str, object] = values.unset, + sort_by_content_name: Union[str, object] = values.unset, + date_created_after: Union[datetime, object] = values.unset, + date_created_before: Union[datetime, object] = values.unset, + content_name: Union[str, object] = values.unset, + content: Union[str, object] = values.unset, + language: Union[List[str], object] = values.unset, + content_type: Union[List[str], object] = values.unset, + channel_eligibility: Union[List[str], object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> AsyncIterator[ContentAndApprovalsInstance]: @@ -132,6 +170,15 @@ async def stream_async( is reached. The results are returned as a generator, so this operation is memory efficient. + :param str sort_by_date: Whether to sort by ascending or descending date updated + :param str sort_by_content_name: Whether to sort by ascending or descending content name + :param datetime date_created_after: Filter by >=[date-time] + :param datetime date_created_before: Filter by <=[date-time] + :param str content_name: Filter by Regex Pattern in content name + :param str content: Filter by Regex Pattern in template content + :param List[str] language: Filter by array of valid language(s) + :param List[str] content_type: Filter by array of contentType(s) + :param List[str] channel_eligibility: Filter by array of ChannelEligibility(s), where ChannelEligibility=: :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 @@ -142,12 +189,32 @@ async def stream_async( :returns: Generator that will yield up to limit results """ limits = self._version.read_limits(limit, page_size) - page = await self.page_async(page_size=limits["page_size"]) + page = await self.page_async( + sort_by_date=sort_by_date, + sort_by_content_name=sort_by_content_name, + date_created_after=date_created_after, + date_created_before=date_created_before, + content_name=content_name, + content=content, + language=language, + content_type=content_type, + channel_eligibility=channel_eligibility, + page_size=limits["page_size"], + ) return self._version.stream_async(page, limits["limit"]) def list( self, + sort_by_date: Union[str, object] = values.unset, + sort_by_content_name: Union[str, object] = values.unset, + date_created_after: Union[datetime, object] = values.unset, + date_created_before: Union[datetime, object] = values.unset, + content_name: Union[str, object] = values.unset, + content: Union[str, object] = values.unset, + language: Union[List[str], object] = values.unset, + content_type: Union[List[str], object] = values.unset, + channel_eligibility: Union[List[str], object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> List[ContentAndApprovalsInstance]: @@ -156,6 +223,15 @@ def list( Unlike stream(), this operation is eager and will load `limit` records into memory before returning. + :param str sort_by_date: Whether to sort by ascending or descending date updated + :param str sort_by_content_name: Whether to sort by ascending or descending content name + :param datetime date_created_after: Filter by >=[date-time] + :param datetime date_created_before: Filter by <=[date-time] + :param str content_name: Filter by Regex Pattern in content name + :param str content: Filter by Regex Pattern in template content + :param List[str] language: Filter by array of valid language(s) + :param List[str] content_type: Filter by array of contentType(s) + :param List[str] channel_eligibility: Filter by array of ChannelEligibility(s), where ChannelEligibility=: :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 @@ -167,6 +243,15 @@ def list( """ return list( self.stream( + sort_by_date=sort_by_date, + sort_by_content_name=sort_by_content_name, + date_created_after=date_created_after, + date_created_before=date_created_before, + content_name=content_name, + content=content, + language=language, + content_type=content_type, + channel_eligibility=channel_eligibility, limit=limit, page_size=page_size, ) @@ -174,6 +259,15 @@ def list( async def list_async( self, + sort_by_date: Union[str, object] = values.unset, + sort_by_content_name: Union[str, object] = values.unset, + date_created_after: Union[datetime, object] = values.unset, + date_created_before: Union[datetime, object] = values.unset, + content_name: Union[str, object] = values.unset, + content: Union[str, object] = values.unset, + language: Union[List[str], object] = values.unset, + content_type: Union[List[str], object] = values.unset, + channel_eligibility: Union[List[str], object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> List[ContentAndApprovalsInstance]: @@ -182,6 +276,15 @@ async def list_async( Unlike stream(), this operation is eager and will load `limit` records into memory before returning. + :param str sort_by_date: Whether to sort by ascending or descending date updated + :param str sort_by_content_name: Whether to sort by ascending or descending content name + :param datetime date_created_after: Filter by >=[date-time] + :param datetime date_created_before: Filter by <=[date-time] + :param str content_name: Filter by Regex Pattern in content name + :param str content: Filter by Regex Pattern in template content + :param List[str] language: Filter by array of valid language(s) + :param List[str] content_type: Filter by array of contentType(s) + :param List[str] channel_eligibility: Filter by array of ChannelEligibility(s), where ChannelEligibility=: :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 @@ -194,6 +297,15 @@ async def list_async( return [ record async for record in await self.stream_async( + sort_by_date=sort_by_date, + sort_by_content_name=sort_by_content_name, + date_created_after=date_created_after, + date_created_before=date_created_before, + content_name=content_name, + content=content, + language=language, + content_type=content_type, + channel_eligibility=channel_eligibility, limit=limit, page_size=page_size, ) @@ -201,6 +313,15 @@ async def list_async( def page( self, + sort_by_date: Union[str, object] = values.unset, + sort_by_content_name: Union[str, object] = values.unset, + date_created_after: Union[datetime, object] = values.unset, + date_created_before: Union[datetime, object] = values.unset, + content_name: Union[str, object] = values.unset, + content: Union[str, object] = values.unset, + language: Union[List[str], object] = values.unset, + content_type: Union[List[str], object] = values.unset, + channel_eligibility: Union[List[str], object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, page_size: Union[int, object] = values.unset, @@ -209,6 +330,15 @@ def page( Retrieve a single page of ContentAndApprovalsInstance records from the API. Request is executed immediately + :param sort_by_date: Whether to sort by ascending or descending date updated + :param sort_by_content_name: Whether to sort by ascending or descending content name + :param date_created_after: Filter by >=[date-time] + :param date_created_before: Filter by <=[date-time] + :param content_name: Filter by Regex Pattern in content name + :param content: Filter by Regex Pattern in template content + :param language: Filter by array of valid language(s) + :param content_type: Filter by array of contentType(s) + :param channel_eligibility: Filter by array of ChannelEligibility(s), where ChannelEligibility=: :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 @@ -217,6 +347,15 @@ def page( """ data = values.of( { + "SortByDate": sort_by_date, + "SortByContentName": sort_by_content_name, + "DateCreatedAfter": serialize.iso8601_datetime(date_created_after), + "DateCreatedBefore": serialize.iso8601_datetime(date_created_before), + "ContentName": content_name, + "Content": content, + "Language": serialize.map(language, lambda e: e), + "ContentType": serialize.map(content_type, lambda e: e), + "ChannelEligibility": serialize.map(channel_eligibility, lambda e: e), "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -228,6 +367,15 @@ def page( async def page_async( self, + sort_by_date: Union[str, object] = values.unset, + sort_by_content_name: Union[str, object] = values.unset, + date_created_after: Union[datetime, object] = values.unset, + date_created_before: Union[datetime, object] = values.unset, + content_name: Union[str, object] = values.unset, + content: Union[str, object] = values.unset, + language: Union[List[str], object] = values.unset, + content_type: Union[List[str], object] = values.unset, + channel_eligibility: Union[List[str], object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, page_size: Union[int, object] = values.unset, @@ -236,6 +384,15 @@ async def page_async( Asynchronously retrieve a single page of ContentAndApprovalsInstance records from the API. Request is executed immediately + :param sort_by_date: Whether to sort by ascending or descending date updated + :param sort_by_content_name: Whether to sort by ascending or descending content name + :param date_created_after: Filter by >=[date-time] + :param date_created_before: Filter by <=[date-time] + :param content_name: Filter by Regex Pattern in content name + :param content: Filter by Regex Pattern in template content + :param language: Filter by array of valid language(s) + :param content_type: Filter by array of contentType(s) + :param channel_eligibility: Filter by array of ChannelEligibility(s), where ChannelEligibility=: :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 @@ -244,6 +401,15 @@ async def page_async( """ data = values.of( { + "SortByDate": sort_by_date, + "SortByContentName": sort_by_content_name, + "DateCreatedAfter": serialize.iso8601_datetime(date_created_after), + "DateCreatedBefore": serialize.iso8601_datetime(date_created_before), + "ContentName": content_name, + "Content": content, + "Language": serialize.map(language, lambda e: e), + "ContentType": serialize.map(content_type, lambda e: e), + "ChannelEligibility": serialize.map(channel_eligibility, lambda e: e), "PageToken": page_token, "Page": page_number, "PageSize": page_size, diff --git a/twilio/rest/marketplace/MarketplaceBase.py b/twilio/rest/marketplace/MarketplaceBase.py new file mode 100644 index 0000000000..9fbe193d99 --- /dev/null +++ b/twilio/rest/marketplace/MarketplaceBase.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.marketplace.v1 import V1 + + +class MarketplaceBase(Domain): + + def __init__(self, twilio: Client): + """ + Initialize the Marketplace Domain + + :returns: Domain for Marketplace + """ + super().__init__(twilio, "https://marketplace.twilio.com") + self._v1: Optional[V1] = None + + @property + def v1(self) -> V1: + """ + :returns: Versions v1 of Marketplace + """ + 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/marketplace/v1/__init__.py b/twilio/rest/marketplace/v1/__init__.py new file mode 100644 index 0000000000..49fc490396 --- /dev/null +++ b/twilio/rest/marketplace/v1/__init__.py @@ -0,0 +1,59 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Marketplace + 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 Optional +from twilio.base.version import Version +from twilio.base.domain import Domain +from twilio.rest.marketplace.v1.available_add_on import AvailableAddOnList +from twilio.rest.marketplace.v1.installed_add_on import InstalledAddOnList +from twilio.rest.marketplace.v1.module_data_management import ModuleDataManagementList + + +class V1(Version): + + def __init__(self, domain: Domain): + """ + Initialize the V1 version of Marketplace + + :param domain: The Twilio.marketplace domain + """ + super().__init__(domain, "v1") + self._available_add_ons: Optional[AvailableAddOnList] = None + self._installed_add_ons: Optional[InstalledAddOnList] = None + self._module_data_management: Optional[ModuleDataManagementList] = None + + @property + def available_add_ons(self) -> AvailableAddOnList: + if self._available_add_ons is None: + self._available_add_ons = AvailableAddOnList(self) + return self._available_add_ons + + @property + def installed_add_ons(self) -> InstalledAddOnList: + if self._installed_add_ons is None: + self._installed_add_ons = InstalledAddOnList(self) + return self._installed_add_ons + + @property + def module_data_management(self) -> ModuleDataManagementList: + if self._module_data_management is None: + self._module_data_management = ModuleDataManagementList(self) + return self._module_data_management + + def __repr__(self) -> str: + """ + Provide a friendly representation + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/marketplace/v1/available_add_on/__init__.py b/twilio/rest/marketplace/v1/available_add_on/__init__.py new file mode 100644 index 0000000000..6f6713ee17 --- /dev/null +++ b/twilio/rest/marketplace/v1/available_add_on/__init__.py @@ -0,0 +1,424 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Marketplace + 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, Union, Iterator, AsyncIterator +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version +from twilio.base.page import Page +from twilio.rest.marketplace.v1.available_add_on.available_add_on_extension import ( + AvailableAddOnExtensionList, +) + + +class AvailableAddOnInstance(InstanceResource): + """ + :ivar sid: The unique string that we created to identify the AvailableAddOn resource. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar description: A short description of the Add-on's functionality. + :ivar pricing_type: How customers are charged for using this Add-on. + :ivar configuration_schema: The JSON object with the configuration that must be provided when installing a given Add-on. + :ivar url: The absolute URL of the resource. + :ivar links: The URLs of related resources. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): + super().__init__(version) + + self.sid: Optional[str] = payload.get("sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.description: Optional[str] = payload.get("description") + self.pricing_type: Optional[str] = payload.get("pricing_type") + self.configuration_schema: Optional[Dict[str, object]] = payload.get( + "configuration_schema" + ) + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") + + self._solution = { + "sid": sid or self.sid, + } + self._context: Optional[AvailableAddOnContext] = None + + @property + def _proxy(self) -> "AvailableAddOnContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: AvailableAddOnContext for this AvailableAddOnInstance + """ + if self._context is None: + self._context = AvailableAddOnContext( + self._version, + sid=self._solution["sid"], + ) + return self._context + + def fetch(self) -> "AvailableAddOnInstance": + """ + Fetch the AvailableAddOnInstance + + + :returns: The fetched AvailableAddOnInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "AvailableAddOnInstance": + """ + Asynchronous coroutine to fetch the AvailableAddOnInstance + + + :returns: The fetched AvailableAddOnInstance + """ + return await self._proxy.fetch_async() + + @property + def extensions(self) -> AvailableAddOnExtensionList: + """ + Access the extensions + """ + return self._proxy.extensions + + 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 AvailableAddOnContext(InstanceContext): + + def __init__(self, version: Version, sid: str): + """ + Initialize the AvailableAddOnContext + + :param version: Version that contains the resource + :param sid: The SID of the AvailableAddOn resource to fetch. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "sid": sid, + } + self._uri = "/AvailableAddOns/{sid}".format(**self._solution) + + self._extensions: Optional[AvailableAddOnExtensionList] = None + + def fetch(self) -> AvailableAddOnInstance: + """ + Fetch the AvailableAddOnInstance + + + :returns: The fetched AvailableAddOnInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return AvailableAddOnInstance( + self._version, + payload, + sid=self._solution["sid"], + ) + + async def fetch_async(self) -> AvailableAddOnInstance: + """ + Asynchronous coroutine to fetch the AvailableAddOnInstance + + + :returns: The fetched AvailableAddOnInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return AvailableAddOnInstance( + self._version, + payload, + sid=self._solution["sid"], + ) + + @property + def extensions(self) -> AvailableAddOnExtensionList: + """ + Access the extensions + """ + if self._extensions is None: + self._extensions = AvailableAddOnExtensionList( + self._version, + self._solution["sid"], + ) + return self._extensions + + 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 AvailableAddOnPage(Page): + + def get_instance(self, payload: Dict[str, Any]) -> AvailableAddOnInstance: + """ + Build an instance of AvailableAddOnInstance + + :param payload: Payload response from the API + """ + return AvailableAddOnInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class AvailableAddOnList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the AvailableAddOnList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/AvailableAddOns" + + def stream( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[AvailableAddOnInstance]: + """ + Streams AvailableAddOnInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = self.page(page_size=limits["page_size"]) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[AvailableAddOnInstance]: + """ + Asynchronously streams AvailableAddOnInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = await self.page_async(page_size=limits["page_size"]) + + return self._version.stream_async(page, limits["limit"]) + + def list( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[AvailableAddOnInstance]: + """ + Lists AvailableAddOnInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return list( + self.stream( + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[AvailableAddOnInstance]: + """ + Asynchronously lists AvailableAddOnInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return [ + record + async for record in await self.stream_async( + limit=limit, + page_size=page_size, + ) + ] + + def page( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> AvailableAddOnPage: + """ + Retrieve a single page of AvailableAddOnInstance records from the API. + Request is executed immediately + + :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 + + :returns: Page of AvailableAddOnInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = self._version.page(method="GET", uri=self._uri, params=data) + return AvailableAddOnPage(self._version, response) + + async def page_async( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> AvailableAddOnPage: + """ + Asynchronously retrieve a single page of AvailableAddOnInstance records from the API. + Request is executed immediately + + :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 + + :returns: Page of AvailableAddOnInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = await self._version.page_async( + method="GET", uri=self._uri, params=data + ) + return AvailableAddOnPage(self._version, response) + + def get_page(self, target_url: str) -> AvailableAddOnPage: + """ + Retrieve a specific page of AvailableAddOnInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of AvailableAddOnInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return AvailableAddOnPage(self._version, response) + + async def get_page_async(self, target_url: str) -> AvailableAddOnPage: + """ + Asynchronously retrieve a specific page of AvailableAddOnInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of AvailableAddOnInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return AvailableAddOnPage(self._version, response) + + def get(self, sid: str) -> AvailableAddOnContext: + """ + Constructs a AvailableAddOnContext + + :param sid: The SID of the AvailableAddOn resource to fetch. + """ + return AvailableAddOnContext(self._version, sid=sid) + + def __call__(self, sid: str) -> AvailableAddOnContext: + """ + Constructs a AvailableAddOnContext + + :param sid: The SID of the AvailableAddOn resource to fetch. + """ + return AvailableAddOnContext(self._version, sid=sid) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/marketplace/v1/available_add_on/available_add_on_extension.py b/twilio/rest/marketplace/v1/available_add_on/available_add_on_extension.py new file mode 100644 index 0000000000..1113d9313c --- /dev/null +++ b/twilio/rest/marketplace/v1/available_add_on/available_add_on_extension.py @@ -0,0 +1,431 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Marketplace + 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, Union, Iterator, AsyncIterator +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version +from twilio.base.page import Page + + +class AvailableAddOnExtensionInstance(InstanceResource): + """ + :ivar sid: The unique string that we created to identify the AvailableAddOnExtension resource. + :ivar available_add_on_sid: The SID of the AvailableAddOn resource to which this extension applies. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar product_name: The name of the Product this Extension is used within. + :ivar unique_name: An application-defined string that uniquely identifies the resource. + :ivar url: The absolute URL of the resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + available_add_on_sid: str, + sid: Optional[str] = None, + ): + super().__init__(version) + + self.sid: Optional[str] = payload.get("sid") + self.available_add_on_sid: Optional[str] = payload.get("available_add_on_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.product_name: Optional[str] = payload.get("product_name") + self.unique_name: Optional[str] = payload.get("unique_name") + self.url: Optional[str] = payload.get("url") + + self._solution = { + "available_add_on_sid": available_add_on_sid, + "sid": sid or self.sid, + } + self._context: Optional[AvailableAddOnExtensionContext] = None + + @property + def _proxy(self) -> "AvailableAddOnExtensionContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: AvailableAddOnExtensionContext for this AvailableAddOnExtensionInstance + """ + if self._context is None: + self._context = AvailableAddOnExtensionContext( + self._version, + available_add_on_sid=self._solution["available_add_on_sid"], + sid=self._solution["sid"], + ) + return self._context + + def fetch(self) -> "AvailableAddOnExtensionInstance": + """ + Fetch the AvailableAddOnExtensionInstance + + + :returns: The fetched AvailableAddOnExtensionInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "AvailableAddOnExtensionInstance": + """ + Asynchronous coroutine to fetch the AvailableAddOnExtensionInstance + + + :returns: The fetched AvailableAddOnExtensionInstance + """ + return await self._proxy.fetch_async() + + 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 AvailableAddOnExtensionContext(InstanceContext): + + def __init__(self, version: Version, available_add_on_sid: str, sid: str): + """ + Initialize the AvailableAddOnExtensionContext + + :param version: Version that contains the resource + :param available_add_on_sid: The SID of the AvailableAddOn resource with the extension to fetch. + :param sid: The SID of the AvailableAddOn Extension resource to fetch. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "available_add_on_sid": available_add_on_sid, + "sid": sid, + } + self._uri = "/AvailableAddOns/{available_add_on_sid}/Extensions/{sid}".format( + **self._solution + ) + + def fetch(self) -> AvailableAddOnExtensionInstance: + """ + Fetch the AvailableAddOnExtensionInstance + + + :returns: The fetched AvailableAddOnExtensionInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return AvailableAddOnExtensionInstance( + self._version, + payload, + available_add_on_sid=self._solution["available_add_on_sid"], + sid=self._solution["sid"], + ) + + async def fetch_async(self) -> AvailableAddOnExtensionInstance: + """ + Asynchronous coroutine to fetch the AvailableAddOnExtensionInstance + + + :returns: The fetched AvailableAddOnExtensionInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return AvailableAddOnExtensionInstance( + self._version, + payload, + available_add_on_sid=self._solution["available_add_on_sid"], + sid=self._solution["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 AvailableAddOnExtensionPage(Page): + + def get_instance(self, payload: Dict[str, Any]) -> AvailableAddOnExtensionInstance: + """ + Build an instance of AvailableAddOnExtensionInstance + + :param payload: Payload response from the API + """ + return AvailableAddOnExtensionInstance( + self._version, + payload, + available_add_on_sid=self._solution["available_add_on_sid"], + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class AvailableAddOnExtensionList(ListResource): + + def __init__(self, version: Version, available_add_on_sid: str): + """ + Initialize the AvailableAddOnExtensionList + + :param version: Version that contains the resource + :param available_add_on_sid: The SID of the AvailableAddOn resource with the extensions to read. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "available_add_on_sid": available_add_on_sid, + } + self._uri = "/AvailableAddOns/{available_add_on_sid}/Extensions".format( + **self._solution + ) + + def stream( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[AvailableAddOnExtensionInstance]: + """ + Streams AvailableAddOnExtensionInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = self.page(page_size=limits["page_size"]) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[AvailableAddOnExtensionInstance]: + """ + Asynchronously streams AvailableAddOnExtensionInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = await self.page_async(page_size=limits["page_size"]) + + return self._version.stream_async(page, limits["limit"]) + + def list( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[AvailableAddOnExtensionInstance]: + """ + Lists AvailableAddOnExtensionInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return list( + self.stream( + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[AvailableAddOnExtensionInstance]: + """ + Asynchronously lists AvailableAddOnExtensionInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return [ + record + async for record in await self.stream_async( + limit=limit, + page_size=page_size, + ) + ] + + def page( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> AvailableAddOnExtensionPage: + """ + Retrieve a single page of AvailableAddOnExtensionInstance records from the API. + Request is executed immediately + + :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 + + :returns: Page of AvailableAddOnExtensionInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = self._version.page(method="GET", uri=self._uri, params=data) + return AvailableAddOnExtensionPage(self._version, response, self._solution) + + async def page_async( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> AvailableAddOnExtensionPage: + """ + Asynchronously retrieve a single page of AvailableAddOnExtensionInstance records from the API. + Request is executed immediately + + :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 + + :returns: Page of AvailableAddOnExtensionInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = await self._version.page_async( + method="GET", uri=self._uri, params=data + ) + return AvailableAddOnExtensionPage(self._version, response, self._solution) + + def get_page(self, target_url: str) -> AvailableAddOnExtensionPage: + """ + Retrieve a specific page of AvailableAddOnExtensionInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of AvailableAddOnExtensionInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return AvailableAddOnExtensionPage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> AvailableAddOnExtensionPage: + """ + Asynchronously retrieve a specific page of AvailableAddOnExtensionInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of AvailableAddOnExtensionInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return AvailableAddOnExtensionPage(self._version, response, self._solution) + + def get(self, sid: str) -> AvailableAddOnExtensionContext: + """ + Constructs a AvailableAddOnExtensionContext + + :param sid: The SID of the AvailableAddOn Extension resource to fetch. + """ + return AvailableAddOnExtensionContext( + self._version, + available_add_on_sid=self._solution["available_add_on_sid"], + sid=sid, + ) + + def __call__(self, sid: str) -> AvailableAddOnExtensionContext: + """ + Constructs a AvailableAddOnExtensionContext + + :param sid: The SID of the AvailableAddOn Extension resource to fetch. + """ + return AvailableAddOnExtensionContext( + self._version, + available_add_on_sid=self._solution["available_add_on_sid"], + sid=sid, + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/marketplace/v1/installed_add_on/__init__.py b/twilio/rest/marketplace/v1/installed_add_on/__init__.py new file mode 100644 index 0000000000..0aad53d8ee --- /dev/null +++ b/twilio/rest/marketplace/v1/installed_add_on/__init__.py @@ -0,0 +1,664 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Marketplace + 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 datetime import datetime +from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator +from twilio.base import deserialize, serialize, values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version +from twilio.base.page import Page +from twilio.rest.marketplace.v1.installed_add_on.installed_add_on_extension import ( + InstalledAddOnExtensionList, +) +from twilio.rest.marketplace.v1.installed_add_on.installed_add_on_usage import ( + InstalledAddOnUsageList, +) + + +class InstalledAddOnInstance(InstanceResource): + """ + :ivar sid: The unique string that we created to identify the InstalledAddOn resource. This Sid can also be found in the Console on that specific Add-ons page as the 'Available Add-on Sid'. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the InstalledAddOn resource. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar description: A short description of the Add-on's functionality. + :ivar configuration: The JSON object that represents the current configuration of installed Add-on. + :ivar unique_name: An application-defined string that uniquely identifies the resource. + :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar url: The absolute URL of the resource. + :ivar links: The URLs of related resources. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): + super().__init__(version) + + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.description: Optional[str] = payload.get("description") + self.configuration: Optional[Dict[str, object]] = payload.get("configuration") + self.unique_name: Optional[str] = payload.get("unique_name") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") + + self._solution = { + "sid": sid or self.sid, + } + self._context: Optional[InstalledAddOnContext] = None + + @property + def _proxy(self) -> "InstalledAddOnContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: InstalledAddOnContext for this InstalledAddOnInstance + """ + if self._context is None: + self._context = InstalledAddOnContext( + self._version, + sid=self._solution["sid"], + ) + return self._context + + def delete(self) -> bool: + """ + Deletes the InstalledAddOnInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the InstalledAddOnInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def fetch(self) -> "InstalledAddOnInstance": + """ + Fetch the InstalledAddOnInstance + + + :returns: The fetched InstalledAddOnInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "InstalledAddOnInstance": + """ + Asynchronous coroutine to fetch the InstalledAddOnInstance + + + :returns: The fetched InstalledAddOnInstance + """ + return await self._proxy.fetch_async() + + def update( + self, + configuration: Union[object, object] = values.unset, + unique_name: Union[str, object] = values.unset, + ) -> "InstalledAddOnInstance": + """ + Update the InstalledAddOnInstance + + :param configuration: Valid JSON object that conform to the configuration schema exposed by the associated AvailableAddOn resource. This is only required by Add-ons that need to be configured + :param unique_name: An application-defined string that uniquely identifies the resource. This value must be unique within the Account. + + :returns: The updated InstalledAddOnInstance + """ + return self._proxy.update( + configuration=configuration, + unique_name=unique_name, + ) + + async def update_async( + self, + configuration: Union[object, object] = values.unset, + unique_name: Union[str, object] = values.unset, + ) -> "InstalledAddOnInstance": + """ + Asynchronous coroutine to update the InstalledAddOnInstance + + :param configuration: Valid JSON object that conform to the configuration schema exposed by the associated AvailableAddOn resource. This is only required by Add-ons that need to be configured + :param unique_name: An application-defined string that uniquely identifies the resource. This value must be unique within the Account. + + :returns: The updated InstalledAddOnInstance + """ + return await self._proxy.update_async( + configuration=configuration, + unique_name=unique_name, + ) + + @property + def extensions(self) -> InstalledAddOnExtensionList: + """ + Access the extensions + """ + return self._proxy.extensions + + @property + def usage(self) -> InstalledAddOnUsageList: + """ + Access the usage + """ + return self._proxy.usage + + 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 InstalledAddOnContext(InstanceContext): + + def __init__(self, version: Version, sid: str): + """ + Initialize the InstalledAddOnContext + + :param version: Version that contains the resource + :param sid: The SID of the InstalledAddOn resource to update. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "sid": sid, + } + self._uri = "/InstalledAddOns/{sid}".format(**self._solution) + + self._extensions: Optional[InstalledAddOnExtensionList] = None + self._usage: Optional[InstalledAddOnUsageList] = None + + def delete(self) -> bool: + """ + Deletes the InstalledAddOnInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._version.delete( + method="DELETE", + uri=self._uri, + ) + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the InstalledAddOnInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._version.delete_async( + method="DELETE", + uri=self._uri, + ) + + def fetch(self) -> InstalledAddOnInstance: + """ + Fetch the InstalledAddOnInstance + + + :returns: The fetched InstalledAddOnInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return InstalledAddOnInstance( + self._version, + payload, + sid=self._solution["sid"], + ) + + async def fetch_async(self) -> InstalledAddOnInstance: + """ + Asynchronous coroutine to fetch the InstalledAddOnInstance + + + :returns: The fetched InstalledAddOnInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return InstalledAddOnInstance( + self._version, + payload, + sid=self._solution["sid"], + ) + + def update( + self, + configuration: Union[object, object] = values.unset, + unique_name: Union[str, object] = values.unset, + ) -> InstalledAddOnInstance: + """ + Update the InstalledAddOnInstance + + :param configuration: Valid JSON object that conform to the configuration schema exposed by the associated AvailableAddOn resource. This is only required by Add-ons that need to be configured + :param unique_name: An application-defined string that uniquely identifies the resource. This value must be unique within the Account. + + :returns: The updated InstalledAddOnInstance + """ + data = values.of( + { + "Configuration": serialize.object(configuration), + "UniqueName": unique_name, + } + ) + + payload = self._version.update( + method="POST", + uri=self._uri, + data=data, + ) + + return InstalledAddOnInstance(self._version, payload, sid=self._solution["sid"]) + + async def update_async( + self, + configuration: Union[object, object] = values.unset, + unique_name: Union[str, object] = values.unset, + ) -> InstalledAddOnInstance: + """ + Asynchronous coroutine to update the InstalledAddOnInstance + + :param configuration: Valid JSON object that conform to the configuration schema exposed by the associated AvailableAddOn resource. This is only required by Add-ons that need to be configured + :param unique_name: An application-defined string that uniquely identifies the resource. This value must be unique within the Account. + + :returns: The updated InstalledAddOnInstance + """ + data = values.of( + { + "Configuration": serialize.object(configuration), + "UniqueName": unique_name, + } + ) + + payload = await self._version.update_async( + method="POST", + uri=self._uri, + data=data, + ) + + return InstalledAddOnInstance(self._version, payload, sid=self._solution["sid"]) + + @property + def extensions(self) -> InstalledAddOnExtensionList: + """ + Access the extensions + """ + if self._extensions is None: + self._extensions = InstalledAddOnExtensionList( + self._version, + self._solution["sid"], + ) + return self._extensions + + @property + def usage(self) -> InstalledAddOnUsageList: + """ + Access the usage + """ + if self._usage is None: + self._usage = InstalledAddOnUsageList( + self._version, + self._solution["sid"], + ) + return self._usage + + 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 InstalledAddOnPage(Page): + + def get_instance(self, payload: Dict[str, Any]) -> InstalledAddOnInstance: + """ + Build an instance of InstalledAddOnInstance + + :param payload: Payload response from the API + """ + return InstalledAddOnInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class InstalledAddOnList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the InstalledAddOnList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/InstalledAddOns" + + def create( + self, + available_add_on_sid: str, + accept_terms_of_service: bool, + configuration: Union[object, object] = values.unset, + unique_name: Union[str, object] = values.unset, + ) -> InstalledAddOnInstance: + """ + Create the InstalledAddOnInstance + + :param available_add_on_sid: The SID of the AvaliableAddOn to install. + :param accept_terms_of_service: Whether the Terms of Service were accepted. + :param configuration: The JSON object that represents the configuration of the new Add-on being installed. + :param unique_name: An application-defined string that uniquely identifies the resource. This value must be unique within the Account. + + :returns: The created InstalledAddOnInstance + """ + + data = values.of( + { + "AvailableAddOnSid": available_add_on_sid, + "AcceptTermsOfService": serialize.boolean_to_string( + accept_terms_of_service + ), + "Configuration": serialize.object(configuration), + "UniqueName": unique_name, + } + ) + + payload = self._version.create( + method="POST", + uri=self._uri, + data=data, + ) + + return InstalledAddOnInstance(self._version, payload) + + async def create_async( + self, + available_add_on_sid: str, + accept_terms_of_service: bool, + configuration: Union[object, object] = values.unset, + unique_name: Union[str, object] = values.unset, + ) -> InstalledAddOnInstance: + """ + Asynchronously create the InstalledAddOnInstance + + :param available_add_on_sid: The SID of the AvaliableAddOn to install. + :param accept_terms_of_service: Whether the Terms of Service were accepted. + :param configuration: The JSON object that represents the configuration of the new Add-on being installed. + :param unique_name: An application-defined string that uniquely identifies the resource. This value must be unique within the Account. + + :returns: The created InstalledAddOnInstance + """ + + data = values.of( + { + "AvailableAddOnSid": available_add_on_sid, + "AcceptTermsOfService": serialize.boolean_to_string( + accept_terms_of_service + ), + "Configuration": serialize.object(configuration), + "UniqueName": unique_name, + } + ) + + payload = await self._version.create_async( + method="POST", + uri=self._uri, + data=data, + ) + + return InstalledAddOnInstance(self._version, payload) + + def stream( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[InstalledAddOnInstance]: + """ + Streams InstalledAddOnInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = self.page(page_size=limits["page_size"]) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[InstalledAddOnInstance]: + """ + Asynchronously streams InstalledAddOnInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = await self.page_async(page_size=limits["page_size"]) + + return self._version.stream_async(page, limits["limit"]) + + def list( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[InstalledAddOnInstance]: + """ + Lists InstalledAddOnInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return list( + self.stream( + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[InstalledAddOnInstance]: + """ + Asynchronously lists InstalledAddOnInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return [ + record + async for record in await self.stream_async( + limit=limit, + page_size=page_size, + ) + ] + + def page( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> InstalledAddOnPage: + """ + Retrieve a single page of InstalledAddOnInstance records from the API. + Request is executed immediately + + :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 + + :returns: Page of InstalledAddOnInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = self._version.page(method="GET", uri=self._uri, params=data) + return InstalledAddOnPage(self._version, response) + + async def page_async( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> InstalledAddOnPage: + """ + Asynchronously retrieve a single page of InstalledAddOnInstance records from the API. + Request is executed immediately + + :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 + + :returns: Page of InstalledAddOnInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = await self._version.page_async( + method="GET", uri=self._uri, params=data + ) + return InstalledAddOnPage(self._version, response) + + def get_page(self, target_url: str) -> InstalledAddOnPage: + """ + Retrieve a specific page of InstalledAddOnInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of InstalledAddOnInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return InstalledAddOnPage(self._version, response) + + async def get_page_async(self, target_url: str) -> InstalledAddOnPage: + """ + Asynchronously retrieve a specific page of InstalledAddOnInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of InstalledAddOnInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return InstalledAddOnPage(self._version, response) + + def get(self, sid: str) -> InstalledAddOnContext: + """ + Constructs a InstalledAddOnContext + + :param sid: The SID of the InstalledAddOn resource to update. + """ + return InstalledAddOnContext(self._version, sid=sid) + + def __call__(self, sid: str) -> InstalledAddOnContext: + """ + Constructs a InstalledAddOnContext + + :param sid: The SID of the InstalledAddOn resource to update. + """ + return InstalledAddOnContext(self._version, sid=sid) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/marketplace/v1/installed_add_on/installed_add_on_extension.py b/twilio/rest/marketplace/v1/installed_add_on/installed_add_on_extension.py new file mode 100644 index 0000000000..c53a6ca510 --- /dev/null +++ b/twilio/rest/marketplace/v1/installed_add_on/installed_add_on_extension.py @@ -0,0 +1,511 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Marketplace + 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, Union, Iterator, AsyncIterator +from twilio.base import serialize, values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version +from twilio.base.page import Page + + +class InstalledAddOnExtensionInstance(InstanceResource): + """ + :ivar sid: The unique string that we created to identify the InstalledAddOn Extension resource. + :ivar installed_add_on_sid: The SID of the InstalledAddOn resource to which this extension applies. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar product_name: The name of the Product this Extension is used within. + :ivar unique_name: An application-defined string that uniquely identifies the resource. + :ivar enabled: Whether the Extension will be invoked. + :ivar url: The absolute URL of the resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + installed_add_on_sid: str, + sid: Optional[str] = None, + ): + super().__init__(version) + + self.sid: Optional[str] = payload.get("sid") + self.installed_add_on_sid: Optional[str] = payload.get("installed_add_on_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.product_name: Optional[str] = payload.get("product_name") + self.unique_name: Optional[str] = payload.get("unique_name") + self.enabled: Optional[bool] = payload.get("enabled") + self.url: Optional[str] = payload.get("url") + + self._solution = { + "installed_add_on_sid": installed_add_on_sid, + "sid": sid or self.sid, + } + self._context: Optional[InstalledAddOnExtensionContext] = None + + @property + def _proxy(self) -> "InstalledAddOnExtensionContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: InstalledAddOnExtensionContext for this InstalledAddOnExtensionInstance + """ + if self._context is None: + self._context = InstalledAddOnExtensionContext( + self._version, + installed_add_on_sid=self._solution["installed_add_on_sid"], + sid=self._solution["sid"], + ) + return self._context + + def fetch(self) -> "InstalledAddOnExtensionInstance": + """ + Fetch the InstalledAddOnExtensionInstance + + + :returns: The fetched InstalledAddOnExtensionInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "InstalledAddOnExtensionInstance": + """ + Asynchronous coroutine to fetch the InstalledAddOnExtensionInstance + + + :returns: The fetched InstalledAddOnExtensionInstance + """ + return await self._proxy.fetch_async() + + def update(self, enabled: bool) -> "InstalledAddOnExtensionInstance": + """ + Update the InstalledAddOnExtensionInstance + + :param enabled: Whether the Extension should be invoked. + + :returns: The updated InstalledAddOnExtensionInstance + """ + return self._proxy.update( + enabled=enabled, + ) + + async def update_async(self, enabled: bool) -> "InstalledAddOnExtensionInstance": + """ + Asynchronous coroutine to update the InstalledAddOnExtensionInstance + + :param enabled: Whether the Extension should be invoked. + + :returns: The updated InstalledAddOnExtensionInstance + """ + return await self._proxy.update_async( + enabled=enabled, + ) + + 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 InstalledAddOnExtensionContext(InstanceContext): + + def __init__(self, version: Version, installed_add_on_sid: str, sid: str): + """ + Initialize the InstalledAddOnExtensionContext + + :param version: Version that contains the resource + :param installed_add_on_sid: The SID of the InstalledAddOn resource with the extension to update. + :param sid: The SID of the InstalledAddOn Extension resource to update. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "installed_add_on_sid": installed_add_on_sid, + "sid": sid, + } + self._uri = "/InstalledAddOns/{installed_add_on_sid}/Extensions/{sid}".format( + **self._solution + ) + + def fetch(self) -> InstalledAddOnExtensionInstance: + """ + Fetch the InstalledAddOnExtensionInstance + + + :returns: The fetched InstalledAddOnExtensionInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return InstalledAddOnExtensionInstance( + self._version, + payload, + installed_add_on_sid=self._solution["installed_add_on_sid"], + sid=self._solution["sid"], + ) + + async def fetch_async(self) -> InstalledAddOnExtensionInstance: + """ + Asynchronous coroutine to fetch the InstalledAddOnExtensionInstance + + + :returns: The fetched InstalledAddOnExtensionInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return InstalledAddOnExtensionInstance( + self._version, + payload, + installed_add_on_sid=self._solution["installed_add_on_sid"], + sid=self._solution["sid"], + ) + + def update(self, enabled: bool) -> InstalledAddOnExtensionInstance: + """ + Update the InstalledAddOnExtensionInstance + + :param enabled: Whether the Extension should be invoked. + + :returns: The updated InstalledAddOnExtensionInstance + """ + data = values.of( + { + "Enabled": serialize.boolean_to_string(enabled), + } + ) + + payload = self._version.update( + method="POST", + uri=self._uri, + data=data, + ) + + return InstalledAddOnExtensionInstance( + self._version, + payload, + installed_add_on_sid=self._solution["installed_add_on_sid"], + sid=self._solution["sid"], + ) + + async def update_async(self, enabled: bool) -> InstalledAddOnExtensionInstance: + """ + Asynchronous coroutine to update the InstalledAddOnExtensionInstance + + :param enabled: Whether the Extension should be invoked. + + :returns: The updated InstalledAddOnExtensionInstance + """ + data = values.of( + { + "Enabled": serialize.boolean_to_string(enabled), + } + ) + + payload = await self._version.update_async( + method="POST", + uri=self._uri, + data=data, + ) + + return InstalledAddOnExtensionInstance( + self._version, + payload, + installed_add_on_sid=self._solution["installed_add_on_sid"], + sid=self._solution["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 InstalledAddOnExtensionPage(Page): + + def get_instance(self, payload: Dict[str, Any]) -> InstalledAddOnExtensionInstance: + """ + Build an instance of InstalledAddOnExtensionInstance + + :param payload: Payload response from the API + """ + return InstalledAddOnExtensionInstance( + self._version, + payload, + installed_add_on_sid=self._solution["installed_add_on_sid"], + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class InstalledAddOnExtensionList(ListResource): + + def __init__(self, version: Version, installed_add_on_sid: str): + """ + Initialize the InstalledAddOnExtensionList + + :param version: Version that contains the resource + :param installed_add_on_sid: The SID of the InstalledAddOn resource with the extensions to read. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "installed_add_on_sid": installed_add_on_sid, + } + self._uri = "/InstalledAddOns/{installed_add_on_sid}/Extensions".format( + **self._solution + ) + + def stream( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[InstalledAddOnExtensionInstance]: + """ + Streams InstalledAddOnExtensionInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = self.page(page_size=limits["page_size"]) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[InstalledAddOnExtensionInstance]: + """ + Asynchronously streams InstalledAddOnExtensionInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = await self.page_async(page_size=limits["page_size"]) + + return self._version.stream_async(page, limits["limit"]) + + def list( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[InstalledAddOnExtensionInstance]: + """ + Lists InstalledAddOnExtensionInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return list( + self.stream( + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[InstalledAddOnExtensionInstance]: + """ + Asynchronously lists InstalledAddOnExtensionInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return [ + record + async for record in await self.stream_async( + limit=limit, + page_size=page_size, + ) + ] + + def page( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> InstalledAddOnExtensionPage: + """ + Retrieve a single page of InstalledAddOnExtensionInstance records from the API. + Request is executed immediately + + :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 + + :returns: Page of InstalledAddOnExtensionInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = self._version.page(method="GET", uri=self._uri, params=data) + return InstalledAddOnExtensionPage(self._version, response, self._solution) + + async def page_async( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> InstalledAddOnExtensionPage: + """ + Asynchronously retrieve a single page of InstalledAddOnExtensionInstance records from the API. + Request is executed immediately + + :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 + + :returns: Page of InstalledAddOnExtensionInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = await self._version.page_async( + method="GET", uri=self._uri, params=data + ) + return InstalledAddOnExtensionPage(self._version, response, self._solution) + + def get_page(self, target_url: str) -> InstalledAddOnExtensionPage: + """ + Retrieve a specific page of InstalledAddOnExtensionInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of InstalledAddOnExtensionInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return InstalledAddOnExtensionPage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> InstalledAddOnExtensionPage: + """ + Asynchronously retrieve a specific page of InstalledAddOnExtensionInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of InstalledAddOnExtensionInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return InstalledAddOnExtensionPage(self._version, response, self._solution) + + def get(self, sid: str) -> InstalledAddOnExtensionContext: + """ + Constructs a InstalledAddOnExtensionContext + + :param sid: The SID of the InstalledAddOn Extension resource to update. + """ + return InstalledAddOnExtensionContext( + self._version, + installed_add_on_sid=self._solution["installed_add_on_sid"], + sid=sid, + ) + + def __call__(self, sid: str) -> InstalledAddOnExtensionContext: + """ + Constructs a InstalledAddOnExtensionContext + + :param sid: The SID of the InstalledAddOn Extension resource to update. + """ + return InstalledAddOnExtensionContext( + self._version, + installed_add_on_sid=self._solution["installed_add_on_sid"], + sid=sid, + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/marketplace/v1/installed_add_on/installed_add_on_usage.py b/twilio/rest/marketplace/v1/installed_add_on/installed_add_on_usage.py new file mode 100644 index 0000000000..6fff4979f4 --- /dev/null +++ b/twilio/rest/marketplace/v1/installed_add_on/installed_add_on_usage.py @@ -0,0 +1,166 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Marketplace + 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 InstalledAddOnUsageInstance(InstanceResource): + """ + :ivar billable_items: + :ivar total_submitted: Represents the total quantity submitted. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], installed_add_on_sid: str + ): + super().__init__(version) + + self.billable_items: Optional[List[str]] = payload.get("billable_items") + self.total_submitted: Optional[float] = deserialize.decimal( + payload.get("total_submitted") + ) + + self._solution = { + "installed_add_on_sid": installed_add_on_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 InstalledAddOnUsageList(ListResource): + + class CreateMarketplaceBillingUsageRequest(object): + """ + :ivar billable_items: + """ + + def __init__(self, payload: Dict[str, Any], installed_add_on_sid: str): + + self.billable_items: Optional[ + List[ + InstalledAddOnUsageList.CreateMarketplaceBillingUsageRequestBillableItems + ] + ] = payload.get("billable_items") + + def to_dict(self): + return { + "billable_items": [ + billable_items.to_dict() for billable_items in self.billable_items + ], + } + + class CreateMarketplaceBillingUsageRequestBillableItems(object): + """ + :ivar quantity: + :ivar sid: + """ + + def __init__(self, payload: Dict[str, Any], installed_add_on_sid: str): + + self.quantity: Optional[float] = payload.get("quantity") + self.sid: Optional[str] = payload.get("sid") + + def to_dict(self): + return { + "quantity": self.quantity, + "sid": self.sid, + } + + def __init__(self, version: Version, installed_add_on_sid: str): + """ + Initialize the InstalledAddOnUsageList + + :param version: Version that contains the resource + :param installed_add_on_sid: + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "installed_add_on_sid": installed_add_on_sid, + } + self._uri = "/InstalledAddOns/{installed_add_on_sid}/Usage".format( + **self._solution + ) + + def create( + self, + create_marketplace_billing_usage_request: CreateMarketplaceBillingUsageRequest, + ) -> InstalledAddOnUsageInstance: + """ + Create the InstalledAddOnUsageInstance + + :param create_marketplace_billing_usage_request: + + :returns: The created InstalledAddOnUsageInstance + """ + data = create_marketplace_billing_usage_request.to_dict() + + headers = {"Content-Type": "application/json"} + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return InstalledAddOnUsageInstance( + self._version, + payload, + installed_add_on_sid=self._solution["installed_add_on_sid"], + ) + + async def create_async( + self, + create_marketplace_billing_usage_request: CreateMarketplaceBillingUsageRequest, + ) -> InstalledAddOnUsageInstance: + """ + Asynchronously create the InstalledAddOnUsageInstance + + :param create_marketplace_billing_usage_request: + + :returns: The created InstalledAddOnUsageInstance + """ + data = create_marketplace_billing_usage_request.to_dict() + + headers = {"Content-Type": "application/json"} + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return InstalledAddOnUsageInstance( + self._version, + payload, + installed_add_on_sid=self._solution["installed_add_on_sid"], + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/marketplace/v1/module_data_management.py b/twilio/rest/marketplace/v1/module_data_management.py new file mode 100644 index 0000000000..079a1a3343 --- /dev/null +++ b/twilio/rest/marketplace/v1/module_data_management.py @@ -0,0 +1,325 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Marketplace + 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, Union +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class ModuleDataManagementInstance(InstanceResource): + """ + :ivar url: + :ivar sid: + :ivar description: + :ivar support: + :ivar policies: + :ivar module_info: + :ivar documentation: + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): + super().__init__(version) + + self.url: Optional[str] = payload.get("url") + self.sid: Optional[str] = payload.get("sid") + self.description: Optional[Dict[str, object]] = payload.get("description") + self.support: Optional[Dict[str, object]] = payload.get("support") + self.policies: Optional[Dict[str, object]] = payload.get("policies") + self.module_info: Optional[Dict[str, object]] = payload.get("module_info") + self.documentation: Optional[Dict[str, object]] = payload.get("documentation") + + self._solution = { + "sid": sid or self.sid, + } + self._context: Optional[ModuleDataManagementContext] = None + + @property + def _proxy(self) -> "ModuleDataManagementContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: ModuleDataManagementContext for this ModuleDataManagementInstance + """ + if self._context is None: + self._context = ModuleDataManagementContext( + self._version, + sid=self._solution["sid"], + ) + return self._context + + def fetch(self) -> "ModuleDataManagementInstance": + """ + Fetch the ModuleDataManagementInstance + + + :returns: The fetched ModuleDataManagementInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "ModuleDataManagementInstance": + """ + Asynchronous coroutine to fetch the ModuleDataManagementInstance + + + :returns: The fetched ModuleDataManagementInstance + """ + return await self._proxy.fetch_async() + + def update( + self, + module_info: Union[str, object] = values.unset, + description: Union[str, object] = values.unset, + documentation: Union[str, object] = values.unset, + policies: Union[str, object] = values.unset, + support: Union[str, object] = values.unset, + ) -> "ModuleDataManagementInstance": + """ + Update the ModuleDataManagementInstance + + :param module_info: + :param description: + :param documentation: + :param policies: + :param support: + + :returns: The updated ModuleDataManagementInstance + """ + return self._proxy.update( + module_info=module_info, + description=description, + documentation=documentation, + policies=policies, + support=support, + ) + + async def update_async( + self, + module_info: Union[str, object] = values.unset, + description: Union[str, object] = values.unset, + documentation: Union[str, object] = values.unset, + policies: Union[str, object] = values.unset, + support: Union[str, object] = values.unset, + ) -> "ModuleDataManagementInstance": + """ + Asynchronous coroutine to update the ModuleDataManagementInstance + + :param module_info: + :param description: + :param documentation: + :param policies: + :param support: + + :returns: The updated ModuleDataManagementInstance + """ + return await self._proxy.update_async( + module_info=module_info, + description=description, + documentation=documentation, + policies=policies, + support=support, + ) + + 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 ModuleDataManagementContext(InstanceContext): + + def __init__(self, version: Version, sid: str): + """ + Initialize the ModuleDataManagementContext + + :param version: Version that contains the resource + :param sid: + """ + super().__init__(version) + + # Path Solution + self._solution = { + "sid": sid, + } + self._uri = "/Listing/{sid}".format(**self._solution) + + def fetch(self) -> ModuleDataManagementInstance: + """ + Fetch the ModuleDataManagementInstance + + + :returns: The fetched ModuleDataManagementInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return ModuleDataManagementInstance( + self._version, + payload, + sid=self._solution["sid"], + ) + + async def fetch_async(self) -> ModuleDataManagementInstance: + """ + Asynchronous coroutine to fetch the ModuleDataManagementInstance + + + :returns: The fetched ModuleDataManagementInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return ModuleDataManagementInstance( + self._version, + payload, + sid=self._solution["sid"], + ) + + def update( + self, + module_info: Union[str, object] = values.unset, + description: Union[str, object] = values.unset, + documentation: Union[str, object] = values.unset, + policies: Union[str, object] = values.unset, + support: Union[str, object] = values.unset, + ) -> ModuleDataManagementInstance: + """ + Update the ModuleDataManagementInstance + + :param module_info: + :param description: + :param documentation: + :param policies: + :param support: + + :returns: The updated ModuleDataManagementInstance + """ + data = values.of( + { + "ModuleInfo": module_info, + "Description": description, + "Documentation": documentation, + "Policies": policies, + "Support": support, + } + ) + + payload = self._version.update( + method="POST", + uri=self._uri, + data=data, + ) + + return ModuleDataManagementInstance( + self._version, payload, sid=self._solution["sid"] + ) + + async def update_async( + self, + module_info: Union[str, object] = values.unset, + description: Union[str, object] = values.unset, + documentation: Union[str, object] = values.unset, + policies: Union[str, object] = values.unset, + support: Union[str, object] = values.unset, + ) -> ModuleDataManagementInstance: + """ + Asynchronous coroutine to update the ModuleDataManagementInstance + + :param module_info: + :param description: + :param documentation: + :param policies: + :param support: + + :returns: The updated ModuleDataManagementInstance + """ + data = values.of( + { + "ModuleInfo": module_info, + "Description": description, + "Documentation": documentation, + "Policies": policies, + "Support": support, + } + ) + + payload = await self._version.update_async( + method="POST", + uri=self._uri, + data=data, + ) + + return ModuleDataManagementInstance( + self._version, payload, sid=self._solution["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 ModuleDataManagementList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the ModuleDataManagementList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + def get(self, sid: str) -> ModuleDataManagementContext: + """ + Constructs a ModuleDataManagementContext + + :param sid: + """ + return ModuleDataManagementContext(self._version, sid=sid) + + def __call__(self, sid: str) -> ModuleDataManagementContext: + """ + Constructs a ModuleDataManagementContext + + :param sid: + """ + return ModuleDataManagementContext(self._version, sid=sid) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/messaging/v1/tollfree_verification.py b/twilio/rest/messaging/v1/tollfree_verification.py index e742c57191..f8c639286b 100644 --- a/twilio/rest/messaging/v1/tollfree_verification.py +++ b/twilio/rest/messaging/v1/tollfree_verification.py @@ -30,6 +30,7 @@ class OptInType(object): PAPER_FORM = "PAPER_FORM" VIA_TEXT = "VIA_TEXT" MOBILE_QR_CODE = "MOBILE_QR_CODE" + IMPORT = "IMPORT" class Status(object): PENDING_REVIEW = "PENDING_REVIEW" @@ -861,6 +862,8 @@ def stream( self, tollfree_phone_number_sid: Union[str, object] = values.unset, status: Union["TollfreeVerificationInstance.Status", object] = values.unset, + external_reference_id: Union[str, object] = values.unset, + include_sub_accounts: Union[bool, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> Iterator[TollfreeVerificationInstance]: @@ -872,6 +875,8 @@ def stream( :param str tollfree_phone_number_sid: The SID of the Phone Number associated with the Tollfree Verification. :param "TollfreeVerificationInstance.Status" status: The compliance status of the Tollfree Verification record. + :param str external_reference_id: Customer supplied reference id for the Tollfree Verification record. + :param bool include_sub_accounts: Whether to include Tollfree Verifications from sub accounts in list response. :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 @@ -885,6 +890,8 @@ def stream( page = self.page( tollfree_phone_number_sid=tollfree_phone_number_sid, status=status, + external_reference_id=external_reference_id, + include_sub_accounts=include_sub_accounts, page_size=limits["page_size"], ) @@ -894,6 +901,8 @@ async def stream_async( self, tollfree_phone_number_sid: Union[str, object] = values.unset, status: Union["TollfreeVerificationInstance.Status", object] = values.unset, + external_reference_id: Union[str, object] = values.unset, + include_sub_accounts: Union[bool, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> AsyncIterator[TollfreeVerificationInstance]: @@ -905,6 +914,8 @@ async def stream_async( :param str tollfree_phone_number_sid: The SID of the Phone Number associated with the Tollfree Verification. :param "TollfreeVerificationInstance.Status" status: The compliance status of the Tollfree Verification record. + :param str external_reference_id: Customer supplied reference id for the Tollfree Verification record. + :param bool include_sub_accounts: Whether to include Tollfree Verifications from sub accounts in list response. :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 @@ -918,6 +929,8 @@ async def stream_async( page = await self.page_async( tollfree_phone_number_sid=tollfree_phone_number_sid, status=status, + external_reference_id=external_reference_id, + include_sub_accounts=include_sub_accounts, page_size=limits["page_size"], ) @@ -927,6 +940,8 @@ def list( self, tollfree_phone_number_sid: Union[str, object] = values.unset, status: Union["TollfreeVerificationInstance.Status", object] = values.unset, + external_reference_id: Union[str, object] = values.unset, + include_sub_accounts: Union[bool, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> List[TollfreeVerificationInstance]: @@ -937,6 +952,8 @@ def list( :param str tollfree_phone_number_sid: The SID of the Phone Number associated with the Tollfree Verification. :param "TollfreeVerificationInstance.Status" status: The compliance status of the Tollfree Verification record. + :param str external_reference_id: Customer supplied reference id for the Tollfree Verification record. + :param bool include_sub_accounts: Whether to include Tollfree Verifications from sub accounts in list response. :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 @@ -950,6 +967,8 @@ def list( self.stream( tollfree_phone_number_sid=tollfree_phone_number_sid, status=status, + external_reference_id=external_reference_id, + include_sub_accounts=include_sub_accounts, limit=limit, page_size=page_size, ) @@ -959,6 +978,8 @@ async def list_async( self, tollfree_phone_number_sid: Union[str, object] = values.unset, status: Union["TollfreeVerificationInstance.Status", object] = values.unset, + external_reference_id: Union[str, object] = values.unset, + include_sub_accounts: Union[bool, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> List[TollfreeVerificationInstance]: @@ -969,6 +990,8 @@ async def list_async( :param str tollfree_phone_number_sid: The SID of the Phone Number associated with the Tollfree Verification. :param "TollfreeVerificationInstance.Status" status: The compliance status of the Tollfree Verification record. + :param str external_reference_id: Customer supplied reference id for the Tollfree Verification record. + :param bool include_sub_accounts: Whether to include Tollfree Verifications from sub accounts in list response. :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 @@ -983,6 +1006,8 @@ async def list_async( async for record in await self.stream_async( tollfree_phone_number_sid=tollfree_phone_number_sid, status=status, + external_reference_id=external_reference_id, + include_sub_accounts=include_sub_accounts, limit=limit, page_size=page_size, ) @@ -992,6 +1017,8 @@ def page( self, tollfree_phone_number_sid: Union[str, object] = values.unset, status: Union["TollfreeVerificationInstance.Status", object] = values.unset, + external_reference_id: Union[str, object] = values.unset, + include_sub_accounts: Union[bool, object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, page_size: Union[int, object] = values.unset, @@ -1002,6 +1029,8 @@ def page( :param tollfree_phone_number_sid: The SID of the Phone Number associated with the Tollfree Verification. :param status: The compliance status of the Tollfree Verification record. + :param external_reference_id: Customer supplied reference id for the Tollfree Verification record. + :param include_sub_accounts: Whether to include Tollfree Verifications from sub accounts in list response. :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 @@ -1012,6 +1041,8 @@ def page( { "TollfreePhoneNumberSid": tollfree_phone_number_sid, "Status": status, + "ExternalReferenceId": external_reference_id, + "IncludeSubAccounts": serialize.boolean_to_string(include_sub_accounts), "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -1025,6 +1056,8 @@ async def page_async( self, tollfree_phone_number_sid: Union[str, object] = values.unset, status: Union["TollfreeVerificationInstance.Status", object] = values.unset, + external_reference_id: Union[str, object] = values.unset, + include_sub_accounts: Union[bool, object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, page_size: Union[int, object] = values.unset, @@ -1035,6 +1068,8 @@ async def page_async( :param tollfree_phone_number_sid: The SID of the Phone Number associated with the Tollfree Verification. :param status: The compliance status of the Tollfree Verification record. + :param external_reference_id: Customer supplied reference id for the Tollfree Verification record. + :param include_sub_accounts: Whether to include Tollfree Verifications from sub accounts in list response. :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 @@ -1045,6 +1080,8 @@ async def page_async( { "TollfreePhoneNumberSid": tollfree_phone_number_sid, "Status": status, + "ExternalReferenceId": external_reference_id, + "IncludeSubAccounts": serialize.boolean_to_string(include_sub_accounts), "PageToken": page_token, "Page": page_number, "PageSize": page_size, diff --git a/twilio/rest/numbers/v1/__init__.py b/twilio/rest/numbers/v1/__init__.py index 7466d170dd..043364c3d5 100644 --- a/twilio/rest/numbers/v1/__init__.py +++ b/twilio/rest/numbers/v1/__init__.py @@ -31,6 +31,9 @@ from twilio.rest.numbers.v1.porting_webhook_configuration_fetch import ( PortingWebhookConfigurationFetchList, ) +from twilio.rest.numbers.v1.signing_request_configuration import ( + SigningRequestConfigurationList, +) class V1(Version): @@ -58,6 +61,9 @@ def __init__(self, domain: Domain): self._porting_webhook_configuration_fetch: Optional[ PortingWebhookConfigurationFetchList ] = None + self._signing_request_configurations: Optional[ + SigningRequestConfigurationList + ] = None @property def bulk_eligibilities(self) -> BulkEligibilityList: @@ -115,6 +121,12 @@ def porting_webhook_configuration_fetch( ) return self._porting_webhook_configuration_fetch + @property + def signing_request_configurations(self) -> SigningRequestConfigurationList: + if self._signing_request_configurations is None: + self._signing_request_configurations = SigningRequestConfigurationList(self) + return self._signing_request_configurations + def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/numbers/v1/signing_request_configuration.py b/twilio/rest/numbers/v1/signing_request_configuration.py new file mode 100644 index 0000000000..1b70ba88c0 --- /dev/null +++ b/twilio/rest/numbers/v1/signing_request_configuration.py @@ -0,0 +1,116 @@ +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, Union +from twilio.base import values + +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class SigningRequestConfigurationInstance(InstanceResource): + """ + :ivar logo_sid: The SID of the document that includes the logo that will appear in the LOA. To upload documents follow the following guide: https://www.twilio.com/docs/phone-numbers/regulatory/getting-started/create-new-bundle-public-rest-apis#supporting-document-create + :ivar friendly_name: This is the string that you assigned as a friendly name for describing the creation of the configuration. + :ivar product: The product or service for which is requesting the signature. + :ivar country: The country ISO code to apply the configuration. + :ivar email_subject: Subject of the email that the end client will receive ex: “Twilio Hosting Request”, maximum length of 255 characters. + :ivar email_message: Content of the email that the end client will receive ex: “This is a Hosting request from Twilio, please check the document and sign it”, maximum length of 5,000 characters. + :ivar url_redirection: Url the end client will be redirected after signing a document. + :ivar url: + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) + + self.logo_sid: Optional[str] = payload.get("logo_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.product: Optional[str] = payload.get("product") + self.country: Optional[str] = payload.get("country") + self.email_subject: Optional[str] = payload.get("email_subject") + self.email_message: Optional[str] = payload.get("email_message") + self.url_redirection: Optional[str] = payload.get("url_redirection") + self.url: Optional[str] = payload.get("url") + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "" + + +class SigningRequestConfigurationList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the SigningRequestConfigurationList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/SigningRequest/Configuration" + + def create( + self, body: Union[object, object] = values.unset + ) -> SigningRequestConfigurationInstance: + """ + Create the SigningRequestConfigurationInstance + + :param body: + + :returns: The created SigningRequestConfigurationInstance + """ + data = body.to_dict() + + headers = {"Content-Type": "application/json"} + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return SigningRequestConfigurationInstance(self._version, payload) + + async def create_async( + self, body: Union[object, object] = values.unset + ) -> SigningRequestConfigurationInstance: + """ + Asynchronously create the SigningRequestConfigurationInstance + + :param body: + + :returns: The created SigningRequestConfigurationInstance + """ + data = body.to_dict() + + headers = {"Content-Type": "application/json"} + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return SigningRequestConfigurationInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" From 98ffc7eac860f3ceac87659d372c5db4823d1586 Mon Sep 17 00:00:00 2001 From: Twilio Date: Thu, 6 Jun 2024 11:45:35 +0000 Subject: [PATCH 13/87] Release 9.1.1 --- setup.py | 2 +- twilio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 6745e08343..9d80846085 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name="twilio", - version="9.1.0", + version="9.1.1", description="Twilio API client and TwiML generator", author="Twilio", help_center="https://www.twilio.com/help/contact", diff --git a/twilio/__init__.py b/twilio/__init__.py index f6647e7a8f..00a5b6d726 100644 --- a/twilio/__init__.py +++ b/twilio/__init__.py @@ -1,2 +1,2 @@ -__version_info__ = ("9", "1", "0") +__version_info__ = ("9", "1", "1") __version__ = ".".join(__version_info__) From ad1f20889c159cb2dbb7ad1327c5e3c79635ea70 Mon Sep 17 00:00:00 2001 From: Shubham Date: Tue, 18 Jun 2024 16:45:02 +0530 Subject: [PATCH 14/87] chore: adding contentType in post and put (#796) * chore: adding contentType in post and put --- twilio/base/client_base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/twilio/base/client_base.py b/twilio/base/client_base.py index c9e0f9c487..5f17c75406 100644 --- a/twilio/base/client_base.py +++ b/twilio/base/client_base.py @@ -184,7 +184,7 @@ def get_headers( # Types, encodings, etc. headers["Accept-Charset"] = "utf-8" - if method == "POST" and "Content-Type" not in headers: + if (method == "POST" or method == "PUT") and ("Content-Type" not in headers): headers["Content-Type"] = "application/x-www-form-urlencoded" if "Accept" not in headers: headers["Accept"] = "application/json" From 2c77186d16fee50650ac20942789bf39e49c60f6 Mon Sep 17 00:00:00 2001 From: Twilio Date: Tue, 18 Jun 2024 17:08:07 +0000 Subject: [PATCH 15/87] [Librarian] Regenerated @ 84b4cd4c23a96109c715a2512bbe8238fae5c394 27d8c0867df0f71947f6535d79d018c706950630 --- CHANGES.md | 24 + twilio/rest/accounts/v1/credential/aws.py | 10 +- .../rest/accounts/v1/credential/public_key.py | 10 +- twilio/rest/accounts/v1/safelist.py | 26 +- twilio/rest/api/v2010/account/__init__.py | 10 +- .../api/v2010/account/address/__init__.py | 10 +- twilio/rest/api/v2010/account/application.py | 10 +- twilio/rest/api/v2010/account/balance.py | 9 +- .../rest/api/v2010/account/call/__init__.py | 12 +- twilio/rest/api/v2010/account/call/payment.py | 10 +- .../rest/api/v2010/account/call/recording.py | 10 +- twilio/rest/api/v2010/account/call/siprec.py | 10 +- twilio/rest/api/v2010/account/call/stream.py | 10 +- .../account/call/user_defined_message.py | 10 +- .../call/user_defined_message_subscription.py | 10 +- .../v2010/account/conference/participant.py | 10 +- .../account/incoming_phone_number/__init__.py | 10 +- .../assigned_add_on/__init__.py | 10 +- .../account/incoming_phone_number/local.py | 10 +- .../account/incoming_phone_number/mobile.py | 10 +- .../incoming_phone_number/toll_free.py | 10 +- .../api/v2010/account/message/__init__.py | 10 +- .../api/v2010/account/message/feedback.py | 10 +- twilio/rest/api/v2010/account/new_key.py | 10 +- .../rest/api/v2010/account/new_signing_key.py | 10 +- .../rest/api/v2010/account/queue/__init__.py | 10 +- .../api/v2010/account/recording/__init__.py | 2 +- .../account/sip/credential_list/__init__.py | 10 +- .../account/sip/credential_list/credential.py | 10 +- .../api/v2010/account/sip/domain/__init__.py | 10 +- .../auth_calls_credential_list_mapping.py | 10 +- ...th_calls_ip_access_control_list_mapping.py | 10 +- ...h_registrations_credential_list_mapping.py | 10 +- .../sip/domain/credential_list_mapping.py | 10 +- .../domain/ip_access_control_list_mapping.py | 10 +- .../sip/ip_access_control_list/__init__.py | 10 +- .../sip/ip_access_control_list/ip_address.py | 10 +- twilio/rest/api/v2010/account/token.py | 10 +- .../rest/api/v2010/account/usage/trigger.py | 10 +- .../api/v2010/account/validation_request.py | 10 +- .../v1/export/export_custom_job.py | 10 +- twilio/rest/chat/v1/credential.py | 10 +- twilio/rest/chat/v1/service/__init__.py | 10 +- .../rest/chat/v1/service/channel/__init__.py | 10 +- twilio/rest/chat/v1/service/channel/invite.py | 10 +- twilio/rest/chat/v1/service/channel/member.py | 10 +- .../rest/chat/v1/service/channel/message.py | 10 +- twilio/rest/chat/v1/service/role.py | 10 +- twilio/rest/chat/v1/service/user/__init__.py | 10 +- twilio/rest/chat/v2/credential.py | 10 +- twilio/rest/chat/v2/service/__init__.py | 10 +- .../rest/chat/v2/service/channel/__init__.py | 2 + twilio/rest/chat/v2/service/channel/invite.py | 10 +- twilio/rest/chat/v2/service/channel/member.py | 2 + .../rest/chat/v2/service/channel/message.py | 2 + .../rest/chat/v2/service/channel/webhook.py | 10 +- twilio/rest/chat/v2/service/role.py | 10 +- twilio/rest/chat/v2/service/user/__init__.py | 2 + twilio/rest/content/v1/content/__init__.py | 481 +----------------- .../content/v1/content/approval_create.py | 60 +-- .../rest/content/v1/content/approval_fetch.py | 32 +- .../rest/content/v1/content_and_approvals.py | 2 +- .../conversations/v1/address_configuration.py | 10 +- .../conversations/v1/conversation/__init__.py | 2 + .../v1/conversation/message/__init__.py | 2 + .../v1/conversation/participant.py | 2 + .../conversations/v1/conversation/webhook.py | 10 +- twilio/rest/conversations/v1/credential.py | 10 +- twilio/rest/conversations/v1/role.py | 10 +- .../rest/conversations/v1/service/__init__.py | 10 +- .../v1/service/conversation/__init__.py | 2 + .../service/conversation/message/__init__.py | 2 + .../v1/service/conversation/participant.py | 2 + .../v1/service/conversation/webhook.py | 10 +- twilio/rest/conversations/v1/service/role.py | 10 +- .../conversations/v1/service/user/__init__.py | 2 + twilio/rest/conversations/v1/user/__init__.py | 2 + twilio/rest/events/v1/event_type.py | 4 + twilio/rest/events/v1/sink/__init__.py | 10 +- twilio/rest/events/v1/sink/sink_test.py | 13 +- twilio/rest/events/v1/sink/sink_validate.py | 10 +- .../rest/events/v1/subscription/__init__.py | 10 +- .../v1/subscription/subscribed_event.py | 10 +- twilio/rest/flex_api/v1/assessments.py | 2 + twilio/rest/flex_api/v1/channel.py | 10 +- twilio/rest/flex_api/v1/flex_flow.py | 10 +- .../v1/insights_assessments_comment.py | 2 + .../flex_api/v1/insights_questionnaires.py | 2 + .../v1/insights_questionnaires_category.py | 2 + .../v1/insights_questionnaires_question.py | 2 + .../v1/insights_settings_answer_sets.py | 2 + .../flex_api/v1/insights_settings_comment.py | 2 + .../rest/flex_api/v1/interaction/__init__.py | 10 +- .../interaction_channel_invite.py | 10 +- .../interaction_channel_participant.py | 10 +- twilio/rest/flex_api/v1/plugin/__init__.py | 2 + .../flex_api/v1/plugin/plugin_versions.py | 2 + .../v1/plugin_configuration/__init__.py | 2 + twilio/rest/flex_api/v1/plugin_release.py | 2 + twilio/rest/flex_api/v1/web_channel.py | 10 +- twilio/rest/flex_api/v2/web_channels.py | 2 + .../rest/intelligence/v2/custom_operator.py | 10 +- twilio/rest/intelligence/v2/service.py | 10 +- .../intelligence/v2/transcript/__init__.py | 10 +- twilio/rest/ip_messaging/v1/credential.py | 10 +- .../rest/ip_messaging/v1/service/__init__.py | 10 +- .../v1/service/channel/__init__.py | 10 +- .../ip_messaging/v1/service/channel/invite.py | 10 +- .../ip_messaging/v1/service/channel/member.py | 10 +- .../v1/service/channel/message.py | 10 +- twilio/rest/ip_messaging/v1/service/role.py | 10 +- .../ip_messaging/v1/service/user/__init__.py | 10 +- twilio/rest/ip_messaging/v2/credential.py | 10 +- .../rest/ip_messaging/v2/service/__init__.py | 10 +- .../v2/service/channel/__init__.py | 2 + .../ip_messaging/v2/service/channel/invite.py | 10 +- .../ip_messaging/v2/service/channel/member.py | 2 + .../v2/service/channel/message.py | 2 + .../v2/service/channel/webhook.py | 10 +- twilio/rest/ip_messaging/v2/service/role.py | 10 +- .../ip_messaging/v2/service/user/__init__.py | 2 + .../v1/installed_add_on/__init__.py | 10 +- .../installed_add_on_usage.py | 8 +- .../v1/brand_registration/__init__.py | 10 +- .../brand_registration_otp.py | 13 +- .../v1/brand_registration/brand_vetting.py | 10 +- twilio/rest/messaging/v1/external_campaign.py | 10 +- twilio/rest/messaging/v1/service/__init__.py | 10 +- .../rest/messaging/v1/service/alpha_sender.py | 10 +- .../rest/messaging/v1/service/phone_number.py | 10 +- .../rest/messaging/v1/service/short_code.py | 10 +- .../messaging/v1/service/us_app_to_person.py | 10 +- .../v1/service/us_app_to_person_usecase.py | 8 +- .../messaging/v1/tollfree_verification.py | 10 +- twilio/rest/messaging/v1/usecase.py | 9 +- twilio/rest/microvisor/v1/account_config.py | 10 +- twilio/rest/microvisor/v1/account_secret.py | 10 +- .../microvisor/v1/device/device_config.py | 10 +- .../microvisor/v1/device/device_secret.py | 10 +- twilio/rest/notify/v1/credential.py | 10 +- twilio/rest/notify/v1/service/__init__.py | 10 +- twilio/rest/notify/v1/service/binding.py | 10 +- twilio/rest/notify/v1/service/notification.py | 10 +- twilio/rest/numbers/v1/bulk_eligibility.py | 6 +- twilio/rest/numbers/v1/eligibility.py | 6 +- twilio/rest/numbers/v1/porting_port_in.py | 10 +- .../v1/porting_port_in_phone_number.py | 22 +- twilio/rest/numbers/v1/porting_portability.py | 4 - .../v1/porting_webhook_configuration.py | 6 +- .../v1/porting_webhook_configuration_fetch.py | 10 +- .../v1/signing_request_configuration.py | 6 +- .../v2/authorization_document/__init__.py | 10 +- .../numbers/v2/bulk_hosted_number_order.py | 6 +- twilio/rest/numbers/v2/hosted_number_order.py | 10 +- .../regulatory_compliance/bundle/__init__.py | 10 +- .../bundle/bundle_copy.py | 10 +- .../bundle/evaluation.py | 12 +- .../bundle/item_assignment.py | 10 +- .../bundle/replace_items.py | 10 +- .../v2/regulatory_compliance/end_user.py | 10 +- .../supporting_document.py | 10 +- twilio/rest/oauth/v1/authorize.py | 8 +- twilio/rest/oauth/v1/token.py | 10 +- .../deployed_devices/fleet/__init__.py | 10 +- .../deployed_devices/fleet/certificate.py | 10 +- .../deployed_devices/fleet/deployment.py | 10 +- .../preview/deployed_devices/fleet/device.py | 10 +- .../preview/deployed_devices/fleet/key.py | 10 +- .../authorization_document/__init__.py | 10 +- .../hosted_numbers/hosted_number_order.py | 10 +- .../marketplace/installed_add_on/__init__.py | 10 +- twilio/rest/preview/sync/service/__init__.py | 10 +- .../preview/sync/service/document/__init__.py | 10 +- .../sync/service/sync_list/__init__.py | 10 +- .../sync/service/sync_list/sync_list_item.py | 10 +- .../preview/sync/service/sync_map/__init__.py | 10 +- .../sync/service/sync_map/sync_map_item.py | 10 +- twilio/rest/preview/wireless/command.py | 10 +- twilio/rest/preview/wireless/rate_plan.py | 10 +- twilio/rest/proxy/v1/service/__init__.py | 10 +- twilio/rest/proxy/v1/service/phone_number.py | 10 +- .../rest/proxy/v1/service/session/__init__.py | 10 +- .../service/session/participant/__init__.py | 10 +- .../participant/message_interaction.py | 10 +- twilio/rest/proxy/v1/service/short_code.py | 10 +- twilio/rest/serverless/v1/service/__init__.py | 10 +- .../serverless/v1/service/asset/__init__.py | 10 +- .../serverless/v1/service/build/__init__.py | 12 +- .../v1/service/environment/__init__.py | 10 +- .../v1/service/environment/deployment.py | 10 +- .../v1/service/environment/variable.py | 10 +- .../v1/service/function/__init__.py | 10 +- .../studio/v1/flow/engagement/__init__.py | 10 +- .../rest/studio/v1/flow/execution/__init__.py | 10 +- twilio/rest/studio/v2/flow/__init__.py | 10 +- .../rest/studio/v2/flow/execution/__init__.py | 10 +- twilio/rest/studio/v2/flow_validate.py | 10 +- twilio/rest/supersim/v1/esim_profile.py | 10 +- twilio/rest/supersim/v1/fleet.py | 10 +- twilio/rest/supersim/v1/ip_command.py | 10 +- .../v1/network_access_profile/__init__.py | 10 +- .../network_access_profile_network.py | 10 +- twilio/rest/supersim/v1/sim/__init__.py | 10 +- twilio/rest/supersim/v1/sms_command.py | 10 +- twilio/rest/sync/v1/service/__init__.py | 10 +- .../rest/sync/v1/service/document/__init__.py | 10 +- .../sync/v1/service/sync_list/__init__.py | 10 +- .../v1/service/sync_list/sync_list_item.py | 10 +- .../rest/sync/v1/service/sync_map/__init__.py | 10 +- .../sync/v1/service/sync_map/sync_map_item.py | 10 +- .../sync/v1/service/sync_stream/__init__.py | 10 +- .../v1/service/sync_stream/stream_message.py | 10 +- .../rest/taskrouter/v1/workspace/__init__.py | 10 +- .../rest/taskrouter/v1/workspace/activity.py | 10 +- .../taskrouter/v1/workspace/task/__init__.py | 10 +- .../taskrouter/v1/workspace/task_channel.py | 10 +- .../v1/workspace/task_queue/__init__.py | 10 +- .../task_queue_bulk_real_time_statistics.py | 6 +- .../v1/workspace/worker/__init__.py | 10 +- .../v1/workspace/workflow/__init__.py | 10 +- twilio/rest/trunking/v1/trunk/__init__.py | 10 +- .../rest/trunking/v1/trunk/credential_list.py | 10 +- .../v1/trunk/ip_access_control_list.py | 10 +- .../rest/trunking/v1/trunk/origination_url.py | 10 +- twilio/rest/trunking/v1/trunk/phone_number.py | 10 +- .../rest/trusthub/v1/compliance_inquiries.py | 10 +- .../v1/compliance_registration_inquiries.py | 10 +- .../v1/compliance_tollfree_inquiries.py | 20 +- .../trusthub/v1/customer_profiles/__init__.py | 10 +- ...er_profiles_channel_endpoint_assignment.py | 10 +- .../customer_profiles_entity_assignments.py | 10 +- .../customer_profiles_evaluations.py | 10 +- twilio/rest/trusthub/v1/end_user.py | 10 +- .../rest/trusthub/v1/supporting_document.py | 10 +- .../trusthub/v1/trust_products/__init__.py | 10 +- ...st_products_channel_endpoint_assignment.py | 10 +- .../trust_products_entity_assignments.py | 10 +- .../trust_products_evaluations.py | 10 +- twilio/rest/verify/v2/safelist.py | 10 +- twilio/rest/verify/v2/service/__init__.py | 10 +- twilio/rest/verify/v2/service/access_token.py | 10 +- .../rest/verify/v2/service/entity/__init__.py | 10 +- .../v2/service/entity/challenge/__init__.py | 10 +- .../service/entity/challenge/notification.py | 10 +- .../verify/v2/service/entity/new_factor.py | 10 +- .../v2/service/messaging_configuration.py | 10 +- .../verify/v2/service/rate_limit/__init__.py | 10 +- .../verify/v2/service/rate_limit/bucket.py | 10 +- twilio/rest/verify/v2/service/verification.py | 10 +- .../verify/v2/service/verification_check.py | 10 +- twilio/rest/verify/v2/service/webhook.py | 10 +- twilio/rest/video/v1/composition.py | 10 +- twilio/rest/video/v1/composition_hook.py | 10 +- twilio/rest/video/v1/room/__init__.py | 10 +- .../v1/room/participant/subscribe_rules.py | 18 +- twilio/rest/video/v1/room/recording_rules.py | 18 +- twilio/rest/voice/v1/byoc_trunk.py | 10 +- .../voice/v1/connection_policy/__init__.py | 10 +- .../connection_policy_target.py | 10 +- .../bulk_country_update.py | 10 +- twilio/rest/voice/v1/ip_record.py | 10 +- twilio/rest/voice/v1/source_ip_mapping.py | 10 +- twilio/rest/wireless/v1/command.py | 10 +- twilio/rest/wireless/v1/rate_plan.py | 10 +- 264 files changed, 1119 insertions(+), 1860 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 1dfa5043a6..b76a6331be 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,30 @@ twilio-python Changelog Here you can see the full list of changes between each twilio-python release. +[2024-06-18] Version 9.2.0 +-------------------------- +**Library - Chore** +- [PR #796](https://github.com/twilio/twilio-python/pull/796): adding contentType in post and put. Thanks to [@tiwarishubham635](https://github.com/tiwarishubham635)! + +**Events** +- Add `status` and `documentation_url` to Event Types + +**Lookups** +- Removed unused `fraud` lookups in V1 only to facilitate rest proxy migration + +**Numbers** +- Add date_created field to the Get Port In Request API +- Rename the `status_last_time_updated_timestamp` field to `last_updated` in the Get Port In Phone Number API **(breaking change)** +- Add Rejection reason and rejection reason code to the Get Port In Phone Number API +- Remove the carrier information from the Portability API + +**Proxy** +- Change property `type` from enum to ienum + +**Trusthub** +- Add skipMessagingUseCase field in compliance_tollfree_inquiry. + + [2024-06-06] Version 9.1.1 -------------------------- **Api** diff --git a/twilio/rest/accounts/v1/credential/aws.py b/twilio/rest/accounts/v1/credential/aws.py index ab75620920..05d92755c4 100644 --- a/twilio/rest/accounts/v1/credential/aws.py +++ b/twilio/rest/accounts/v1/credential/aws.py @@ -330,11 +330,10 @@ def create( "AccountSid": account_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AwsInstance(self._version, payload) @@ -362,11 +361,10 @@ async def create_async( "AccountSid": account_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AwsInstance(self._version, payload) diff --git a/twilio/rest/accounts/v1/credential/public_key.py b/twilio/rest/accounts/v1/credential/public_key.py index 09018d1d26..ec2a1f8660 100644 --- a/twilio/rest/accounts/v1/credential/public_key.py +++ b/twilio/rest/accounts/v1/credential/public_key.py @@ -334,11 +334,10 @@ def create( "AccountSid": account_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return PublicKeyInstance(self._version, payload) @@ -366,11 +365,10 @@ async def create_async( "AccountSid": account_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return PublicKeyInstance(self._version, payload) diff --git a/twilio/rest/accounts/v1/safelist.py b/twilio/rest/accounts/v1/safelist.py index ce5672caed..51f00fd8ca 100644 --- a/twilio/rest/accounts/v1/safelist.py +++ b/twilio/rest/accounts/v1/safelist.py @@ -69,11 +69,10 @@ def create(self, phone_number: str) -> SafelistInstance: "PhoneNumber": phone_number, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SafelistInstance(self._version, payload) @@ -92,11 +91,10 @@ async def create_async(self, phone_number: str) -> SafelistInstance: "PhoneNumber": phone_number, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SafelistInstance(self._version, payload) @@ -108,13 +106,16 @@ def delete(self, phone_number: Union[str, object] = values.unset) -> bool: :param phone_number: The phone number to be removed from SafeList. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). :returns: True if delete succeeds, False otherwise """ + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) params = values.of( { "PhoneNumber": phone_number, } ) - return self._version.delete(method="DELETE", uri=self._uri, params=params) + return self._version.delete( + method="DELETE", uri=self._uri, headers=headers, params=params + ) async def delete_async( self, phone_number: Union[str, object] = values.unset @@ -125,6 +126,7 @@ async def delete_async( :param phone_number: The phone number to be removed from SafeList. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). :returns: True if delete succeeds, False otherwise """ + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) params = values.of( { @@ -132,7 +134,7 @@ async def delete_async( } ) return await self._version.delete_async( - method="DELETE", uri=self._uri, params=params + method="DELETE", uri=self._uri, headers=headers, params=params ) def fetch( @@ -144,6 +146,7 @@ def fetch( :param phone_number: The phone number to be fetched from SafeList. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). :returns: The fetched SafelistInstance """ + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) params = values.of( { @@ -151,7 +154,9 @@ def fetch( } ) - payload = self._version.fetch(method="GET", uri=self._uri, params=params) + payload = self._version.fetch( + method="GET", uri=self._uri, headers=headers, params=params + ) return SafelistInstance(self._version, payload) @@ -164,6 +169,7 @@ async def fetch_async( :param phone_number: The phone number to be fetched from SafeList. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). :returns: The fetched SafelistInstance """ + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) params = values.of( { @@ -172,7 +178,7 @@ async def fetch_async( ) payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=params + method="GET", uri=self._uri, headers=headers, params=params ) return SafelistInstance(self._version, payload) diff --git a/twilio/rest/api/v2010/account/__init__.py b/twilio/rest/api/v2010/account/__init__.py index adf2458f2a..dc0c53c9c0 100644 --- a/twilio/rest/api/v2010/account/__init__.py +++ b/twilio/rest/api/v2010/account/__init__.py @@ -830,11 +830,10 @@ def create( "FriendlyName": friendly_name, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AccountInstance(self._version, payload) @@ -855,11 +854,10 @@ async def create_async( "FriendlyName": friendly_name, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AccountInstance(self._version, payload) diff --git a/twilio/rest/api/v2010/account/address/__init__.py b/twilio/rest/api/v2010/account/address/__init__.py index fd77747102..36ee8f2231 100644 --- a/twilio/rest/api/v2010/account/address/__init__.py +++ b/twilio/rest/api/v2010/account/address/__init__.py @@ -529,11 +529,10 @@ def create( "StreetSecondary": street_secondary, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AddressInstance( @@ -584,11 +583,10 @@ async def create_async( "StreetSecondary": street_secondary, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AddressInstance( diff --git a/twilio/rest/api/v2010/account/application.py b/twilio/rest/api/v2010/account/application.py index a3b11f0282..d1e50c5f04 100644 --- a/twilio/rest/api/v2010/account/application.py +++ b/twilio/rest/api/v2010/account/application.py @@ -636,11 +636,10 @@ def create( ), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ApplicationInstance( @@ -713,11 +712,10 @@ async def create_async( ), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ApplicationInstance( diff --git a/twilio/rest/api/v2010/account/balance.py b/twilio/rest/api/v2010/account/balance.py index 0e90cdaae0..97c7b33035 100644 --- a/twilio/rest/api/v2010/account/balance.py +++ b/twilio/rest/api/v2010/account/balance.py @@ -13,6 +13,7 @@ """ from typing import Any, Dict, Optional +from twilio.base import values from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -72,8 +73,9 @@ def fetch(self) -> BalanceInstance: :returns: The fetched BalanceInstance """ + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - payload = self._version.fetch(method="GET", uri=self._uri) + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return BalanceInstance( self._version, payload, account_sid=self._solution["account_sid"] @@ -86,8 +88,11 @@ async def fetch_async(self) -> BalanceInstance: :returns: The fetched BalanceInstance """ + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - payload = await self._version.fetch_async(method="GET", uri=self._uri) + payload = await self._version.fetch_async( + method="GET", uri=self._uri, headers=headers + ) return BalanceInstance( self._version, payload, account_sid=self._solution["account_sid"] diff --git a/twilio/rest/api/v2010/account/call/__init__.py b/twilio/rest/api/v2010/account/call/__init__.py index 2ba343f566..fa8e40707b 100644 --- a/twilio/rest/api/v2010/account/call/__init__.py +++ b/twilio/rest/api/v2010/account/call/__init__.py @@ -65,7 +65,7 @@ class UpdateStatus(object): :ivar start_time: The start time of the call, given as UTC in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. Empty if the call has not yet been dialed. :ivar end_time: The time the call ended, given as UTC in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. Empty if the call did not complete successfully. :ivar duration: The length of the call in seconds. This value is empty for busy, failed, unanswered, or ongoing calls. - :ivar price: The charge for this call, in the currency associated with the account. Populated after the call is completed. May not be immediately available. + :ivar price: The charge for this call, in the currency associated with the account. Populated after the call is completed. May not be immediately available. The price associated with a call only reflects the charge for connectivity. Charges for other call-related features such as Answering Machine Detection, Text-To-Speech, and SIP REFER are not included in this value. :ivar price_unit: The currency in which `Price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g., `USD`, `EUR`, `JPY`). Always capitalized for calls. :ivar direction: A string describing the direction of the call. Can be: `inbound` for inbound calls, `outbound-api` for calls initiated via the REST API or `outbound-dial` for calls initiated by a `` verb. Using [Elastic SIP Trunking](https://www.twilio.com/docs/sip-trunking), the values can be [`trunking-terminating`](https://www.twilio.com/docs/sip-trunking#termination) for outgoing calls from your communications infrastructure to the PSTN or [`trunking-originating`](https://www.twilio.com/docs/sip-trunking#origination) for incoming calls to your communications infrastructure from the PSTN. :ivar answered_by: Either `human` or `machine` if this call was initiated with answering machine detection. Empty otherwise. @@ -807,11 +807,10 @@ def create( "ApplicationSid": application_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CallInstance( @@ -941,11 +940,10 @@ async def create_async( "ApplicationSid": application_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CallInstance( diff --git a/twilio/rest/api/v2010/account/call/payment.py b/twilio/rest/api/v2010/account/call/payment.py index 08619588de..00f76be814 100644 --- a/twilio/rest/api/v2010/account/call/payment.py +++ b/twilio/rest/api/v2010/account/call/payment.py @@ -362,11 +362,10 @@ def create( "ValidCardTypes": valid_card_types, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return PaymentInstance( @@ -440,11 +439,10 @@ async def create_async( "ValidCardTypes": valid_card_types, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return PaymentInstance( diff --git a/twilio/rest/api/v2010/account/call/recording.py b/twilio/rest/api/v2010/account/call/recording.py index b9653c4b5b..71158a2fe8 100644 --- a/twilio/rest/api/v2010/account/call/recording.py +++ b/twilio/rest/api/v2010/account/call/recording.py @@ -454,11 +454,10 @@ def create( "RecordingTrack": recording_track, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RecordingInstance( @@ -502,11 +501,10 @@ async def create_async( "RecordingTrack": recording_track, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RecordingInstance( diff --git a/twilio/rest/api/v2010/account/call/siprec.py b/twilio/rest/api/v2010/account/call/siprec.py index bcb537071f..28a0734e19 100644 --- a/twilio/rest/api/v2010/account/call/siprec.py +++ b/twilio/rest/api/v2010/account/call/siprec.py @@ -861,11 +861,10 @@ def create( "Parameter99.Value": parameter99_value, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SiprecInstance( @@ -1498,11 +1497,10 @@ async def create_async( "Parameter99.Value": parameter99_value, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SiprecInstance( diff --git a/twilio/rest/api/v2010/account/call/stream.py b/twilio/rest/api/v2010/account/call/stream.py index 3975f52d49..b3fa197bf8 100644 --- a/twilio/rest/api/v2010/account/call/stream.py +++ b/twilio/rest/api/v2010/account/call/stream.py @@ -863,11 +863,10 @@ def create( "Parameter99.Value": parameter99_value, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return StreamInstance( @@ -1500,11 +1499,10 @@ async def create_async( "Parameter99.Value": parameter99_value, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return StreamInstance( diff --git a/twilio/rest/api/v2010/account/call/user_defined_message.py b/twilio/rest/api/v2010/account/call/user_defined_message.py index 0e9d1f0490..4b43383711 100644 --- a/twilio/rest/api/v2010/account/call/user_defined_message.py +++ b/twilio/rest/api/v2010/account/call/user_defined_message.py @@ -98,11 +98,10 @@ def create( "IdempotencyKey": idempotency_key, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return UserDefinedMessageInstance( @@ -130,11 +129,10 @@ async def create_async( "IdempotencyKey": idempotency_key, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return UserDefinedMessageInstance( diff --git a/twilio/rest/api/v2010/account/call/user_defined_message_subscription.py b/twilio/rest/api/v2010/account/call/user_defined_message_subscription.py index a0b7c18339..677042bd7c 100644 --- a/twilio/rest/api/v2010/account/call/user_defined_message_subscription.py +++ b/twilio/rest/api/v2010/account/call/user_defined_message_subscription.py @@ -206,11 +206,10 @@ def create( "Method": method, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return UserDefinedMessageSubscriptionInstance( @@ -243,11 +242,10 @@ async def create_async( "Method": method, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return UserDefinedMessageSubscriptionInstance( diff --git a/twilio/rest/api/v2010/account/conference/participant.py b/twilio/rest/api/v2010/account/conference/participant.py index 2c7ae5932c..3706cd24fa 100644 --- a/twilio/rest/api/v2010/account/conference/participant.py +++ b/twilio/rest/api/v2010/account/conference/participant.py @@ -701,11 +701,10 @@ def create( "CallToken": call_token, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ParticipantInstance( @@ -887,11 +886,10 @@ async def create_async( "CallToken": call_token, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ParticipantInstance( diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/__init__.py b/twilio/rest/api/v2010/account/incoming_phone_number/__init__.py index 6fa4748b60..d1001a7cae 100644 --- a/twilio/rest/api/v2010/account/incoming_phone_number/__init__.py +++ b/twilio/rest/api/v2010/account/incoming_phone_number/__init__.py @@ -845,11 +845,10 @@ def create( "AreaCode": area_code, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return IncomingPhoneNumberInstance( @@ -948,11 +947,10 @@ async def create_async( "AreaCode": area_code, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return IncomingPhoneNumberInstance( diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/__init__.py b/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/__init__.py index 12c6f961e4..a6ced82856 100644 --- a/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/__init__.py +++ b/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/__init__.py @@ -320,11 +320,10 @@ def create(self, installed_add_on_sid: str) -> AssignedAddOnInstance: "InstalledAddOnSid": installed_add_on_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AssignedAddOnInstance( @@ -348,11 +347,10 @@ async def create_async(self, installed_add_on_sid: str) -> AssignedAddOnInstance "InstalledAddOnSid": installed_add_on_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AssignedAddOnInstance( diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/local.py b/twilio/rest/api/v2010/account/incoming_phone_number/local.py index 4548720329..ca7baa8552 100644 --- a/twilio/rest/api/v2010/account/incoming_phone_number/local.py +++ b/twilio/rest/api/v2010/account/incoming_phone_number/local.py @@ -279,11 +279,10 @@ def create( "BundleSid": bundle_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return LocalInstance( @@ -377,11 +376,10 @@ async def create_async( "BundleSid": bundle_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return LocalInstance( diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/mobile.py b/twilio/rest/api/v2010/account/incoming_phone_number/mobile.py index 6147d4bfe7..830897b178 100644 --- a/twilio/rest/api/v2010/account/incoming_phone_number/mobile.py +++ b/twilio/rest/api/v2010/account/incoming_phone_number/mobile.py @@ -281,11 +281,10 @@ def create( "BundleSid": bundle_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return MobileInstance( @@ -381,11 +380,10 @@ async def create_async( "BundleSid": bundle_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return MobileInstance( diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/toll_free.py b/twilio/rest/api/v2010/account/incoming_phone_number/toll_free.py index 806b7c0500..8625e318c6 100644 --- a/twilio/rest/api/v2010/account/incoming_phone_number/toll_free.py +++ b/twilio/rest/api/v2010/account/incoming_phone_number/toll_free.py @@ -281,11 +281,10 @@ def create( "BundleSid": bundle_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return TollFreeInstance( @@ -381,11 +380,10 @@ async def create_async( "BundleSid": bundle_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return TollFreeInstance( diff --git a/twilio/rest/api/v2010/account/message/__init__.py b/twilio/rest/api/v2010/account/message/__init__.py index ff0ed8561f..7eb11d3889 100644 --- a/twilio/rest/api/v2010/account/message/__init__.py +++ b/twilio/rest/api/v2010/account/message/__init__.py @@ -560,11 +560,10 @@ def create( "ContentSid": content_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return MessageInstance( @@ -658,11 +657,10 @@ async def create_async( "ContentSid": content_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return MessageInstance( diff --git a/twilio/rest/api/v2010/account/message/feedback.py b/twilio/rest/api/v2010/account/message/feedback.py index 2ccce06a54..797c9a7331 100644 --- a/twilio/rest/api/v2010/account/message/feedback.py +++ b/twilio/rest/api/v2010/account/message/feedback.py @@ -111,11 +111,10 @@ def create( "Outcome": outcome, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return FeedbackInstance( @@ -141,11 +140,10 @@ async def create_async( "Outcome": outcome, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return FeedbackInstance( diff --git a/twilio/rest/api/v2010/account/new_key.py b/twilio/rest/api/v2010/account/new_key.py index 015249ddf8..fcefed5b62 100644 --- a/twilio/rest/api/v2010/account/new_key.py +++ b/twilio/rest/api/v2010/account/new_key.py @@ -91,11 +91,10 @@ def create( "FriendlyName": friendly_name, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return NewKeyInstance( @@ -118,11 +117,10 @@ async def create_async( "FriendlyName": friendly_name, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return NewKeyInstance( diff --git a/twilio/rest/api/v2010/account/new_signing_key.py b/twilio/rest/api/v2010/account/new_signing_key.py index 6bfa32324b..bb9b0f2e2d 100644 --- a/twilio/rest/api/v2010/account/new_signing_key.py +++ b/twilio/rest/api/v2010/account/new_signing_key.py @@ -91,11 +91,10 @@ def create( "FriendlyName": friendly_name, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return NewSigningKeyInstance( @@ -118,11 +117,10 @@ async def create_async( "FriendlyName": friendly_name, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return NewSigningKeyInstance( diff --git a/twilio/rest/api/v2010/account/queue/__init__.py b/twilio/rest/api/v2010/account/queue/__init__.py index 4e6c87baa9..4031ba8196 100644 --- a/twilio/rest/api/v2010/account/queue/__init__.py +++ b/twilio/rest/api/v2010/account/queue/__init__.py @@ -405,11 +405,10 @@ def create( "MaxSize": max_size, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return QueueInstance( @@ -434,11 +433,10 @@ async def create_async( "MaxSize": max_size, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return QueueInstance( diff --git a/twilio/rest/api/v2010/account/recording/__init__.py b/twilio/rest/api/v2010/account/recording/__init__.py index bc1ddccb76..1766600ec3 100644 --- a/twilio/rest/api/v2010/account/recording/__init__.py +++ b/twilio/rest/api/v2010/account/recording/__init__.py @@ -57,7 +57,7 @@ class Status(object): :ivar price: The one-time cost of creating the recording in the `price_unit` currency. :ivar price_unit: The currency used in the `price` property. Example: `USD`. :ivar status: - :ivar channels: The number of channels in the final recording file. Can be: `1` or `2`. You can split a call with two legs into two separate recording channels if you record using [TwiML Dial](https://www.twilio.com/docs/voice/twiml/dial#record) or the [Outbound Rest API](https://www.twilio.com/docs/voice/make-calls#manage-your-outbound-call). + :ivar channels: The number of channels in the final recording file. Can be: `1` or `2`. :ivar source: :ivar error_code: The error code that describes why the recording is `absent`. The error code is described in our [Error Dictionary](https://www.twilio.com/docs/api/errors). This value is null if the recording `status` is not `absent`. :ivar uri: The URI of the resource, relative to `https://api.twilio.com`. diff --git a/twilio/rest/api/v2010/account/sip/credential_list/__init__.py b/twilio/rest/api/v2010/account/sip/credential_list/__init__.py index 634500f8cf..30bb7094e7 100644 --- a/twilio/rest/api/v2010/account/sip/credential_list/__init__.py +++ b/twilio/rest/api/v2010/account/sip/credential_list/__init__.py @@ -375,11 +375,10 @@ def create(self, friendly_name: str) -> CredentialListInstance: "FriendlyName": friendly_name, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CredentialListInstance( @@ -400,11 +399,10 @@ async def create_async(self, friendly_name: str) -> CredentialListInstance: "FriendlyName": friendly_name, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CredentialListInstance( diff --git a/twilio/rest/api/v2010/account/sip/credential_list/credential.py b/twilio/rest/api/v2010/account/sip/credential_list/credential.py index 3d2c24b999..1e46bfe16e 100644 --- a/twilio/rest/api/v2010/account/sip/credential_list/credential.py +++ b/twilio/rest/api/v2010/account/sip/credential_list/credential.py @@ -374,11 +374,10 @@ def create(self, username: str, password: str) -> CredentialInstance: "Password": password, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CredentialInstance( @@ -404,11 +403,10 @@ async def create_async(self, username: str, password: str) -> CredentialInstance "Password": password, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CredentialInstance( diff --git a/twilio/rest/api/v2010/account/sip/domain/__init__.py b/twilio/rest/api/v2010/account/sip/domain/__init__.py index b469628388..9ea7260438 100644 --- a/twilio/rest/api/v2010/account/sip/domain/__init__.py +++ b/twilio/rest/api/v2010/account/sip/domain/__init__.py @@ -658,11 +658,10 @@ def create( "EmergencyCallerSid": emergency_caller_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return DomainInstance( @@ -724,11 +723,10 @@ async def create_async( "EmergencyCallerSid": emergency_caller_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return DomainInstance( diff --git a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/auth_calls_credential_list_mapping.py b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/auth_calls_credential_list_mapping.py index 81bb5b0b0c..ff6fd5136e 100644 --- a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/auth_calls_credential_list_mapping.py +++ b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/auth_calls_credential_list_mapping.py @@ -288,11 +288,10 @@ def create( "CredentialListSid": credential_list_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AuthCallsCredentialListMappingInstance( @@ -318,11 +317,10 @@ async def create_async( "CredentialListSid": credential_list_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AuthCallsCredentialListMappingInstance( diff --git a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/auth_calls_ip_access_control_list_mapping.py b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/auth_calls_ip_access_control_list_mapping.py index a690ef4b10..82099164e7 100644 --- a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/auth_calls_ip_access_control_list_mapping.py +++ b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/auth_calls_ip_access_control_list_mapping.py @@ -292,11 +292,10 @@ def create( "IpAccessControlListSid": ip_access_control_list_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AuthCallsIpAccessControlListMappingInstance( @@ -322,11 +321,10 @@ async def create_async( "IpAccessControlListSid": ip_access_control_list_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AuthCallsIpAccessControlListMappingInstance( diff --git a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_registrations/auth_registrations_credential_list_mapping.py b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_registrations/auth_registrations_credential_list_mapping.py index 2b03bb2998..22acb7ef10 100644 --- a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_registrations/auth_registrations_credential_list_mapping.py +++ b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_registrations/auth_registrations_credential_list_mapping.py @@ -288,11 +288,10 @@ def create( "CredentialListSid": credential_list_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AuthRegistrationsCredentialListMappingInstance( @@ -318,11 +317,10 @@ async def create_async( "CredentialListSid": credential_list_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AuthRegistrationsCredentialListMappingInstance( diff --git a/twilio/rest/api/v2010/account/sip/domain/credential_list_mapping.py b/twilio/rest/api/v2010/account/sip/domain/credential_list_mapping.py index f7838bfc59..e20e08e0fb 100644 --- a/twilio/rest/api/v2010/account/sip/domain/credential_list_mapping.py +++ b/twilio/rest/api/v2010/account/sip/domain/credential_list_mapping.py @@ -284,11 +284,10 @@ def create(self, credential_list_sid: str) -> CredentialListMappingInstance: "CredentialListSid": credential_list_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CredentialListMappingInstance( @@ -314,11 +313,10 @@ async def create_async( "CredentialListSid": credential_list_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CredentialListMappingInstance( diff --git a/twilio/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.py b/twilio/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.py index c619be386f..607bb6ce12 100644 --- a/twilio/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.py +++ b/twilio/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.py @@ -290,11 +290,10 @@ def create( "IpAccessControlListSid": ip_access_control_list_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return IpAccessControlListMappingInstance( @@ -320,11 +319,10 @@ async def create_async( "IpAccessControlListSid": ip_access_control_list_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return IpAccessControlListMappingInstance( diff --git a/twilio/rest/api/v2010/account/sip/ip_access_control_list/__init__.py b/twilio/rest/api/v2010/account/sip/ip_access_control_list/__init__.py index 7c2fd8214a..cf75721a96 100644 --- a/twilio/rest/api/v2010/account/sip/ip_access_control_list/__init__.py +++ b/twilio/rest/api/v2010/account/sip/ip_access_control_list/__init__.py @@ -379,11 +379,10 @@ def create(self, friendly_name: str) -> IpAccessControlListInstance: "FriendlyName": friendly_name, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return IpAccessControlListInstance( @@ -404,11 +403,10 @@ async def create_async(self, friendly_name: str) -> IpAccessControlListInstance: "FriendlyName": friendly_name, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return IpAccessControlListInstance( diff --git a/twilio/rest/api/v2010/account/sip/ip_access_control_list/ip_address.py b/twilio/rest/api/v2010/account/sip/ip_access_control_list/ip_address.py index 251bae9655..106bd7400e 100644 --- a/twilio/rest/api/v2010/account/sip/ip_access_control_list/ip_address.py +++ b/twilio/rest/api/v2010/account/sip/ip_access_control_list/ip_address.py @@ -425,11 +425,10 @@ def create( "CidrPrefixLength": cidr_prefix_length, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return IpAddressInstance( @@ -462,11 +461,10 @@ async def create_async( "CidrPrefixLength": cidr_prefix_length, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return IpAddressInstance( diff --git a/twilio/rest/api/v2010/account/token.py b/twilio/rest/api/v2010/account/token.py index ec5acac97f..6d5edcf3e8 100644 --- a/twilio/rest/api/v2010/account/token.py +++ b/twilio/rest/api/v2010/account/token.py @@ -93,11 +93,10 @@ def create(self, ttl: Union[int, object] = values.unset) -> TokenInstance: "Ttl": ttl, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return TokenInstance( @@ -120,11 +119,10 @@ async def create_async( "Ttl": ttl, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return TokenInstance( diff --git a/twilio/rest/api/v2010/account/usage/trigger.py b/twilio/rest/api/v2010/account/usage/trigger.py index 66e86602af..c3a1b241ca 100644 --- a/twilio/rest/api/v2010/account/usage/trigger.py +++ b/twilio/rest/api/v2010/account/usage/trigger.py @@ -766,11 +766,10 @@ def create( "TriggerBy": trigger_by, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return TriggerInstance( @@ -812,11 +811,10 @@ async def create_async( "TriggerBy": trigger_by, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return TriggerInstance( diff --git a/twilio/rest/api/v2010/account/validation_request.py b/twilio/rest/api/v2010/account/validation_request.py index a949df2d0a..261322712f 100644 --- a/twilio/rest/api/v2010/account/validation_request.py +++ b/twilio/rest/api/v2010/account/validation_request.py @@ -104,11 +104,10 @@ def create( "StatusCallbackMethod": status_callback_method, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ValidationRequestInstance( @@ -147,11 +146,10 @@ async def create_async( "StatusCallbackMethod": status_callback_method, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ValidationRequestInstance( diff --git a/twilio/rest/bulkexports/v1/export/export_custom_job.py b/twilio/rest/bulkexports/v1/export/export_custom_job.py index 758398eba3..9a81fb23cb 100644 --- a/twilio/rest/bulkexports/v1/export/export_custom_job.py +++ b/twilio/rest/bulkexports/v1/export/export_custom_job.py @@ -138,11 +138,10 @@ def create( "Email": email, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ExportCustomJobInstance( @@ -181,11 +180,10 @@ async def create_async( "Email": email, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ExportCustomJobInstance( diff --git a/twilio/rest/chat/v1/credential.py b/twilio/rest/chat/v1/credential.py index 68ec9f4b46..6bb8b3f981 100644 --- a/twilio/rest/chat/v1/credential.py +++ b/twilio/rest/chat/v1/credential.py @@ -420,11 +420,10 @@ def create( "Secret": secret, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CredentialInstance(self._version, payload) @@ -464,11 +463,10 @@ async def create_async( "Secret": secret, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CredentialInstance(self._version, payload) diff --git a/twilio/rest/chat/v1/service/__init__.py b/twilio/rest/chat/v1/service/__init__.py index 1e2a5884a7..71825fe578 100644 --- a/twilio/rest/chat/v1/service/__init__.py +++ b/twilio/rest/chat/v1/service/__init__.py @@ -1089,11 +1089,10 @@ def create(self, friendly_name: str) -> ServiceInstance: "FriendlyName": friendly_name, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload) @@ -1112,11 +1111,10 @@ async def create_async(self, friendly_name: str) -> ServiceInstance: "FriendlyName": friendly_name, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload) diff --git a/twilio/rest/chat/v1/service/channel/__init__.py b/twilio/rest/chat/v1/service/channel/__init__.py index 1585613948..02c42f65cc 100644 --- a/twilio/rest/chat/v1/service/channel/__init__.py +++ b/twilio/rest/chat/v1/service/channel/__init__.py @@ -484,11 +484,10 @@ def create( "Type": type, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ChannelInstance( @@ -521,11 +520,10 @@ async def create_async( "Type": type, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ChannelInstance( diff --git a/twilio/rest/chat/v1/service/channel/invite.py b/twilio/rest/chat/v1/service/channel/invite.py index 6beccffae4..c80732a2c0 100644 --- a/twilio/rest/chat/v1/service/channel/invite.py +++ b/twilio/rest/chat/v1/service/channel/invite.py @@ -296,11 +296,10 @@ def create( "RoleSid": role_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return InviteInstance( @@ -328,11 +327,10 @@ async def create_async( "RoleSid": role_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return InviteInstance( diff --git a/twilio/rest/chat/v1/service/channel/member.py b/twilio/rest/chat/v1/service/channel/member.py index f0cd21448f..405662f02d 100644 --- a/twilio/rest/chat/v1/service/channel/member.py +++ b/twilio/rest/chat/v1/service/channel/member.py @@ -406,11 +406,10 @@ def create( "RoleSid": role_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return MemberInstance( @@ -438,11 +437,10 @@ async def create_async( "RoleSid": role_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return MemberInstance( diff --git a/twilio/rest/chat/v1/service/channel/message.py b/twilio/rest/chat/v1/service/channel/message.py index f524c92387..34d9e01fb3 100644 --- a/twilio/rest/chat/v1/service/channel/message.py +++ b/twilio/rest/chat/v1/service/channel/message.py @@ -416,11 +416,10 @@ def create( "Attributes": attributes, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return MessageInstance( @@ -453,11 +452,10 @@ async def create_async( "Attributes": attributes, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return MessageInstance( diff --git a/twilio/rest/chat/v1/service/role.py b/twilio/rest/chat/v1/service/role.py index 1913986a4a..3ed57a6ee2 100644 --- a/twilio/rest/chat/v1/service/role.py +++ b/twilio/rest/chat/v1/service/role.py @@ -361,11 +361,10 @@ def create( "Permission": serialize.map(permission, lambda e: e), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RoleInstance( @@ -392,11 +391,10 @@ async def create_async( "Permission": serialize.map(permission, lambda e: e), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RoleInstance( diff --git a/twilio/rest/chat/v1/service/user/__init__.py b/twilio/rest/chat/v1/service/user/__init__.py index b06509668a..13c4b9bef6 100644 --- a/twilio/rest/chat/v1/service/user/__init__.py +++ b/twilio/rest/chat/v1/service/user/__init__.py @@ -433,11 +433,10 @@ def create( "FriendlyName": friendly_name, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return UserInstance( @@ -470,11 +469,10 @@ async def create_async( "FriendlyName": friendly_name, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return UserInstance( diff --git a/twilio/rest/chat/v2/credential.py b/twilio/rest/chat/v2/credential.py index 8011ed0e1f..b098f6820c 100644 --- a/twilio/rest/chat/v2/credential.py +++ b/twilio/rest/chat/v2/credential.py @@ -420,11 +420,10 @@ def create( "Secret": secret, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CredentialInstance(self._version, payload) @@ -464,11 +463,10 @@ async def create_async( "Secret": secret, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CredentialInstance(self._version, payload) diff --git a/twilio/rest/chat/v2/service/__init__.py b/twilio/rest/chat/v2/service/__init__.py index f6fa9e2c49..376043aed6 100644 --- a/twilio/rest/chat/v2/service/__init__.py +++ b/twilio/rest/chat/v2/service/__init__.py @@ -858,11 +858,10 @@ def create(self, friendly_name: str) -> ServiceInstance: "FriendlyName": friendly_name, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload) @@ -881,11 +880,10 @@ async def create_async(self, friendly_name: str) -> ServiceInstance: "FriendlyName": friendly_name, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload) diff --git a/twilio/rest/chat/v2/service/channel/__init__.py b/twilio/rest/chat/v2/service/channel/__init__.py index 2b49faf266..b3796c30d8 100644 --- a/twilio/rest/chat/v2/service/channel/__init__.py +++ b/twilio/rest/chat/v2/service/channel/__init__.py @@ -622,6 +622,7 @@ def create( headers = values.of( { "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, + "Content-Type": "application/x-www-form-urlencoded", } ) @@ -675,6 +676,7 @@ async def create_async( headers = values.of( { "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, + "Content-Type": "application/x-www-form-urlencoded", } ) diff --git a/twilio/rest/chat/v2/service/channel/invite.py b/twilio/rest/chat/v2/service/channel/invite.py index 2c7333786d..d0ef32e345 100644 --- a/twilio/rest/chat/v2/service/channel/invite.py +++ b/twilio/rest/chat/v2/service/channel/invite.py @@ -296,11 +296,10 @@ def create( "RoleSid": role_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return InviteInstance( @@ -328,11 +327,10 @@ async def create_async( "RoleSid": role_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return InviteInstance( diff --git a/twilio/rest/chat/v2/service/channel/member.py b/twilio/rest/chat/v2/service/channel/member.py index c71d3e3457..95e737b82a 100644 --- a/twilio/rest/chat/v2/service/channel/member.py +++ b/twilio/rest/chat/v2/service/channel/member.py @@ -551,6 +551,7 @@ def create( headers = values.of( { "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, + "Content-Type": "application/x-www-form-urlencoded", } ) @@ -609,6 +610,7 @@ async def create_async( headers = values.of( { "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, + "Content-Type": "application/x-www-form-urlencoded", } ) diff --git a/twilio/rest/chat/v2/service/channel/message.py b/twilio/rest/chat/v2/service/channel/message.py index e98f526c74..1b2892176e 100644 --- a/twilio/rest/chat/v2/service/channel/message.py +++ b/twilio/rest/chat/v2/service/channel/message.py @@ -553,6 +553,7 @@ def create( headers = values.of( { "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, + "Content-Type": "application/x-www-form-urlencoded", } ) @@ -609,6 +610,7 @@ async def create_async( headers = values.of( { "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, + "Content-Type": "application/x-www-form-urlencoded", } ) diff --git a/twilio/rest/chat/v2/service/channel/webhook.py b/twilio/rest/chat/v2/service/channel/webhook.py index ca738bac4a..bc38198256 100644 --- a/twilio/rest/chat/v2/service/channel/webhook.py +++ b/twilio/rest/chat/v2/service/channel/webhook.py @@ -485,11 +485,10 @@ def create( "Configuration.RetryCount": configuration_retry_count, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return WebhookInstance( @@ -538,11 +537,10 @@ async def create_async( "Configuration.RetryCount": configuration_retry_count, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return WebhookInstance( diff --git a/twilio/rest/chat/v2/service/role.py b/twilio/rest/chat/v2/service/role.py index 5bb373c9a2..bcc0b6e5a9 100644 --- a/twilio/rest/chat/v2/service/role.py +++ b/twilio/rest/chat/v2/service/role.py @@ -361,11 +361,10 @@ def create( "Permission": serialize.map(permission, lambda e: e), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RoleInstance( @@ -392,11 +391,10 @@ async def create_async( "Permission": serialize.map(permission, lambda e: e), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RoleInstance( diff --git a/twilio/rest/chat/v2/service/user/__init__.py b/twilio/rest/chat/v2/service/user/__init__.py index 2c4ac5a3bd..768b78876e 100644 --- a/twilio/rest/chat/v2/service/user/__init__.py +++ b/twilio/rest/chat/v2/service/user/__init__.py @@ -491,6 +491,7 @@ def create( headers = values.of( { "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, + "Content-Type": "application/x-www-form-urlencoded", } ) @@ -535,6 +536,7 @@ async def create_async( headers = values.of( { "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, + "Content-Type": "application/x-www-form-urlencoded", } ) diff --git a/twilio/rest/content/v1/content/__init__.py b/twilio/rest/content/v1/content/__init__.py index 72e1e82141..8a1c4212d9 100644 --- a/twilio/rest/content/v1/content/__init__.py +++ b/twilio/rest/content/v1/content/__init__.py @@ -25,22 +25,6 @@ class ContentInstance(InstanceResource): - - class AuthenticationActionType(object): - COPY_CODE = "COPY_CODE" - - class CallToActionActionType(object): - URL = "URL" - PHONE_NUMBER = "PHONE_NUMBER" - - class CardActionType(object): - URL = "URL" - PHONE_NUMBER = "PHONE_NUMBER" - QUICK_REPLY = "QUICK_REPLY" - - class QuickReplyActionType(object): - QUICK_REPLY = "QUICK_REPLY" - """ :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. @@ -49,7 +33,7 @@ class QuickReplyActionType(object): :ivar friendly_name: A string name used to describe the Content resource. Not visible to the end recipient. :ivar language: Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in. :ivar variables: Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}. - :ivar types: The [Content types](https://www.twilio.com/docs/content-api/content-types-overview) (e.g. twilio/text) for this Content resource. + :ivar types: The [Content types](https://www.twilio.com/docs/content/content-types-overview) (e.g. twilio/text) for this Content resource. :ivar url: The URL of the resource, relative to `https://content.twilio.com`. :ivar links: A list of links related to the Content resource, such as approval_fetch and approval_create """ @@ -291,451 +275,6 @@ def __repr__(self) -> str: class ContentList(ListResource): - class AuthenticationAction(object): - """ - :ivar type: - :ivar copy_code_text: - """ - - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): - - self.type: Optional["ContentInstance.AuthenticationActionType"] = ( - payload.get("type") - ) - self.copy_code_text: Optional[str] = payload.get("copy_code_text") - - def to_dict(self): - return { - "type": self.type.to_dict(), - "copy_code_text": self.copy_code_text, - } - - class CallToActionAction(object): - """ - :ivar type: - :ivar title: - :ivar url: - :ivar phone: - :ivar id: - """ - - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): - - self.type: Optional["ContentInstance.CallToActionActionType"] = payload.get( - "type" - ) - self.title: Optional[str] = payload.get("title") - self.url: Optional[str] = payload.get("url") - self.phone: Optional[str] = payload.get("phone") - self.id: Optional[str] = payload.get("id") - - def to_dict(self): - return { - "type": self.type.to_dict(), - "title": self.title, - "url": self.url, - "phone": self.phone, - "id": self.id, - } - - class CardAction(object): - """ - :ivar type: - :ivar title: - :ivar url: - :ivar phone: - :ivar id: - """ - - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): - - self.type: Optional["ContentInstance.CardActionType"] = payload.get("type") - self.title: Optional[str] = payload.get("title") - self.url: Optional[str] = payload.get("url") - self.phone: Optional[str] = payload.get("phone") - self.id: Optional[str] = payload.get("id") - - def to_dict(self): - return { - "type": self.type.to_dict(), - "title": self.title, - "url": self.url, - "phone": self.phone, - "id": self.id, - } - - class CatalogItem(object): - """ - :ivar id: - :ivar section_title: - :ivar name: - :ivar media_url: - :ivar price: - :ivar description: - """ - - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): - - self.id: Optional[str] = payload.get("id") - self.section_title: Optional[str] = payload.get("section_title") - self.name: Optional[str] = payload.get("name") - self.media_url: Optional[str] = payload.get("media_url") - self.price: Optional[float] = payload.get("price") - self.description: Optional[str] = payload.get("description") - - def to_dict(self): - return { - "id": self.id, - "section_title": self.section_title, - "name": self.name, - "media_url": self.media_url, - "price": self.price, - "description": self.description, - } - - class ContentCreateRequest(object): - """ - :ivar friendly_name: User defined name of the content - :ivar variables: Key value pairs of variable name to value - :ivar language: Language code for the content - :ivar types: - """ - - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): - - self.friendly_name: Optional[str] = payload.get("friendly_name") - self.variables: Optional[dict[str, str]] = payload.get("variables") - self.language: Optional[str] = payload.get("language") - self.types: Optional[ContentList.Types] = payload.get("types") - - def to_dict(self): - return { - "friendly_name": self.friendly_name, - "variables": self.variables, - "language": self.language, - "types": self.types.to_dict(), - } - - class ListItem(object): - """ - :ivar id: - :ivar item: - :ivar description: - """ - - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): - - self.id: Optional[str] = payload.get("id") - self.item: Optional[str] = payload.get("item") - self.description: Optional[str] = payload.get("description") - - def to_dict(self): - return { - "id": self.id, - "item": self.item, - "description": self.description, - } - - class QuickReplyAction(object): - """ - :ivar type: - :ivar title: - :ivar id: - """ - - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): - - self.type: Optional["ContentInstance.QuickReplyActionType"] = payload.get( - "type" - ) - self.title: Optional[str] = payload.get("title") - self.id: Optional[str] = payload.get("id") - - def to_dict(self): - return { - "type": self.type.to_dict(), - "title": self.title, - "id": self.id, - } - - class TwilioCallToAction(object): - """ - :ivar body: - :ivar actions: - """ - - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): - - self.body: Optional[str] = payload.get("body") - self.actions: Optional[List[ContentList.CallToActionAction]] = payload.get( - "actions" - ) - - def to_dict(self): - return { - "body": self.body, - "actions": [actions.to_dict() for actions in self.actions], - } - - class TwilioCard(object): - """ - :ivar title: - :ivar subtitle: - :ivar media: - :ivar actions: - """ - - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): - - self.title: Optional[str] = payload.get("title") - self.subtitle: Optional[str] = payload.get("subtitle") - self.media: Optional[List[str]] = payload.get("media") - self.actions: Optional[List[ContentList.CardAction]] = payload.get( - "actions" - ) - - def to_dict(self): - return { - "title": self.title, - "subtitle": self.subtitle, - "media": self.media, - "actions": [actions.to_dict() for actions in self.actions], - } - - class TwilioCatalog(object): - """ - :ivar title: - :ivar body: - :ivar subtitle: - :ivar id: - :ivar items: - :ivar dynamic_items: - """ - - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): - - self.title: Optional[str] = payload.get("title") - self.body: Optional[str] = payload.get("body") - self.subtitle: Optional[str] = payload.get("subtitle") - self.id: Optional[str] = payload.get("id") - self.items: Optional[List[ContentList.CatalogItem]] = payload.get("items") - self.dynamic_items: Optional[str] = payload.get("dynamic_items") - - def to_dict(self): - return { - "title": self.title, - "body": self.body, - "subtitle": self.subtitle, - "id": self.id, - "items": [items.to_dict() for items in self.items], - "dynamic_items": self.dynamic_items, - } - - class TwilioListPicker(object): - """ - :ivar body: - :ivar button: - :ivar items: - """ - - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): - - self.body: Optional[str] = payload.get("body") - self.button: Optional[str] = payload.get("button") - self.items: Optional[List[ContentList.ListItem]] = payload.get("items") - - def to_dict(self): - return { - "body": self.body, - "button": self.button, - "items": [items.to_dict() for items in self.items], - } - - class TwilioLocation(object): - """ - :ivar latitude: - :ivar longitude: - :ivar label: - """ - - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): - - self.latitude: Optional[float] = payload.get("latitude") - self.longitude: Optional[float] = payload.get("longitude") - self.label: Optional[str] = payload.get("label") - - def to_dict(self): - return { - "latitude": self.latitude, - "longitude": self.longitude, - "label": self.label, - } - - class TwilioMedia(object): - """ - :ivar body: - :ivar media: - """ - - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): - - self.body: Optional[str] = payload.get("body") - self.media: Optional[List[str]] = payload.get("media") - - def to_dict(self): - return { - "body": self.body, - "media": self.media, - } - - class TwilioQuickReply(object): - """ - :ivar body: - :ivar actions: - """ - - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): - - self.body: Optional[str] = payload.get("body") - self.actions: Optional[List[ContentList.QuickReplyAction]] = payload.get( - "actions" - ) - - def to_dict(self): - return { - "body": self.body, - "actions": [actions.to_dict() for actions in self.actions], - } - - class TwilioText(object): - """ - :ivar body: - """ - - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): - - self.body: Optional[str] = payload.get("body") - - def to_dict(self): - return { - "body": self.body, - } - - class Types(object): - """ - :ivar twilio_text: - :ivar twilio_media: - :ivar twilio_location: - :ivar twilio_list_picker: - :ivar twilio_call_to_action: - :ivar twilio_quick_reply: - :ivar twilio_card: - :ivar twilio_catalog: - :ivar whatsapp_card: - :ivar whatsapp_authentication: - """ - - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): - - self.twilio_text: Optional[ContentList.TwilioText] = payload.get( - "twilio_text" - ) - self.twilio_media: Optional[ContentList.TwilioMedia] = payload.get( - "twilio_media" - ) - self.twilio_location: Optional[ContentList.TwilioLocation] = payload.get( - "twilio_location" - ) - self.twilio_list_picker: Optional[ContentList.TwilioListPicker] = ( - payload.get("twilio_list_picker") - ) - self.twilio_call_to_action: Optional[ContentList.TwilioCallToAction] = ( - payload.get("twilio_call_to_action") - ) - self.twilio_quick_reply: Optional[ContentList.TwilioQuickReply] = ( - payload.get("twilio_quick_reply") - ) - self.twilio_card: Optional[ContentList.TwilioCard] = payload.get( - "twilio_card" - ) - self.twilio_catalog: Optional[ContentList.TwilioCatalog] = payload.get( - "twilio_catalog" - ) - self.whatsapp_card: Optional[ContentList.WhatsappCard] = payload.get( - "whatsapp_card" - ) - self.whatsapp_authentication: Optional[ - ContentList.WhatsappAuthentication - ] = payload.get("whatsapp_authentication") - - def to_dict(self): - return { - "twilio_text": self.twilio_text.to_dict(), - "twilio_media": self.twilio_media.to_dict(), - "twilio_location": self.twilio_location.to_dict(), - "twilio_list_picker": self.twilio_list_picker.to_dict(), - "twilio_call_to_action": self.twilio_call_to_action.to_dict(), - "twilio_quick_reply": self.twilio_quick_reply.to_dict(), - "twilio_card": self.twilio_card.to_dict(), - "twilio_catalog": self.twilio_catalog.to_dict(), - "whatsapp_card": self.whatsapp_card.to_dict(), - "whatsapp_authentication": self.whatsapp_authentication.to_dict(), - } - - class WhatsappAuthentication(object): - """ - :ivar add_security_recommendation: - :ivar code_expiration_minutes: - :ivar actions: - """ - - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): - - self.add_security_recommendation: Optional[bool] = payload.get( - "add_security_recommendation" - ) - self.code_expiration_minutes: Optional[float] = payload.get( - "code_expiration_minutes" - ) - self.actions: Optional[List[ContentList.AuthenticationAction]] = ( - payload.get("actions") - ) - - def to_dict(self): - return { - "add_security_recommendation": self.add_security_recommendation, - "code_expiration_minutes": self.code_expiration_minutes, - "actions": [actions.to_dict() for actions in self.actions], - } - - class WhatsappCard(object): - """ - :ivar body: - :ivar footer: - :ivar media: - :ivar header_text: - :ivar actions: - """ - - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): - - self.body: Optional[str] = payload.get("body") - self.footer: Optional[str] = payload.get("footer") - self.media: Optional[List[str]] = payload.get("media") - self.header_text: Optional[str] = payload.get("header_text") - self.actions: Optional[List[ContentList.CardAction]] = payload.get( - "actions" - ) - - def to_dict(self): - return { - "body": self.body, - "footer": self.footer, - "media": self.media, - "header_text": self.header_text, - "actions": [actions.to_dict() for actions in self.actions], - } - def __init__(self, version: Version): """ Initialize the ContentList @@ -747,17 +286,18 @@ def __init__(self, version: Version): self._uri = "/Content" - def create(self, content_create_request: ContentCreateRequest) -> ContentInstance: + def create(self, body: Union[object, object] = values.unset) -> ContentInstance: """ Create the ContentInstance - :param content_create_request: + :param body: :returns: The created ContentInstance """ - data = content_create_request.to_dict() + data = body.to_dict() - headers = {"Content-Type": "application/json"} + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers @@ -766,18 +306,19 @@ def create(self, content_create_request: ContentCreateRequest) -> ContentInstanc return ContentInstance(self._version, payload) async def create_async( - self, content_create_request: ContentCreateRequest + self, body: Union[object, object] = values.unset ) -> ContentInstance: """ Asynchronously create the ContentInstance - :param content_create_request: + :param body: :returns: The created ContentInstance """ - data = content_create_request.to_dict() + data = body.to_dict() - headers = {"Content-Type": "application/json"} + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers diff --git a/twilio/rest/content/v1/content/approval_create.py b/twilio/rest/content/v1/content/approval_create.py index ddd922afc2..137c0a6d0c 100644 --- a/twilio/rest/content/v1/content/approval_create.py +++ b/twilio/rest/content/v1/content/approval_create.py @@ -12,7 +12,8 @@ Do not edit the class manually. """ -from typing import Any, Dict, Optional +from typing import Any, Dict, Optional, Union +from twilio.base import values from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -29,7 +30,7 @@ class ApprovalCreateInstance(InstanceResource): :ivar allow_category_change: """ - def __init__(self, version: Version, payload: Dict[str, Any], content_sid: str): + def __init__(self, version: Version, payload: Dict[str, Any], sid: str): super().__init__(version) self.name: Optional[str] = payload.get("name") @@ -42,7 +43,7 @@ def __init__(self, version: Version, payload: Dict[str, Any], content_sid: str): ) self._solution = { - "content_sid": content_sid, + "sid": sid, } def __repr__(self) -> str: @@ -57,84 +58,63 @@ def __repr__(self) -> str: 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], content_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, content_sid: str): + def __init__(self, version: Version, sid: str): """ Initialize the ApprovalCreateList :param version: Version that contains the resource - :param content_sid: + :param sid: """ super().__init__(version) # Path Solution self._solution = { - "content_sid": content_sid, + "sid": sid, } - self._uri = "/Content/{content_sid}/ApprovalRequests/whatsapp".format( - **self._solution - ) + self._uri = "/Content/{sid}/ApprovalRequests/whatsapp".format(**self._solution) def create( - self, content_approval_request: ContentApprovalRequest + self, body: Union[object, object] = values.unset ) -> ApprovalCreateInstance: """ Create the ApprovalCreateInstance - :param content_approval_request: + :param body: :returns: The created ApprovalCreateInstance """ - data = content_approval_request.to_dict() + data = body.to_dict() - headers = {"Content-Type": "application/json"} + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) - return ApprovalCreateInstance( - self._version, payload, content_sid=self._solution["content_sid"] - ) + return ApprovalCreateInstance(self._version, payload, sid=self._solution["sid"]) async def create_async( - self, content_approval_request: ContentApprovalRequest + self, body: Union[object, object] = values.unset ) -> ApprovalCreateInstance: """ Asynchronously create the ApprovalCreateInstance - :param content_approval_request: + :param body: :returns: The created ApprovalCreateInstance """ - data = content_approval_request.to_dict() + data = body.to_dict() - headers = {"Content-Type": "application/json"} + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + 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, content_sid=self._solution["content_sid"] - ) + return ApprovalCreateInstance(self._version, payload, sid=self._solution["sid"]) def __repr__(self) -> str: """ diff --git a/twilio/rest/content/v1/content/approval_fetch.py b/twilio/rest/content/v1/content/approval_fetch.py index f679a920a1..f35ef6a48f 100644 --- a/twilio/rest/content/v1/content/approval_fetch.py +++ b/twilio/rest/content/v1/content/approval_fetch.py @@ -27,7 +27,7 @@ class ApprovalFetchInstance(InstanceResource): :ivar url: The URL of the resource, relative to `https://content.twilio.com`. """ - def __init__(self, version: Version, payload: Dict[str, Any], content_sid: str): + def __init__(self, version: Version, payload: Dict[str, Any], sid: str): super().__init__(version) self.sid: Optional[str] = payload.get("sid") @@ -36,7 +36,7 @@ def __init__(self, version: Version, payload: Dict[str, Any], content_sid: str): self.url: Optional[str] = payload.get("url") self._solution = { - "content_sid": content_sid, + "sid": sid, } self._context: Optional[ApprovalFetchContext] = None @@ -51,7 +51,7 @@ def _proxy(self) -> "ApprovalFetchContext": if self._context is None: self._context = ApprovalFetchContext( self._version, - content_sid=self._solution["content_sid"], + sid=self._solution["sid"], ) return self._context @@ -85,20 +85,20 @@ def __repr__(self) -> str: class ApprovalFetchContext(InstanceContext): - def __init__(self, version: Version, content_sid: str): + def __init__(self, version: Version, sid: str): """ Initialize the ApprovalFetchContext :param version: Version that contains the resource - :param content_sid: The Twilio-provided string that uniquely identifies the Content resource whose approval information to fetch. + :param sid: The Twilio-provided string that uniquely identifies the Content resource whose approval information to fetch. """ super().__init__(version) # Path Solution self._solution = { - "content_sid": content_sid, + "sid": sid, } - self._uri = "/Content/{content_sid}/ApprovalRequests".format(**self._solution) + self._uri = "/Content/{sid}/ApprovalRequests".format(**self._solution) def fetch(self) -> ApprovalFetchInstance: """ @@ -116,7 +116,7 @@ def fetch(self) -> ApprovalFetchInstance: return ApprovalFetchInstance( self._version, payload, - content_sid=self._solution["content_sid"], + sid=self._solution["sid"], ) async def fetch_async(self) -> ApprovalFetchInstance: @@ -135,7 +135,7 @@ async def fetch_async(self) -> ApprovalFetchInstance: return ApprovalFetchInstance( self._version, payload, - content_sid=self._solution["content_sid"], + sid=self._solution["sid"], ) def __repr__(self) -> str: @@ -150,19 +150,19 @@ def __repr__(self) -> str: class ApprovalFetchList(ListResource): - def __init__(self, version: Version, content_sid: str): + def __init__(self, version: Version, sid: str): """ Initialize the ApprovalFetchList :param version: Version that contains the resource - :param content_sid: The Twilio-provided string that uniquely identifies the Content resource whose approval information to fetch. + :param sid: The Twilio-provided string that uniquely identifies the Content resource whose approval information to fetch. """ super().__init__(version) # Path Solution self._solution = { - "content_sid": content_sid, + "sid": sid, } def get(self) -> ApprovalFetchContext: @@ -170,18 +170,14 @@ def get(self) -> ApprovalFetchContext: Constructs a ApprovalFetchContext """ - return ApprovalFetchContext( - self._version, content_sid=self._solution["content_sid"] - ) + return ApprovalFetchContext(self._version, sid=self._solution["sid"]) def __call__(self) -> ApprovalFetchContext: """ Constructs a ApprovalFetchContext """ - return ApprovalFetchContext( - self._version, content_sid=self._solution["content_sid"] - ) + return ApprovalFetchContext(self._version, sid=self._solution["sid"]) def __repr__(self) -> str: """ diff --git a/twilio/rest/content/v1/content_and_approvals.py b/twilio/rest/content/v1/content_and_approvals.py index de40cfc172..e2d6d72aaf 100644 --- a/twilio/rest/content/v1/content_and_approvals.py +++ b/twilio/rest/content/v1/content_and_approvals.py @@ -31,7 +31,7 @@ class ContentAndApprovalsInstance(InstanceResource): :ivar friendly_name: A string name used to describe the Content resource. Not visible to the end recipient. :ivar language: Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in. :ivar variables: Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}. - :ivar types: The [Content types](https://www.twilio.com/docs/content-api/content-types-overview) (e.g. twilio/text) for this Content resource. + :ivar types: The [Content types](https://www.twilio.com/docs/content/content-types-overview) (e.g. twilio/text) for this Content resource. :ivar approval_requests: The submitted information and approval request status of the Content resource. """ diff --git a/twilio/rest/conversations/v1/address_configuration.py b/twilio/rest/conversations/v1/address_configuration.py index 86cdb08066..58bd74be49 100644 --- a/twilio/rest/conversations/v1/address_configuration.py +++ b/twilio/rest/conversations/v1/address_configuration.py @@ -526,11 +526,10 @@ def create( "AddressCountry": address_country, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AddressConfigurationInstance(self._version, payload) @@ -593,11 +592,10 @@ async def create_async( "AddressCountry": address_country, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AddressConfigurationInstance(self._version, payload) diff --git a/twilio/rest/conversations/v1/conversation/__init__.py b/twilio/rest/conversations/v1/conversation/__init__.py index 4c9b8809ac..4eb14b769c 100644 --- a/twilio/rest/conversations/v1/conversation/__init__.py +++ b/twilio/rest/conversations/v1/conversation/__init__.py @@ -639,6 +639,7 @@ def create( headers = values.of( { "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, + "Content-Type": "application/x-www-form-urlencoded", } ) @@ -702,6 +703,7 @@ async def create_async( headers = values.of( { "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, + "Content-Type": "application/x-www-form-urlencoded", } ) diff --git a/twilio/rest/conversations/v1/conversation/message/__init__.py b/twilio/rest/conversations/v1/conversation/message/__init__.py index e3e9dea1b2..8488bee004 100644 --- a/twilio/rest/conversations/v1/conversation/message/__init__.py +++ b/twilio/rest/conversations/v1/conversation/message/__init__.py @@ -566,6 +566,7 @@ def create( headers = values.of( { "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, + "Content-Type": "application/x-www-form-urlencoded", } ) @@ -625,6 +626,7 @@ async def create_async( headers = values.of( { "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, + "Content-Type": "application/x-www-form-urlencoded", } ) diff --git a/twilio/rest/conversations/v1/conversation/participant.py b/twilio/rest/conversations/v1/conversation/participant.py index 499bdbf30a..92f8e5de40 100644 --- a/twilio/rest/conversations/v1/conversation/participant.py +++ b/twilio/rest/conversations/v1/conversation/participant.py @@ -568,6 +568,7 @@ def create( headers = values.of( { "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, + "Content-Type": "application/x-www-form-urlencoded", } ) @@ -624,6 +625,7 @@ async def create_async( headers = values.of( { "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, + "Content-Type": "application/x-www-form-urlencoded", } ) diff --git a/twilio/rest/conversations/v1/conversation/webhook.py b/twilio/rest/conversations/v1/conversation/webhook.py index 623887986c..b961b832a5 100644 --- a/twilio/rest/conversations/v1/conversation/webhook.py +++ b/twilio/rest/conversations/v1/conversation/webhook.py @@ -455,11 +455,10 @@ def create( "Configuration.ReplayAfter": configuration_replay_after, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return WebhookInstance( @@ -505,11 +504,10 @@ async def create_async( "Configuration.ReplayAfter": configuration_replay_after, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return WebhookInstance( diff --git a/twilio/rest/conversations/v1/credential.py b/twilio/rest/conversations/v1/credential.py index 120710f7e8..c8cd78ab05 100644 --- a/twilio/rest/conversations/v1/credential.py +++ b/twilio/rest/conversations/v1/credential.py @@ -432,11 +432,10 @@ def create( "Secret": secret, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CredentialInstance(self._version, payload) @@ -476,11 +475,10 @@ async def create_async( "Secret": secret, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CredentialInstance(self._version, payload) diff --git a/twilio/rest/conversations/v1/role.py b/twilio/rest/conversations/v1/role.py index b5d4d2c6db..301063800a 100644 --- a/twilio/rest/conversations/v1/role.py +++ b/twilio/rest/conversations/v1/role.py @@ -334,11 +334,10 @@ def create( "Permission": serialize.map(permission, lambda e: e), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RoleInstance(self._version, payload) @@ -363,11 +362,10 @@ async def create_async( "Permission": serialize.map(permission, lambda e: e), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RoleInstance(self._version, payload) diff --git a/twilio/rest/conversations/v1/service/__init__.py b/twilio/rest/conversations/v1/service/__init__.py index 2a9f12090b..a06afa2f77 100644 --- a/twilio/rest/conversations/v1/service/__init__.py +++ b/twilio/rest/conversations/v1/service/__init__.py @@ -380,11 +380,10 @@ def create(self, friendly_name: str) -> ServiceInstance: "FriendlyName": friendly_name, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload) @@ -403,11 +402,10 @@ async def create_async(self, friendly_name: str) -> ServiceInstance: "FriendlyName": friendly_name, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload) diff --git a/twilio/rest/conversations/v1/service/conversation/__init__.py b/twilio/rest/conversations/v1/service/conversation/__init__.py index 69e87e5eef..139bdcb5ca 100644 --- a/twilio/rest/conversations/v1/service/conversation/__init__.py +++ b/twilio/rest/conversations/v1/service/conversation/__init__.py @@ -675,6 +675,7 @@ def create( headers = values.of( { "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, + "Content-Type": "application/x-www-form-urlencoded", } ) @@ -740,6 +741,7 @@ async def create_async( headers = values.of( { "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, + "Content-Type": "application/x-www-form-urlencoded", } ) diff --git a/twilio/rest/conversations/v1/service/conversation/message/__init__.py b/twilio/rest/conversations/v1/service/conversation/message/__init__.py index 753df18352..32f480bc59 100644 --- a/twilio/rest/conversations/v1/service/conversation/message/__init__.py +++ b/twilio/rest/conversations/v1/service/conversation/message/__init__.py @@ -585,6 +585,7 @@ def create( headers = values.of( { "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, + "Content-Type": "application/x-www-form-urlencoded", } ) @@ -647,6 +648,7 @@ async def create_async( headers = values.of( { "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, + "Content-Type": "application/x-www-form-urlencoded", } ) diff --git a/twilio/rest/conversations/v1/service/conversation/participant.py b/twilio/rest/conversations/v1/service/conversation/participant.py index 6f6eee61e7..530bce26fc 100644 --- a/twilio/rest/conversations/v1/service/conversation/participant.py +++ b/twilio/rest/conversations/v1/service/conversation/participant.py @@ -586,6 +586,7 @@ def create( headers = values.of( { "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, + "Content-Type": "application/x-www-form-urlencoded", } ) @@ -645,6 +646,7 @@ async def create_async( headers = values.of( { "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, + "Content-Type": "application/x-www-form-urlencoded", } ) diff --git a/twilio/rest/conversations/v1/service/conversation/webhook.py b/twilio/rest/conversations/v1/service/conversation/webhook.py index 83b267406e..327dc9f024 100644 --- a/twilio/rest/conversations/v1/service/conversation/webhook.py +++ b/twilio/rest/conversations/v1/service/conversation/webhook.py @@ -473,11 +473,10 @@ def create( "Configuration.ReplayAfter": configuration_replay_after, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return WebhookInstance( @@ -526,11 +525,10 @@ async def create_async( "Configuration.ReplayAfter": configuration_replay_after, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return WebhookInstance( diff --git a/twilio/rest/conversations/v1/service/role.py b/twilio/rest/conversations/v1/service/role.py index 3c0a0fc909..170512a2b2 100644 --- a/twilio/rest/conversations/v1/service/role.py +++ b/twilio/rest/conversations/v1/service/role.py @@ -361,11 +361,10 @@ def create( "Permission": serialize.map(permission, lambda e: e), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RoleInstance( @@ -392,11 +391,10 @@ async def create_async( "Permission": serialize.map(permission, lambda e: e), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RoleInstance( diff --git a/twilio/rest/conversations/v1/service/user/__init__.py b/twilio/rest/conversations/v1/service/user/__init__.py index 37a8d2e4fb..4d4df0398d 100644 --- a/twilio/rest/conversations/v1/service/user/__init__.py +++ b/twilio/rest/conversations/v1/service/user/__init__.py @@ -503,6 +503,7 @@ def create( headers = values.of( { "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, + "Content-Type": "application/x-www-form-urlencoded", } ) @@ -547,6 +548,7 @@ async def create_async( headers = values.of( { "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, + "Content-Type": "application/x-www-form-urlencoded", } ) diff --git a/twilio/rest/conversations/v1/user/__init__.py b/twilio/rest/conversations/v1/user/__init__.py index d8017c5102..a05deeda43 100644 --- a/twilio/rest/conversations/v1/user/__init__.py +++ b/twilio/rest/conversations/v1/user/__init__.py @@ -473,6 +473,7 @@ def create( headers = values.of( { "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, + "Content-Type": "application/x-www-form-urlencoded", } ) @@ -515,6 +516,7 @@ async def create_async( headers = values.of( { "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, + "Content-Type": "application/x-www-form-urlencoded", } ) diff --git a/twilio/rest/events/v1/event_type.py b/twilio/rest/events/v1/event_type.py index 7215df8f24..a019a82a9e 100644 --- a/twilio/rest/events/v1/event_type.py +++ b/twilio/rest/events/v1/event_type.py @@ -29,6 +29,8 @@ class EventTypeInstance(InstanceResource): :ivar date_created: The date that this Event Type was created, given in ISO 8601 format. :ivar date_updated: The date that this Event Type was updated, given in ISO 8601 format. :ivar description: A human readable description for this Event Type. + :ivar status: A string that describes how this Event Type can be used. For example: `available`, `deprecated`, `restricted`, `discontinued`. When the status is `available`, the Event Type can be used normally. + :ivar documentation_url: The URL to the documentation or to the most relevant Twilio Changelog entry of this Event Type. :ivar url: The URL of this resource. :ivar links: """ @@ -47,6 +49,8 @@ def __init__( payload.get("date_updated") ) self.description: Optional[str] = payload.get("description") + self.status: Optional[str] = payload.get("status") + self.documentation_url: Optional[str] = payload.get("documentation_url") self.url: Optional[str] = payload.get("url") self.links: Optional[Dict[str, object]] = payload.get("links") diff --git a/twilio/rest/events/v1/sink/__init__.py b/twilio/rest/events/v1/sink/__init__.py index b09b5edec3..9098c51bd7 100644 --- a/twilio/rest/events/v1/sink/__init__.py +++ b/twilio/rest/events/v1/sink/__init__.py @@ -389,11 +389,10 @@ def create( "SinkType": sink_type, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SinkInstance(self._version, payload) @@ -421,11 +420,10 @@ async def create_async( "SinkType": sink_type, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SinkInstance(self._version, payload) diff --git a/twilio/rest/events/v1/sink/sink_test.py b/twilio/rest/events/v1/sink/sink_test.py index adf04f582d..150e7deabc 100644 --- a/twilio/rest/events/v1/sink/sink_test.py +++ b/twilio/rest/events/v1/sink/sink_test.py @@ -13,6 +13,7 @@ """ from typing import Any, Dict, Optional +from twilio.base import values from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -69,10 +70,9 @@ def create(self) -> SinkTestInstance: :returns: The created SinkTestInstance """ - payload = self._version.create( - method="POST", - uri=self._uri, - ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + payload = self._version.create(method="POST", uri=self._uri, headers=headers) return SinkTestInstance(self._version, payload, sid=self._solution["sid"]) @@ -84,9 +84,10 @@ async def create_async(self) -> SinkTestInstance: :returns: The created SinkTestInstance """ + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + payload = await self._version.create_async( - method="POST", - uri=self._uri, + method="POST", uri=self._uri, headers=headers ) return SinkTestInstance(self._version, payload, sid=self._solution["sid"]) diff --git a/twilio/rest/events/v1/sink/sink_validate.py b/twilio/rest/events/v1/sink/sink_validate.py index 4c24dd76b3..8c6565a007 100644 --- a/twilio/rest/events/v1/sink/sink_validate.py +++ b/twilio/rest/events/v1/sink/sink_validate.py @@ -76,11 +76,10 @@ def create(self, test_id: str) -> SinkValidateInstance: "TestId": test_id, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SinkValidateInstance(self._version, payload, sid=self._solution["sid"]) @@ -99,11 +98,10 @@ async def create_async(self, test_id: str) -> SinkValidateInstance: "TestId": test_id, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SinkValidateInstance(self._version, payload, sid=self._solution["sid"]) diff --git a/twilio/rest/events/v1/subscription/__init__.py b/twilio/rest/events/v1/subscription/__init__.py index 666b26aa70..2f6d7e91a2 100644 --- a/twilio/rest/events/v1/subscription/__init__.py +++ b/twilio/rest/events/v1/subscription/__init__.py @@ -373,11 +373,10 @@ def create( "Types": serialize.map(types, lambda e: serialize.object(e)), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SubscriptionInstance(self._version, payload) @@ -402,11 +401,10 @@ async def create_async( "Types": serialize.map(types, lambda e: serialize.object(e)), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SubscriptionInstance(self._version, payload) diff --git a/twilio/rest/events/v1/subscription/subscribed_event.py b/twilio/rest/events/v1/subscription/subscribed_event.py index 80c9ce1494..8547fd486b 100644 --- a/twilio/rest/events/v1/subscription/subscribed_event.py +++ b/twilio/rest/events/v1/subscription/subscribed_event.py @@ -355,11 +355,10 @@ def create( "SchemaVersion": schema_version, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SubscribedEventInstance( @@ -384,11 +383,10 @@ async def create_async( "SchemaVersion": schema_version, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SubscribedEventInstance( diff --git a/twilio/rest/flex_api/v1/assessments.py b/twilio/rest/flex_api/v1/assessments.py index 23648b1041..b24d9113d4 100644 --- a/twilio/rest/flex_api/v1/assessments.py +++ b/twilio/rest/flex_api/v1/assessments.py @@ -326,6 +326,7 @@ def create( headers = values.of( { "Authorization": authorization, + "Content-Type": "application/x-www-form-urlencoded", } ) @@ -384,6 +385,7 @@ async def create_async( headers = values.of( { "Authorization": authorization, + "Content-Type": "application/x-www-form-urlencoded", } ) diff --git a/twilio/rest/flex_api/v1/channel.py b/twilio/rest/flex_api/v1/channel.py index f362d5b01b..bf4feb99e1 100644 --- a/twilio/rest/flex_api/v1/channel.py +++ b/twilio/rest/flex_api/v1/channel.py @@ -283,11 +283,10 @@ def create( "LongLived": serialize.boolean_to_string(long_lived), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ChannelInstance(self._version, payload) @@ -336,11 +335,10 @@ async def create_async( "LongLived": serialize.boolean_to_string(long_lived), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ChannelInstance(self._version, payload) diff --git a/twilio/rest/flex_api/v1/flex_flow.py b/twilio/rest/flex_api/v1/flex_flow.py index b11482937e..531dd470b2 100644 --- a/twilio/rest/flex_api/v1/flex_flow.py +++ b/twilio/rest/flex_api/v1/flex_flow.py @@ -622,11 +622,10 @@ def create( "Integration.RetryCount": integration_retry_count, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return FlexFlowInstance(self._version, payload) @@ -700,11 +699,10 @@ async def create_async( "Integration.RetryCount": integration_retry_count, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return FlexFlowInstance(self._version, payload) diff --git a/twilio/rest/flex_api/v1/insights_assessments_comment.py b/twilio/rest/flex_api/v1/insights_assessments_comment.py index eed32fefbc..faeb6ae62c 100644 --- a/twilio/rest/flex_api/v1/insights_assessments_comment.py +++ b/twilio/rest/flex_api/v1/insights_assessments_comment.py @@ -134,6 +134,7 @@ def create( headers = values.of( { "Authorization": authorization, + "Content-Type": "application/x-www-form-urlencoded", } ) @@ -180,6 +181,7 @@ async def create_async( headers = values.of( { "Authorization": authorization, + "Content-Type": "application/x-www-form-urlencoded", } ) diff --git a/twilio/rest/flex_api/v1/insights_questionnaires.py b/twilio/rest/flex_api/v1/insights_questionnaires.py index 807f129955..1724e2a253 100644 --- a/twilio/rest/flex_api/v1/insights_questionnaires.py +++ b/twilio/rest/flex_api/v1/insights_questionnaires.py @@ -454,6 +454,7 @@ def create( headers = values.of( { "Authorization": authorization, + "Content-Type": "application/x-www-form-urlencoded", } ) @@ -494,6 +495,7 @@ async def create_async( headers = values.of( { "Authorization": authorization, + "Content-Type": "application/x-www-form-urlencoded", } ) diff --git a/twilio/rest/flex_api/v1/insights_questionnaires_category.py b/twilio/rest/flex_api/v1/insights_questionnaires_category.py index 28057dbc00..aba8eb8bdd 100644 --- a/twilio/rest/flex_api/v1/insights_questionnaires_category.py +++ b/twilio/rest/flex_api/v1/insights_questionnaires_category.py @@ -313,6 +313,7 @@ def create( headers = values.of( { "Authorization": authorization, + "Content-Type": "application/x-www-form-urlencoded", } ) @@ -342,6 +343,7 @@ async def create_async( headers = values.of( { "Authorization": authorization, + "Content-Type": "application/x-www-form-urlencoded", } ) diff --git a/twilio/rest/flex_api/v1/insights_questionnaires_question.py b/twilio/rest/flex_api/v1/insights_questionnaires_question.py index e4f2f4a4f0..363d5c07b1 100644 --- a/twilio/rest/flex_api/v1/insights_questionnaires_question.py +++ b/twilio/rest/flex_api/v1/insights_questionnaires_question.py @@ -395,6 +395,7 @@ def create( headers = values.of( { "Authorization": authorization, + "Content-Type": "application/x-www-form-urlencoded", } ) @@ -438,6 +439,7 @@ async def create_async( headers = values.of( { "Authorization": authorization, + "Content-Type": "application/x-www-form-urlencoded", } ) diff --git a/twilio/rest/flex_api/v1/insights_settings_answer_sets.py b/twilio/rest/flex_api/v1/insights_settings_answer_sets.py index 767737da67..d426e215a9 100644 --- a/twilio/rest/flex_api/v1/insights_settings_answer_sets.py +++ b/twilio/rest/flex_api/v1/insights_settings_answer_sets.py @@ -75,6 +75,7 @@ def fetch( headers = values.of( { "Authorization": authorization, + "Content-Type": "application/x-www-form-urlencoded", } ) @@ -94,6 +95,7 @@ async def fetch_async( headers = values.of( { "Authorization": authorization, + "Content-Type": "application/x-www-form-urlencoded", } ) diff --git a/twilio/rest/flex_api/v1/insights_settings_comment.py b/twilio/rest/flex_api/v1/insights_settings_comment.py index 5d41e8d3b3..548b279181 100644 --- a/twilio/rest/flex_api/v1/insights_settings_comment.py +++ b/twilio/rest/flex_api/v1/insights_settings_comment.py @@ -69,6 +69,7 @@ def fetch( headers = values.of( { "Authorization": authorization, + "Content-Type": "application/x-www-form-urlencoded", } ) @@ -88,6 +89,7 @@ async def fetch_async( headers = values.of( { "Authorization": authorization, + "Content-Type": "application/x-www-form-urlencoded", } ) diff --git a/twilio/rest/flex_api/v1/interaction/__init__.py b/twilio/rest/flex_api/v1/interaction/__init__.py index 069b05309f..468b3134eb 100644 --- a/twilio/rest/flex_api/v1/interaction/__init__.py +++ b/twilio/rest/flex_api/v1/interaction/__init__.py @@ -218,11 +218,10 @@ def create( "InteractionContextSid": interaction_context_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return InteractionInstance(self._version, payload) @@ -250,11 +249,10 @@ async def create_async( "InteractionContextSid": interaction_context_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return InteractionInstance(self._version, payload) diff --git a/twilio/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_invite.py b/twilio/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_invite.py index 5292297b98..2ffa14b1df 100644 --- a/twilio/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_invite.py +++ b/twilio/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_invite.py @@ -122,11 +122,10 @@ def create(self, routing: object) -> InteractionChannelInviteInstance: "Routing": serialize.object(routing), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return InteractionChannelInviteInstance( @@ -150,11 +149,10 @@ async def create_async(self, routing: object) -> InteractionChannelInviteInstanc "Routing": serialize.object(routing), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return InteractionChannelInviteInstance( diff --git a/twilio/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_participant.py b/twilio/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_participant.py index ba9f80f9a3..225ca3efaf 100644 --- a/twilio/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_participant.py +++ b/twilio/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_participant.py @@ -296,11 +296,10 @@ def create( "RoutingProperties": serialize.object(routing_properties), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return InteractionChannelParticipantInstance( @@ -333,11 +332,10 @@ async def create_async( "RoutingProperties": serialize.object(routing_properties), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return InteractionChannelParticipantInstance( diff --git a/twilio/rest/flex_api/v1/plugin/__init__.py b/twilio/rest/flex_api/v1/plugin/__init__.py index 09244d42de..b6baf8f935 100644 --- a/twilio/rest/flex_api/v1/plugin/__init__.py +++ b/twilio/rest/flex_api/v1/plugin/__init__.py @@ -381,6 +381,7 @@ def create( headers = values.of( { "Flex-Metadata": flex_metadata, + "Content-Type": "application/x-www-form-urlencoded", } ) @@ -418,6 +419,7 @@ async def create_async( headers = values.of( { "Flex-Metadata": flex_metadata, + "Content-Type": "application/x-www-form-urlencoded", } ) diff --git a/twilio/rest/flex_api/v1/plugin/plugin_versions.py b/twilio/rest/flex_api/v1/plugin/plugin_versions.py index 1e5b5683b6..3da4de3ac7 100644 --- a/twilio/rest/flex_api/v1/plugin/plugin_versions.py +++ b/twilio/rest/flex_api/v1/plugin/plugin_versions.py @@ -283,6 +283,7 @@ def create( headers = values.of( { "Flex-Metadata": flex_metadata, + "Content-Type": "application/x-www-form-urlencoded", } ) @@ -331,6 +332,7 @@ async def create_async( headers = values.of( { "Flex-Metadata": flex_metadata, + "Content-Type": "application/x-www-form-urlencoded", } ) diff --git a/twilio/rest/flex_api/v1/plugin_configuration/__init__.py b/twilio/rest/flex_api/v1/plugin_configuration/__init__.py index ebe173985b..9b76695243 100644 --- a/twilio/rest/flex_api/v1/plugin_configuration/__init__.py +++ b/twilio/rest/flex_api/v1/plugin_configuration/__init__.py @@ -271,6 +271,7 @@ def create( headers = values.of( { "Flex-Metadata": flex_metadata, + "Content-Type": "application/x-www-form-urlencoded", } ) @@ -308,6 +309,7 @@ async def create_async( headers = values.of( { "Flex-Metadata": flex_metadata, + "Content-Type": "application/x-www-form-urlencoded", } ) diff --git a/twilio/rest/flex_api/v1/plugin_release.py b/twilio/rest/flex_api/v1/plugin_release.py index f2e8efd306..e339183297 100644 --- a/twilio/rest/flex_api/v1/plugin_release.py +++ b/twilio/rest/flex_api/v1/plugin_release.py @@ -233,6 +233,7 @@ def create( headers = values.of( { "Flex-Metadata": flex_metadata, + "Content-Type": "application/x-www-form-urlencoded", } ) @@ -262,6 +263,7 @@ async def create_async( headers = values.of( { "Flex-Metadata": flex_metadata, + "Content-Type": "application/x-www-form-urlencoded", } ) diff --git a/twilio/rest/flex_api/v1/web_channel.py b/twilio/rest/flex_api/v1/web_channel.py index ddf9c8f902..a96698f8cb 100644 --- a/twilio/rest/flex_api/v1/web_channel.py +++ b/twilio/rest/flex_api/v1/web_channel.py @@ -363,11 +363,10 @@ def create( "PreEngagementData": pre_engagement_data, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return WebChannelInstance(self._version, payload) @@ -404,11 +403,10 @@ async def create_async( "PreEngagementData": pre_engagement_data, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return WebChannelInstance(self._version, payload) diff --git a/twilio/rest/flex_api/v2/web_channels.py b/twilio/rest/flex_api/v2/web_channels.py index a4b7b0c31d..153f59cae9 100644 --- a/twilio/rest/flex_api/v2/web_channels.py +++ b/twilio/rest/flex_api/v2/web_channels.py @@ -86,6 +86,7 @@ def create( headers = values.of( { "Ui-Version": ui_version, + "Content-Type": "application/x-www-form-urlencoded", } ) @@ -126,6 +127,7 @@ async def create_async( headers = values.of( { "Ui-Version": ui_version, + "Content-Type": "application/x-www-form-urlencoded", } ) diff --git a/twilio/rest/intelligence/v2/custom_operator.py b/twilio/rest/intelligence/v2/custom_operator.py index 6966dc5d08..af5239b124 100644 --- a/twilio/rest/intelligence/v2/custom_operator.py +++ b/twilio/rest/intelligence/v2/custom_operator.py @@ -384,11 +384,10 @@ def create( "Config": serialize.object(config), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CustomOperatorInstance(self._version, payload) @@ -413,11 +412,10 @@ async def create_async( "Config": serialize.object(config), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CustomOperatorInstance(self._version, payload) diff --git a/twilio/rest/intelligence/v2/service.py b/twilio/rest/intelligence/v2/service.py index 7ded7b9b77..8f5633d0fe 100644 --- a/twilio/rest/intelligence/v2/service.py +++ b/twilio/rest/intelligence/v2/service.py @@ -486,11 +486,10 @@ def create( "WebhookHttpMethod": webhook_http_method, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload) @@ -536,11 +535,10 @@ async def create_async( "WebhookHttpMethod": webhook_http_method, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload) diff --git a/twilio/rest/intelligence/v2/transcript/__init__.py b/twilio/rest/intelligence/v2/transcript/__init__.py index 30b97f89bd..bc71542bc0 100644 --- a/twilio/rest/intelligence/v2/transcript/__init__.py +++ b/twilio/rest/intelligence/v2/transcript/__init__.py @@ -353,11 +353,10 @@ def create( "MediaStartTime": serialize.iso8601_datetime(media_start_time), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return TranscriptInstance(self._version, payload) @@ -388,11 +387,10 @@ async def create_async( "MediaStartTime": serialize.iso8601_datetime(media_start_time), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return TranscriptInstance(self._version, payload) diff --git a/twilio/rest/ip_messaging/v1/credential.py b/twilio/rest/ip_messaging/v1/credential.py index eac8e38cf5..279aef7860 100644 --- a/twilio/rest/ip_messaging/v1/credential.py +++ b/twilio/rest/ip_messaging/v1/credential.py @@ -420,11 +420,10 @@ def create( "Secret": secret, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CredentialInstance(self._version, payload) @@ -464,11 +463,10 @@ async def create_async( "Secret": secret, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CredentialInstance(self._version, payload) diff --git a/twilio/rest/ip_messaging/v1/service/__init__.py b/twilio/rest/ip_messaging/v1/service/__init__.py index ad4f002513..e0b52e2738 100644 --- a/twilio/rest/ip_messaging/v1/service/__init__.py +++ b/twilio/rest/ip_messaging/v1/service/__init__.py @@ -1089,11 +1089,10 @@ def create(self, friendly_name: str) -> ServiceInstance: "FriendlyName": friendly_name, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload) @@ -1112,11 +1111,10 @@ async def create_async(self, friendly_name: str) -> ServiceInstance: "FriendlyName": friendly_name, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload) diff --git a/twilio/rest/ip_messaging/v1/service/channel/__init__.py b/twilio/rest/ip_messaging/v1/service/channel/__init__.py index ef469e97f2..57d2d245ec 100644 --- a/twilio/rest/ip_messaging/v1/service/channel/__init__.py +++ b/twilio/rest/ip_messaging/v1/service/channel/__init__.py @@ -484,11 +484,10 @@ def create( "Type": type, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ChannelInstance( @@ -521,11 +520,10 @@ async def create_async( "Type": type, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ChannelInstance( diff --git a/twilio/rest/ip_messaging/v1/service/channel/invite.py b/twilio/rest/ip_messaging/v1/service/channel/invite.py index 7078058a40..f4c3476edb 100644 --- a/twilio/rest/ip_messaging/v1/service/channel/invite.py +++ b/twilio/rest/ip_messaging/v1/service/channel/invite.py @@ -296,11 +296,10 @@ def create( "RoleSid": role_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return InviteInstance( @@ -328,11 +327,10 @@ async def create_async( "RoleSid": role_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return InviteInstance( diff --git a/twilio/rest/ip_messaging/v1/service/channel/member.py b/twilio/rest/ip_messaging/v1/service/channel/member.py index c52fde5a8e..4452699ceb 100644 --- a/twilio/rest/ip_messaging/v1/service/channel/member.py +++ b/twilio/rest/ip_messaging/v1/service/channel/member.py @@ -406,11 +406,10 @@ def create( "RoleSid": role_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return MemberInstance( @@ -438,11 +437,10 @@ async def create_async( "RoleSid": role_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return MemberInstance( diff --git a/twilio/rest/ip_messaging/v1/service/channel/message.py b/twilio/rest/ip_messaging/v1/service/channel/message.py index f9f2a2b1a6..5d3f2eb577 100644 --- a/twilio/rest/ip_messaging/v1/service/channel/message.py +++ b/twilio/rest/ip_messaging/v1/service/channel/message.py @@ -416,11 +416,10 @@ def create( "Attributes": attributes, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return MessageInstance( @@ -453,11 +452,10 @@ async def create_async( "Attributes": attributes, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return MessageInstance( diff --git a/twilio/rest/ip_messaging/v1/service/role.py b/twilio/rest/ip_messaging/v1/service/role.py index 935a99e180..5f5b19cfe9 100644 --- a/twilio/rest/ip_messaging/v1/service/role.py +++ b/twilio/rest/ip_messaging/v1/service/role.py @@ -361,11 +361,10 @@ def create( "Permission": serialize.map(permission, lambda e: e), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RoleInstance( @@ -392,11 +391,10 @@ async def create_async( "Permission": serialize.map(permission, lambda e: e), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RoleInstance( diff --git a/twilio/rest/ip_messaging/v1/service/user/__init__.py b/twilio/rest/ip_messaging/v1/service/user/__init__.py index ef24fa776f..91364d8f96 100644 --- a/twilio/rest/ip_messaging/v1/service/user/__init__.py +++ b/twilio/rest/ip_messaging/v1/service/user/__init__.py @@ -433,11 +433,10 @@ def create( "FriendlyName": friendly_name, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return UserInstance( @@ -470,11 +469,10 @@ async def create_async( "FriendlyName": friendly_name, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return UserInstance( diff --git a/twilio/rest/ip_messaging/v2/credential.py b/twilio/rest/ip_messaging/v2/credential.py index beec9fbebe..5d4e14f983 100644 --- a/twilio/rest/ip_messaging/v2/credential.py +++ b/twilio/rest/ip_messaging/v2/credential.py @@ -420,11 +420,10 @@ def create( "Secret": secret, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CredentialInstance(self._version, payload) @@ -464,11 +463,10 @@ async def create_async( "Secret": secret, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CredentialInstance(self._version, payload) diff --git a/twilio/rest/ip_messaging/v2/service/__init__.py b/twilio/rest/ip_messaging/v2/service/__init__.py index b107a11976..3475811625 100644 --- a/twilio/rest/ip_messaging/v2/service/__init__.py +++ b/twilio/rest/ip_messaging/v2/service/__init__.py @@ -858,11 +858,10 @@ def create(self, friendly_name: str) -> ServiceInstance: "FriendlyName": friendly_name, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload) @@ -881,11 +880,10 @@ async def create_async(self, friendly_name: str) -> ServiceInstance: "FriendlyName": friendly_name, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload) diff --git a/twilio/rest/ip_messaging/v2/service/channel/__init__.py b/twilio/rest/ip_messaging/v2/service/channel/__init__.py index c4e03d4536..29ee9ddd64 100644 --- a/twilio/rest/ip_messaging/v2/service/channel/__init__.py +++ b/twilio/rest/ip_messaging/v2/service/channel/__init__.py @@ -622,6 +622,7 @@ def create( headers = values.of( { "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, + "Content-Type": "application/x-www-form-urlencoded", } ) @@ -675,6 +676,7 @@ async def create_async( headers = values.of( { "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, + "Content-Type": "application/x-www-form-urlencoded", } ) diff --git a/twilio/rest/ip_messaging/v2/service/channel/invite.py b/twilio/rest/ip_messaging/v2/service/channel/invite.py index 0f863d70f0..a40c47a125 100644 --- a/twilio/rest/ip_messaging/v2/service/channel/invite.py +++ b/twilio/rest/ip_messaging/v2/service/channel/invite.py @@ -296,11 +296,10 @@ def create( "RoleSid": role_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return InviteInstance( @@ -328,11 +327,10 @@ async def create_async( "RoleSid": role_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return InviteInstance( diff --git a/twilio/rest/ip_messaging/v2/service/channel/member.py b/twilio/rest/ip_messaging/v2/service/channel/member.py index 5de4520ed3..9511a2bf6b 100644 --- a/twilio/rest/ip_messaging/v2/service/channel/member.py +++ b/twilio/rest/ip_messaging/v2/service/channel/member.py @@ -551,6 +551,7 @@ def create( headers = values.of( { "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, + "Content-Type": "application/x-www-form-urlencoded", } ) @@ -609,6 +610,7 @@ async def create_async( headers = values.of( { "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, + "Content-Type": "application/x-www-form-urlencoded", } ) diff --git a/twilio/rest/ip_messaging/v2/service/channel/message.py b/twilio/rest/ip_messaging/v2/service/channel/message.py index 057571c2ab..7420117113 100644 --- a/twilio/rest/ip_messaging/v2/service/channel/message.py +++ b/twilio/rest/ip_messaging/v2/service/channel/message.py @@ -553,6 +553,7 @@ def create( headers = values.of( { "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, + "Content-Type": "application/x-www-form-urlencoded", } ) @@ -609,6 +610,7 @@ async def create_async( headers = values.of( { "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, + "Content-Type": "application/x-www-form-urlencoded", } ) diff --git a/twilio/rest/ip_messaging/v2/service/channel/webhook.py b/twilio/rest/ip_messaging/v2/service/channel/webhook.py index 633acfd51f..db23dd66af 100644 --- a/twilio/rest/ip_messaging/v2/service/channel/webhook.py +++ b/twilio/rest/ip_messaging/v2/service/channel/webhook.py @@ -485,11 +485,10 @@ def create( "Configuration.RetryCount": configuration_retry_count, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return WebhookInstance( @@ -538,11 +537,10 @@ async def create_async( "Configuration.RetryCount": configuration_retry_count, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return WebhookInstance( diff --git a/twilio/rest/ip_messaging/v2/service/role.py b/twilio/rest/ip_messaging/v2/service/role.py index 91fc1af939..0acf77983b 100644 --- a/twilio/rest/ip_messaging/v2/service/role.py +++ b/twilio/rest/ip_messaging/v2/service/role.py @@ -361,11 +361,10 @@ def create( "Permission": serialize.map(permission, lambda e: e), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RoleInstance( @@ -392,11 +391,10 @@ async def create_async( "Permission": serialize.map(permission, lambda e: e), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RoleInstance( diff --git a/twilio/rest/ip_messaging/v2/service/user/__init__.py b/twilio/rest/ip_messaging/v2/service/user/__init__.py index 1b3ba1b391..3af3121fab 100644 --- a/twilio/rest/ip_messaging/v2/service/user/__init__.py +++ b/twilio/rest/ip_messaging/v2/service/user/__init__.py @@ -491,6 +491,7 @@ def create( headers = values.of( { "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, + "Content-Type": "application/x-www-form-urlencoded", } ) @@ -535,6 +536,7 @@ async def create_async( headers = values.of( { "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, + "Content-Type": "application/x-www-form-urlencoded", } ) diff --git a/twilio/rest/marketplace/v1/installed_add_on/__init__.py b/twilio/rest/marketplace/v1/installed_add_on/__init__.py index 0aad53d8ee..df67c01d8c 100644 --- a/twilio/rest/marketplace/v1/installed_add_on/__init__.py +++ b/twilio/rest/marketplace/v1/installed_add_on/__init__.py @@ -410,11 +410,10 @@ def create( "UniqueName": unique_name, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return InstalledAddOnInstance(self._version, payload) @@ -447,11 +446,10 @@ async def create_async( "UniqueName": unique_name, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return InstalledAddOnInstance(self._version, payload) diff --git a/twilio/rest/marketplace/v1/installed_add_on/installed_add_on_usage.py b/twilio/rest/marketplace/v1/installed_add_on/installed_add_on_usage.py index 6fff4979f4..3d8d694a22 100644 --- a/twilio/rest/marketplace/v1/installed_add_on/installed_add_on_usage.py +++ b/twilio/rest/marketplace/v1/installed_add_on/installed_add_on_usage.py @@ -13,7 +13,7 @@ """ from typing import Any, Dict, List, Optional -from twilio.base import deserialize +from twilio.base import deserialize, values from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -120,7 +120,8 @@ def create( """ data = create_marketplace_billing_usage_request.to_dict() - headers = {"Content-Type": "application/json"} + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers @@ -145,7 +146,8 @@ async def create_async( """ data = create_marketplace_billing_usage_request.to_dict() - headers = {"Content-Type": "application/json"} + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers diff --git a/twilio/rest/messaging/v1/brand_registration/__init__.py b/twilio/rest/messaging/v1/brand_registration/__init__.py index b02af94919..b6ac290064 100644 --- a/twilio/rest/messaging/v1/brand_registration/__init__.py +++ b/twilio/rest/messaging/v1/brand_registration/__init__.py @@ -390,11 +390,10 @@ def create( ), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return BrandRegistrationInstance(self._version, payload) @@ -430,11 +429,10 @@ async def create_async( ), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return BrandRegistrationInstance(self._version, payload) diff --git a/twilio/rest/messaging/v1/brand_registration/brand_registration_otp.py b/twilio/rest/messaging/v1/brand_registration/brand_registration_otp.py index 20ce245b37..74631cea78 100644 --- a/twilio/rest/messaging/v1/brand_registration/brand_registration_otp.py +++ b/twilio/rest/messaging/v1/brand_registration/brand_registration_otp.py @@ -13,6 +13,7 @@ """ from typing import Any, Dict, Optional +from twilio.base import values from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -77,10 +78,9 @@ def create(self) -> BrandRegistrationOtpInstance: :returns: The created BrandRegistrationOtpInstance """ - payload = self._version.create( - method="POST", - uri=self._uri, - ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + payload = self._version.create(method="POST", uri=self._uri, headers=headers) return BrandRegistrationOtpInstance( self._version, @@ -96,9 +96,10 @@ async def create_async(self) -> BrandRegistrationOtpInstance: :returns: The created BrandRegistrationOtpInstance """ + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + payload = await self._version.create_async( - method="POST", - uri=self._uri, + method="POST", uri=self._uri, headers=headers ) return BrandRegistrationOtpInstance( diff --git a/twilio/rest/messaging/v1/brand_registration/brand_vetting.py b/twilio/rest/messaging/v1/brand_registration/brand_vetting.py index c801cb12b4..37fe4ed8d4 100644 --- a/twilio/rest/messaging/v1/brand_registration/brand_vetting.py +++ b/twilio/rest/messaging/v1/brand_registration/brand_vetting.py @@ -250,11 +250,10 @@ def create( "VettingId": vetting_id, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return BrandVettingInstance( @@ -281,11 +280,10 @@ async def create_async( "VettingId": vetting_id, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return BrandVettingInstance( diff --git a/twilio/rest/messaging/v1/external_campaign.py b/twilio/rest/messaging/v1/external_campaign.py index b70d8a4ee1..88262f978d 100644 --- a/twilio/rest/messaging/v1/external_campaign.py +++ b/twilio/rest/messaging/v1/external_campaign.py @@ -82,11 +82,10 @@ def create( "MessagingServiceSid": messaging_service_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ExternalCampaignInstance(self._version, payload) @@ -109,11 +108,10 @@ async def create_async( "MessagingServiceSid": messaging_service_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ExternalCampaignInstance(self._version, payload) diff --git a/twilio/rest/messaging/v1/service/__init__.py b/twilio/rest/messaging/v1/service/__init__.py index 75c798f4c4..0fbb3dd10b 100644 --- a/twilio/rest/messaging/v1/service/__init__.py +++ b/twilio/rest/messaging/v1/service/__init__.py @@ -766,11 +766,10 @@ def create( ), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload) @@ -845,11 +844,10 @@ async def create_async( ), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload) diff --git a/twilio/rest/messaging/v1/service/alpha_sender.py b/twilio/rest/messaging/v1/service/alpha_sender.py index 38d2d0d5e9..0173c98099 100644 --- a/twilio/rest/messaging/v1/service/alpha_sender.py +++ b/twilio/rest/messaging/v1/service/alpha_sender.py @@ -272,11 +272,10 @@ def create(self, alpha_sender: str) -> AlphaSenderInstance: "AlphaSender": alpha_sender, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AlphaSenderInstance( @@ -297,11 +296,10 @@ async def create_async(self, alpha_sender: str) -> AlphaSenderInstance: "AlphaSender": alpha_sender, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AlphaSenderInstance( diff --git a/twilio/rest/messaging/v1/service/phone_number.py b/twilio/rest/messaging/v1/service/phone_number.py index 8b0b4c0900..10d30ab7fa 100644 --- a/twilio/rest/messaging/v1/service/phone_number.py +++ b/twilio/rest/messaging/v1/service/phone_number.py @@ -274,11 +274,10 @@ def create(self, phone_number_sid: str) -> PhoneNumberInstance: "PhoneNumberSid": phone_number_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return PhoneNumberInstance( @@ -299,11 +298,10 @@ async def create_async(self, phone_number_sid: str) -> PhoneNumberInstance: "PhoneNumberSid": phone_number_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return PhoneNumberInstance( diff --git a/twilio/rest/messaging/v1/service/short_code.py b/twilio/rest/messaging/v1/service/short_code.py index 6537875891..c8f1b3e3c8 100644 --- a/twilio/rest/messaging/v1/service/short_code.py +++ b/twilio/rest/messaging/v1/service/short_code.py @@ -272,11 +272,10 @@ def create(self, short_code_sid: str) -> ShortCodeInstance: "ShortCodeSid": short_code_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ShortCodeInstance( @@ -297,11 +296,10 @@ async def create_async(self, short_code_sid: str) -> ShortCodeInstance: "ShortCodeSid": short_code_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ShortCodeInstance( diff --git a/twilio/rest/messaging/v1/service/us_app_to_person.py b/twilio/rest/messaging/v1/service/us_app_to_person.py index 9034e4e2eb..ad31c6a4b7 100644 --- a/twilio/rest/messaging/v1/service/us_app_to_person.py +++ b/twilio/rest/messaging/v1/service/us_app_to_person.py @@ -532,11 +532,10 @@ def create( "DirectLending": serialize.boolean_to_string(direct_lending), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return UsAppToPersonInstance( @@ -607,11 +606,10 @@ async def create_async( "DirectLending": serialize.boolean_to_string(direct_lending), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return UsAppToPersonInstance( diff --git a/twilio/rest/messaging/v1/service/us_app_to_person_usecase.py b/twilio/rest/messaging/v1/service/us_app_to_person_usecase.py index debcf940d9..1f0d857047 100644 --- a/twilio/rest/messaging/v1/service/us_app_to_person_usecase.py +++ b/twilio/rest/messaging/v1/service/us_app_to_person_usecase.py @@ -79,6 +79,7 @@ def fetch( :param brand_registration_sid: The unique string to identify the A2P brand. :returns: The fetched UsAppToPersonUsecaseInstance """ + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) params = values.of( { @@ -86,7 +87,9 @@ def fetch( } ) - payload = self._version.fetch(method="GET", uri=self._uri, params=params) + payload = self._version.fetch( + method="GET", uri=self._uri, headers=headers, params=params + ) return UsAppToPersonUsecaseInstance( self._version, @@ -103,6 +106,7 @@ async def fetch_async( :param brand_registration_sid: The unique string to identify the A2P brand. :returns: The fetched UsAppToPersonUsecaseInstance """ + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) params = values.of( { @@ -111,7 +115,7 @@ async def fetch_async( ) payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=params + method="GET", uri=self._uri, headers=headers, params=params ) return UsAppToPersonUsecaseInstance( diff --git a/twilio/rest/messaging/v1/tollfree_verification.py b/twilio/rest/messaging/v1/tollfree_verification.py index f8c639286b..98887c7663 100644 --- a/twilio/rest/messaging/v1/tollfree_verification.py +++ b/twilio/rest/messaging/v1/tollfree_verification.py @@ -757,11 +757,10 @@ def create( "ExternalReferenceId": external_reference_id, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return TollfreeVerificationInstance(self._version, payload) @@ -849,11 +848,10 @@ async def create_async( "ExternalReferenceId": external_reference_id, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return TollfreeVerificationInstance(self._version, payload) diff --git a/twilio/rest/messaging/v1/usecase.py b/twilio/rest/messaging/v1/usecase.py index d7223f3632..118c9c895e 100644 --- a/twilio/rest/messaging/v1/usecase.py +++ b/twilio/rest/messaging/v1/usecase.py @@ -13,6 +13,7 @@ """ from typing import Any, Dict, List, Optional +from twilio.base import values from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -59,8 +60,9 @@ def fetch(self) -> UsecaseInstance: :returns: The fetched UsecaseInstance """ + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - payload = self._version.fetch(method="GET", uri=self._uri) + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return UsecaseInstance(self._version, payload) @@ -71,8 +73,11 @@ async def fetch_async(self) -> UsecaseInstance: :returns: The fetched UsecaseInstance """ + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - payload = await self._version.fetch_async(method="GET", uri=self._uri) + payload = await self._version.fetch_async( + method="GET", uri=self._uri, headers=headers + ) return UsecaseInstance(self._version, payload) diff --git a/twilio/rest/microvisor/v1/account_config.py b/twilio/rest/microvisor/v1/account_config.py index 3d37b01cd2..0abe5f9288 100644 --- a/twilio/rest/microvisor/v1/account_config.py +++ b/twilio/rest/microvisor/v1/account_config.py @@ -313,11 +313,10 @@ def create(self, key: str, value: str) -> AccountConfigInstance: "Value": value, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AccountConfigInstance(self._version, payload) @@ -338,11 +337,10 @@ async def create_async(self, key: str, value: str) -> AccountConfigInstance: "Value": value, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AccountConfigInstance(self._version, payload) diff --git a/twilio/rest/microvisor/v1/account_secret.py b/twilio/rest/microvisor/v1/account_secret.py index cca0e1d773..e85a78bc58 100644 --- a/twilio/rest/microvisor/v1/account_secret.py +++ b/twilio/rest/microvisor/v1/account_secret.py @@ -311,11 +311,10 @@ def create(self, key: str, value: str) -> AccountSecretInstance: "Value": value, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AccountSecretInstance(self._version, payload) @@ -336,11 +335,10 @@ async def create_async(self, key: str, value: str) -> AccountSecretInstance: "Value": value, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AccountSecretInstance(self._version, payload) diff --git a/twilio/rest/microvisor/v1/device/device_config.py b/twilio/rest/microvisor/v1/device/device_config.py index 3607e971f2..b4759e90b0 100644 --- a/twilio/rest/microvisor/v1/device/device_config.py +++ b/twilio/rest/microvisor/v1/device/device_config.py @@ -342,11 +342,10 @@ def create(self, key: str, value: str) -> DeviceConfigInstance: "Value": value, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return DeviceConfigInstance( @@ -369,11 +368,10 @@ async def create_async(self, key: str, value: str) -> DeviceConfigInstance: "Value": value, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return DeviceConfigInstance( diff --git a/twilio/rest/microvisor/v1/device/device_secret.py b/twilio/rest/microvisor/v1/device/device_secret.py index 0ab9b1c721..f89a6c0e96 100644 --- a/twilio/rest/microvisor/v1/device/device_secret.py +++ b/twilio/rest/microvisor/v1/device/device_secret.py @@ -340,11 +340,10 @@ def create(self, key: str, value: str) -> DeviceSecretInstance: "Value": value, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return DeviceSecretInstance( @@ -367,11 +366,10 @@ async def create_async(self, key: str, value: str) -> DeviceSecretInstance: "Value": value, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return DeviceSecretInstance( diff --git a/twilio/rest/notify/v1/credential.py b/twilio/rest/notify/v1/credential.py index 5cb86363a3..d894a9a702 100644 --- a/twilio/rest/notify/v1/credential.py +++ b/twilio/rest/notify/v1/credential.py @@ -420,11 +420,10 @@ def create( "Secret": secret, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CredentialInstance(self._version, payload) @@ -464,11 +463,10 @@ async def create_async( "Secret": secret, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CredentialInstance(self._version, payload) diff --git a/twilio/rest/notify/v1/service/__init__.py b/twilio/rest/notify/v1/service/__init__.py index 0cd9adb685..2654c97c14 100644 --- a/twilio/rest/notify/v1/service/__init__.py +++ b/twilio/rest/notify/v1/service/__init__.py @@ -616,11 +616,10 @@ def create( ), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload) @@ -683,11 +682,10 @@ async def create_async( ), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload) diff --git a/twilio/rest/notify/v1/service/binding.py b/twilio/rest/notify/v1/service/binding.py index a6b1e3f087..845f720dc2 100644 --- a/twilio/rest/notify/v1/service/binding.py +++ b/twilio/rest/notify/v1/service/binding.py @@ -314,11 +314,10 @@ def create( "Endpoint": endpoint, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return BindingInstance( @@ -360,11 +359,10 @@ async def create_async( "Endpoint": endpoint, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return BindingInstance( diff --git a/twilio/rest/notify/v1/service/notification.py b/twilio/rest/notify/v1/service/notification.py index e2482be109..ec31b423a1 100644 --- a/twilio/rest/notify/v1/service/notification.py +++ b/twilio/rest/notify/v1/service/notification.py @@ -180,11 +180,10 @@ def create( "Tag": serialize.map(tag, lambda e: e), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return NotificationInstance( @@ -259,11 +258,10 @@ async def create_async( "Tag": serialize.map(tag, lambda e: e), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return NotificationInstance( diff --git a/twilio/rest/numbers/v1/bulk_eligibility.py b/twilio/rest/numbers/v1/bulk_eligibility.py index 0e92b5b076..97b358b71e 100644 --- a/twilio/rest/numbers/v1/bulk_eligibility.py +++ b/twilio/rest/numbers/v1/bulk_eligibility.py @@ -192,7 +192,8 @@ def create( """ data = body.to_dict() - headers = {"Content-Type": "application/json"} + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers @@ -212,7 +213,8 @@ async def create_async( """ data = body.to_dict() - headers = {"Content-Type": "application/json"} + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers diff --git a/twilio/rest/numbers/v1/eligibility.py b/twilio/rest/numbers/v1/eligibility.py index 91a2c73261..007a019f5b 100644 --- a/twilio/rest/numbers/v1/eligibility.py +++ b/twilio/rest/numbers/v1/eligibility.py @@ -63,7 +63,8 @@ def create(self, body: Union[object, object] = values.unset) -> EligibilityInsta """ data = body.to_dict() - headers = {"Content-Type": "application/json"} + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers @@ -83,7 +84,8 @@ async def create_async( """ data = body.to_dict() - headers = {"Content-Type": "application/json"} + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers diff --git a/twilio/rest/numbers/v1/porting_port_in.py b/twilio/rest/numbers/v1/porting_port_in.py index e9988a7d6b..50b3e328ec 100644 --- a/twilio/rest/numbers/v1/porting_port_in.py +++ b/twilio/rest/numbers/v1/porting_port_in.py @@ -34,6 +34,7 @@ class PortingPortInInstance(InstanceResource): :ivar losing_carrier_information: The information for the losing carrier. :ivar phone_numbers: The list of phone numbers to Port in. Phone numbers are in E.164 format (e.g. +16175551212). :ivar documents: The list of documents SID referencing a utility bills + :ivar date_created: """ def __init__( @@ -69,6 +70,9 @@ def __init__( "phone_numbers" ) self.documents: Optional[List[str]] = payload.get("documents") + self.date_created: Optional[date] = deserialize.iso8601_date( + payload.get("date_created") + ) self._solution = { "port_in_request_sid": port_in_request_sid or self.port_in_request_sid, @@ -250,7 +254,8 @@ def create( """ data = body.to_dict() - headers = {"Content-Type": "application/json"} + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers @@ -270,7 +275,8 @@ async def create_async( """ data = body.to_dict() - headers = {"Content-Type": "application/json"} + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers diff --git a/twilio/rest/numbers/v1/porting_port_in_phone_number.py b/twilio/rest/numbers/v1/porting_port_in_phone_number.py index 48b90eea4f..f5d881a657 100644 --- a/twilio/rest/numbers/v1/porting_port_in_phone_number.py +++ b/twilio/rest/numbers/v1/porting_port_in_phone_number.py @@ -31,12 +31,15 @@ class PortingPortInPhoneNumberInstance(InstanceResource): :ivar date_created: The date when the phone number was created. :ivar country: The country of the phone number. :ivar missing_required_fields: The phone number is missing required fields. - :ivar status_last_time_updated_timestamp: The timestamp when the status was last updated. + :ivar last_updated: The timestamp when the status was last updated. :ivar phone_number: The phone number. :ivar portable: The phone number is portable. :ivar not_portability_reason: The reason why the phone number is not portable. :ivar not_portability_reason_code: The code of the reason why the phone number is not portable. :ivar port_in_phone_number_status: The status of the phone number in the port in request. + :ivar port_out_pin: The pin required for the losing carrier to port out the phone number. + :ivar rejection_reason: The rejection reason returned by the vendor. + :ivar rejection_reason_code: The rejection reason code returned by the vendor. """ def __init__( @@ -60,22 +63,27 @@ def __init__( self.missing_required_fields: Optional[bool] = payload.get( "missing_required_fields" ) - self.status_last_time_updated_timestamp: Optional[datetime] = ( - deserialize.iso8601_datetime( - payload.get("status_last_time_updated_timestamp") - ) + self.last_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("last_updated") ) self.phone_number: Optional[str] = payload.get("phone_number") self.portable: Optional[bool] = payload.get("portable") self.not_portability_reason: Optional[str] = payload.get( "not_portability_reason" ) - self.not_portability_reason_code: Optional[str] = payload.get( - "not_portability_reason_code" + self.not_portability_reason_code: Optional[int] = deserialize.integer( + payload.get("not_portability_reason_code") ) self.port_in_phone_number_status: Optional[str] = payload.get( "port_in_phone_number_status" ) + self.port_out_pin: Optional[int] = deserialize.integer( + payload.get("port_out_pin") + ) + self.rejection_reason: Optional[str] = payload.get("rejection_reason") + self.rejection_reason_code: Optional[int] = deserialize.integer( + payload.get("rejection_reason_code") + ) self._solution = { "port_in_request_sid": port_in_request_sid or self.port_in_request_sid, diff --git a/twilio/rest/numbers/v1/porting_portability.py b/twilio/rest/numbers/v1/porting_portability.py index f1cf0cb8c9..d4f92ba7d5 100644 --- a/twilio/rest/numbers/v1/porting_portability.py +++ b/twilio/rest/numbers/v1/porting_portability.py @@ -37,8 +37,6 @@ class NumberType(object): :ivar not_portable_reason_code: The Portability Reason Code for the phone number if it cannot be ported into Twilio, `null` otherwise. One of `22131`, `22132`, `22130`, `22133`, `22102` or `22135`. :ivar number_type: :ivar country: Country the phone number belongs to. - :ivar messaging_carrier: Current messaging carrier of the phone number - :ivar voice_carrier: Current voice carrier of the phone number :ivar url: This is the url of the request that you're trying to reach out to locate the resource. """ @@ -64,8 +62,6 @@ def __init__( payload.get("number_type") ) self.country: Optional[str] = payload.get("country") - self.messaging_carrier: Optional[str] = payload.get("messaging_carrier") - self.voice_carrier: Optional[str] = payload.get("voice_carrier") self.url: Optional[str] = payload.get("url") self._solution = { diff --git a/twilio/rest/numbers/v1/porting_webhook_configuration.py b/twilio/rest/numbers/v1/porting_webhook_configuration.py index d1daabfd7e..ea6d9bd2eb 100644 --- a/twilio/rest/numbers/v1/porting_webhook_configuration.py +++ b/twilio/rest/numbers/v1/porting_webhook_configuration.py @@ -71,7 +71,8 @@ def create( """ data = body.to_dict() - headers = {"Content-Type": "application/json"} + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers @@ -91,7 +92,8 @@ async def create_async( """ data = body.to_dict() - headers = {"Content-Type": "application/json"} + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers diff --git a/twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py b/twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py index 46c053b65a..0119fe002f 100644 --- a/twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py +++ b/twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py @@ -14,7 +14,7 @@ from datetime import datetime from typing import Any, Dict, List, Optional -from twilio.base import deserialize +from twilio.base import deserialize, values from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -75,8 +75,9 @@ def fetch(self) -> PortingWebhookConfigurationFetchInstance: :returns: The fetched PortingWebhookConfigurationFetchInstance """ + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - payload = self._version.fetch(method="GET", uri=self._uri) + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return PortingWebhookConfigurationFetchInstance(self._version, payload) @@ -87,8 +88,11 @@ async def fetch_async(self) -> PortingWebhookConfigurationFetchInstance: :returns: The fetched PortingWebhookConfigurationFetchInstance """ + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - payload = await self._version.fetch_async(method="GET", uri=self._uri) + payload = await self._version.fetch_async( + method="GET", uri=self._uri, headers=headers + ) return PortingWebhookConfigurationFetchInstance(self._version, payload) diff --git a/twilio/rest/numbers/v1/signing_request_configuration.py b/twilio/rest/numbers/v1/signing_request_configuration.py index 1b70ba88c0..541062ec6d 100644 --- a/twilio/rest/numbers/v1/signing_request_configuration.py +++ b/twilio/rest/numbers/v1/signing_request_configuration.py @@ -79,7 +79,8 @@ def create( """ data = body.to_dict() - headers = {"Content-Type": "application/json"} + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers @@ -99,7 +100,8 @@ async def create_async( """ data = body.to_dict() - headers = {"Content-Type": "application/json"} + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers diff --git a/twilio/rest/numbers/v2/authorization_document/__init__.py b/twilio/rest/numbers/v2/authorization_document/__init__.py index 7e0a4d9184..f56071878e 100644 --- a/twilio/rest/numbers/v2/authorization_document/__init__.py +++ b/twilio/rest/numbers/v2/authorization_document/__init__.py @@ -313,11 +313,10 @@ def create( "CcEmails": serialize.map(cc_emails, lambda e: e), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AuthorizationDocumentInstance(self._version, payload) @@ -356,11 +355,10 @@ async def create_async( "CcEmails": serialize.map(cc_emails, lambda e: e), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AuthorizationDocumentInstance(self._version, payload) diff --git a/twilio/rest/numbers/v2/bulk_hosted_number_order.py b/twilio/rest/numbers/v2/bulk_hosted_number_order.py index 30a57e28f4..325ffe8e73 100644 --- a/twilio/rest/numbers/v2/bulk_hosted_number_order.py +++ b/twilio/rest/numbers/v2/bulk_hosted_number_order.py @@ -230,7 +230,8 @@ def create( """ data = body.to_dict() - headers = {"Content-Type": "application/json"} + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers @@ -250,7 +251,8 @@ async def create_async( """ data = body.to_dict() - headers = {"Content-Type": "application/json"} + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers diff --git a/twilio/rest/numbers/v2/hosted_number_order.py b/twilio/rest/numbers/v2/hosted_number_order.py index 2063e7a87d..b2660cfc30 100644 --- a/twilio/rest/numbers/v2/hosted_number_order.py +++ b/twilio/rest/numbers/v2/hosted_number_order.py @@ -339,11 +339,10 @@ def create( "ContactTitle": contact_title, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return HostedNumberOrderInstance(self._version, payload) @@ -410,11 +409,10 @@ async def create_async( "ContactTitle": contact_title, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return HostedNumberOrderInstance(self._version, payload) diff --git a/twilio/rest/numbers/v2/regulatory_compliance/bundle/__init__.py b/twilio/rest/numbers/v2/regulatory_compliance/bundle/__init__.py index d37caa0fb8..ccdcbb3f38 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/bundle/__init__.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/bundle/__init__.py @@ -514,11 +514,10 @@ def create( "NumberType": number_type, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return BundleInstance(self._version, payload) @@ -558,11 +557,10 @@ async def create_async( "NumberType": number_type, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return BundleInstance(self._version, payload) diff --git a/twilio/rest/numbers/v2/regulatory_compliance/bundle/bundle_copy.py b/twilio/rest/numbers/v2/regulatory_compliance/bundle/bundle_copy.py index a8cf77fd18..860a6f186e 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/bundle/bundle_copy.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/bundle/bundle_copy.py @@ -136,11 +136,10 @@ def create( "FriendlyName": friendly_name, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return BundleCopyInstance( @@ -163,11 +162,10 @@ async def create_async( "FriendlyName": friendly_name, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return BundleCopyInstance( diff --git a/twilio/rest/numbers/v2/regulatory_compliance/bundle/evaluation.py b/twilio/rest/numbers/v2/regulatory_compliance/bundle/evaluation.py index 39aae3b6ed..83d061cda7 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/bundle/evaluation.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/bundle/evaluation.py @@ -231,10 +231,9 @@ def create(self) -> EvaluationInstance: :returns: The created EvaluationInstance """ - payload = self._version.create( - method="POST", - uri=self._uri, - ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + payload = self._version.create(method="POST", uri=self._uri, headers=headers) return EvaluationInstance( self._version, payload, bundle_sid=self._solution["bundle_sid"] @@ -248,9 +247,10 @@ async def create_async(self) -> EvaluationInstance: :returns: The created EvaluationInstance """ + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + payload = await self._version.create_async( - method="POST", - uri=self._uri, + method="POST", uri=self._uri, headers=headers ) return EvaluationInstance( diff --git a/twilio/rest/numbers/v2/regulatory_compliance/bundle/item_assignment.py b/twilio/rest/numbers/v2/regulatory_compliance/bundle/item_assignment.py index d22fc31396..5fa77e7f95 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/bundle/item_assignment.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/bundle/item_assignment.py @@ -270,11 +270,10 @@ def create(self, object_sid: str) -> ItemAssignmentInstance: "ObjectSid": object_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ItemAssignmentInstance( @@ -295,11 +294,10 @@ async def create_async(self, object_sid: str) -> ItemAssignmentInstance: "ObjectSid": object_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ItemAssignmentInstance( diff --git a/twilio/rest/numbers/v2/regulatory_compliance/bundle/replace_items.py b/twilio/rest/numbers/v2/regulatory_compliance/bundle/replace_items.py index 09e2823ada..2e2bc6c293 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/bundle/replace_items.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/bundle/replace_items.py @@ -112,11 +112,10 @@ def create(self, from_bundle_sid: str) -> ReplaceItemsInstance: "FromBundleSid": from_bundle_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ReplaceItemsInstance( @@ -137,11 +136,10 @@ async def create_async(self, from_bundle_sid: str) -> ReplaceItemsInstance: "FromBundleSid": from_bundle_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ReplaceItemsInstance( diff --git a/twilio/rest/numbers/v2/regulatory_compliance/end_user.py b/twilio/rest/numbers/v2/regulatory_compliance/end_user.py index 3f9e5ec856..7886494d54 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/end_user.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/end_user.py @@ -359,11 +359,10 @@ def create( "Attributes": serialize.object(attributes), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return EndUserInstance(self._version, payload) @@ -391,11 +390,10 @@ async def create_async( "Attributes": serialize.object(attributes), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return EndUserInstance(self._version, payload) diff --git a/twilio/rest/numbers/v2/regulatory_compliance/supporting_document.py b/twilio/rest/numbers/v2/regulatory_compliance/supporting_document.py index f2cd4e13d2..afa6579a13 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/supporting_document.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/supporting_document.py @@ -377,11 +377,10 @@ def create( "Attributes": serialize.object(attributes), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SupportingDocumentInstance(self._version, payload) @@ -409,11 +408,10 @@ async def create_async( "Attributes": serialize.object(attributes), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SupportingDocumentInstance(self._version, payload) diff --git a/twilio/rest/oauth/v1/authorize.py b/twilio/rest/oauth/v1/authorize.py index 9798a73f3f..19341db74e 100644 --- a/twilio/rest/oauth/v1/authorize.py +++ b/twilio/rest/oauth/v1/authorize.py @@ -67,6 +67,7 @@ def fetch( :param response_type: Response Type:param client_id: The Client Identifier:param redirect_uri: The url to which response will be redirected to:param scope: The scope of the access request:param state: An opaque value which can be used to maintain state between the request and callback :returns: The fetched AuthorizeInstance """ + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) params = values.of( { @@ -78,7 +79,9 @@ def fetch( } ) - payload = self._version.fetch(method="GET", uri=self._uri, params=params) + payload = self._version.fetch( + method="GET", uri=self._uri, headers=headers, params=params + ) return AuthorizeInstance(self._version, payload) @@ -96,6 +99,7 @@ async def fetch_async( :param response_type: Response Type:param client_id: The Client Identifier:param redirect_uri: The url to which response will be redirected to:param scope: The scope of the access request:param state: An opaque value which can be used to maintain state between the request and callback :returns: The fetched AuthorizeInstance """ + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) params = values.of( { @@ -108,7 +112,7 @@ async def fetch_async( ) payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=params + method="GET", uri=self._uri, headers=headers, params=params ) return AuthorizeInstance(self._version, payload) diff --git a/twilio/rest/oauth/v1/token.py b/twilio/rest/oauth/v1/token.py index 42884f0896..0d5377a9f9 100644 --- a/twilio/rest/oauth/v1/token.py +++ b/twilio/rest/oauth/v1/token.py @@ -99,11 +99,10 @@ def create( "Scope": scope, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return TokenInstance(self._version, payload) @@ -146,11 +145,10 @@ async def create_async( "Scope": scope, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return TokenInstance(self._version, payload) diff --git a/twilio/rest/preview/deployed_devices/fleet/__init__.py b/twilio/rest/preview/deployed_devices/fleet/__init__.py index 0f5c284468..f7321fdb2b 100644 --- a/twilio/rest/preview/deployed_devices/fleet/__init__.py +++ b/twilio/rest/preview/deployed_devices/fleet/__init__.py @@ -434,11 +434,10 @@ def create(self, friendly_name: Union[str, object] = values.unset) -> FleetInsta "FriendlyName": friendly_name, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return FleetInstance(self._version, payload) @@ -459,11 +458,10 @@ async def create_async( "FriendlyName": friendly_name, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return FleetInstance(self._version, payload) diff --git a/twilio/rest/preview/deployed_devices/fleet/certificate.py b/twilio/rest/preview/deployed_devices/fleet/certificate.py index 1511a06134..895bdc5682 100644 --- a/twilio/rest/preview/deployed_devices/fleet/certificate.py +++ b/twilio/rest/preview/deployed_devices/fleet/certificate.py @@ -383,11 +383,10 @@ def create( "DeviceSid": device_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CertificateInstance( @@ -417,11 +416,10 @@ async def create_async( "DeviceSid": device_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CertificateInstance( diff --git a/twilio/rest/preview/deployed_devices/fleet/deployment.py b/twilio/rest/preview/deployed_devices/fleet/deployment.py index 5c0d109eab..80f9f2372d 100644 --- a/twilio/rest/preview/deployed_devices/fleet/deployment.py +++ b/twilio/rest/preview/deployed_devices/fleet/deployment.py @@ -378,11 +378,10 @@ def create( "SyncServiceSid": sync_service_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return DeploymentInstance( @@ -409,11 +408,10 @@ async def create_async( "SyncServiceSid": sync_service_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return DeploymentInstance( diff --git a/twilio/rest/preview/deployed_devices/fleet/device.py b/twilio/rest/preview/deployed_devices/fleet/device.py index 7e9b818140..3cacc88f2b 100644 --- a/twilio/rest/preview/deployed_devices/fleet/device.py +++ b/twilio/rest/preview/deployed_devices/fleet/device.py @@ -421,11 +421,10 @@ def create( "Enabled": serialize.boolean_to_string(enabled), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return DeviceInstance( @@ -461,11 +460,10 @@ async def create_async( "Enabled": serialize.boolean_to_string(enabled), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return DeviceInstance( diff --git a/twilio/rest/preview/deployed_devices/fleet/key.py b/twilio/rest/preview/deployed_devices/fleet/key.py index eabfc456cc..1b7c06e1f9 100644 --- a/twilio/rest/preview/deployed_devices/fleet/key.py +++ b/twilio/rest/preview/deployed_devices/fleet/key.py @@ -380,11 +380,10 @@ def create( "DeviceSid": device_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return KeyInstance( @@ -411,11 +410,10 @@ async def create_async( "DeviceSid": device_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return KeyInstance( diff --git a/twilio/rest/preview/hosted_numbers/authorization_document/__init__.py b/twilio/rest/preview/hosted_numbers/authorization_document/__init__.py index 162d0b11a5..79fe4beddd 100644 --- a/twilio/rest/preview/hosted_numbers/authorization_document/__init__.py +++ b/twilio/rest/preview/hosted_numbers/authorization_document/__init__.py @@ -433,11 +433,10 @@ def create( "CcEmails": serialize.map(cc_emails, lambda e: e), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AuthorizationDocumentInstance(self._version, payload) @@ -476,11 +475,10 @@ async def create_async( "CcEmails": serialize.map(cc_emails, lambda e: e), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AuthorizationDocumentInstance(self._version, payload) diff --git a/twilio/rest/preview/hosted_numbers/hosted_number_order.py b/twilio/rest/preview/hosted_numbers/hosted_number_order.py index 7e68f57b56..7010b1b3eb 100644 --- a/twilio/rest/preview/hosted_numbers/hosted_number_order.py +++ b/twilio/rest/preview/hosted_numbers/hosted_number_order.py @@ -568,11 +568,10 @@ def create( "VerificationDocumentSid": verification_document_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return HostedNumberOrderInstance(self._version, payload) @@ -644,11 +643,10 @@ async def create_async( "VerificationDocumentSid": verification_document_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return HostedNumberOrderInstance(self._version, payload) diff --git a/twilio/rest/preview/marketplace/installed_add_on/__init__.py b/twilio/rest/preview/marketplace/installed_add_on/__init__.py index d067f9fe79..731e84c80c 100644 --- a/twilio/rest/preview/marketplace/installed_add_on/__init__.py +++ b/twilio/rest/preview/marketplace/installed_add_on/__init__.py @@ -387,11 +387,10 @@ def create( "UniqueName": unique_name, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return InstalledAddOnInstance(self._version, payload) @@ -424,11 +423,10 @@ async def create_async( "UniqueName": unique_name, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return InstalledAddOnInstance(self._version, payload) diff --git a/twilio/rest/preview/sync/service/__init__.py b/twilio/rest/preview/sync/service/__init__.py index cb8cdf7910..23f805a875 100644 --- a/twilio/rest/preview/sync/service/__init__.py +++ b/twilio/rest/preview/sync/service/__init__.py @@ -457,11 +457,10 @@ def create( "AclEnabled": serialize.boolean_to_string(acl_enabled), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload) @@ -494,11 +493,10 @@ async def create_async( "AclEnabled": serialize.boolean_to_string(acl_enabled), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload) diff --git a/twilio/rest/preview/sync/service/document/__init__.py b/twilio/rest/preview/sync/service/document/__init__.py index e7ab4ae8b8..c7033e2fd2 100644 --- a/twilio/rest/preview/sync/service/document/__init__.py +++ b/twilio/rest/preview/sync/service/document/__init__.py @@ -405,11 +405,10 @@ def create( "Data": serialize.object(data), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return DocumentInstance( @@ -436,11 +435,10 @@ async def create_async( "Data": serialize.object(data), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return DocumentInstance( diff --git a/twilio/rest/preview/sync/service/sync_list/__init__.py b/twilio/rest/preview/sync/service/sync_list/__init__.py index fcd2f28ffe..4b920e0194 100644 --- a/twilio/rest/preview/sync/service/sync_list/__init__.py +++ b/twilio/rest/preview/sync/service/sync_list/__init__.py @@ -323,11 +323,10 @@ def create( "UniqueName": unique_name, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SyncListInstance( @@ -350,11 +349,10 @@ async def create_async( "UniqueName": unique_name, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SyncListInstance( diff --git a/twilio/rest/preview/sync/service/sync_list/sync_list_item.py b/twilio/rest/preview/sync/service/sync_list/sync_list_item.py index 0cefd6c66b..b84411e8a8 100644 --- a/twilio/rest/preview/sync/service/sync_list/sync_list_item.py +++ b/twilio/rest/preview/sync/service/sync_list/sync_list_item.py @@ -415,11 +415,10 @@ def create(self, data: object) -> SyncListItemInstance: "Data": serialize.object(data), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SyncListItemInstance( @@ -443,11 +442,10 @@ async def create_async(self, data: object) -> SyncListItemInstance: "Data": serialize.object(data), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SyncListItemInstance( diff --git a/twilio/rest/preview/sync/service/sync_map/__init__.py b/twilio/rest/preview/sync/service/sync_map/__init__.py index 1d79936240..19c29f3267 100644 --- a/twilio/rest/preview/sync/service/sync_map/__init__.py +++ b/twilio/rest/preview/sync/service/sync_map/__init__.py @@ -321,11 +321,10 @@ def create(self, unique_name: Union[str, object] = values.unset) -> SyncMapInsta "UniqueName": unique_name, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SyncMapInstance( @@ -348,11 +347,10 @@ async def create_async( "UniqueName": unique_name, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SyncMapInstance( diff --git a/twilio/rest/preview/sync/service/sync_map/sync_map_item.py b/twilio/rest/preview/sync/service/sync_map/sync_map_item.py index 322c8ed225..78682fe588 100644 --- a/twilio/rest/preview/sync/service/sync_map/sync_map_item.py +++ b/twilio/rest/preview/sync/service/sync_map/sync_map_item.py @@ -417,11 +417,10 @@ def create(self, key: str, data: object) -> SyncMapItemInstance: "Data": serialize.object(data), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SyncMapItemInstance( @@ -447,11 +446,10 @@ async def create_async(self, key: str, data: object) -> SyncMapItemInstance: "Data": serialize.object(data), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SyncMapItemInstance( diff --git a/twilio/rest/preview/wireless/command.py b/twilio/rest/preview/wireless/command.py index 755256bb6b..b91d1969e8 100644 --- a/twilio/rest/preview/wireless/command.py +++ b/twilio/rest/preview/wireless/command.py @@ -238,11 +238,10 @@ def create( "IncludeSid": include_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CommandInstance(self._version, payload) @@ -282,11 +281,10 @@ async def create_async( "IncludeSid": include_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CommandInstance(self._version, payload) diff --git a/twilio/rest/preview/wireless/rate_plan.py b/twilio/rest/preview/wireless/rate_plan.py index f3484efa66..b9ca020da6 100644 --- a/twilio/rest/preview/wireless/rate_plan.py +++ b/twilio/rest/preview/wireless/rate_plan.py @@ -395,11 +395,10 @@ def create( ), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RatePlanInstance(self._version, payload) @@ -452,11 +451,10 @@ async def create_async( ), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RatePlanInstance(self._version, payload) diff --git a/twilio/rest/proxy/v1/service/__init__.py b/twilio/rest/proxy/v1/service/__init__.py index 6be2def24c..7337294a6c 100644 --- a/twilio/rest/proxy/v1/service/__init__.py +++ b/twilio/rest/proxy/v1/service/__init__.py @@ -548,11 +548,10 @@ def create( "ChatInstanceSid": chat_instance_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload) @@ -597,11 +596,10 @@ async def create_async( "ChatInstanceSid": chat_instance_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload) diff --git a/twilio/rest/proxy/v1/service/phone_number.py b/twilio/rest/proxy/v1/service/phone_number.py index 366b9ba11f..05b9033602 100644 --- a/twilio/rest/proxy/v1/service/phone_number.py +++ b/twilio/rest/proxy/v1/service/phone_number.py @@ -375,11 +375,10 @@ def create( "IsReserved": serialize.boolean_to_string(is_reserved), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return PhoneNumberInstance( @@ -409,11 +408,10 @@ async def create_async( "IsReserved": serialize.boolean_to_string(is_reserved), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return PhoneNumberInstance( diff --git a/twilio/rest/proxy/v1/service/session/__init__.py b/twilio/rest/proxy/v1/service/session/__init__.py index 26ff177889..cfd547b1e7 100644 --- a/twilio/rest/proxy/v1/service/session/__init__.py +++ b/twilio/rest/proxy/v1/service/session/__init__.py @@ -486,11 +486,10 @@ def create( ), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SessionInstance( @@ -531,11 +530,10 @@ async def create_async( ), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SessionInstance( diff --git a/twilio/rest/proxy/v1/service/session/participant/__init__.py b/twilio/rest/proxy/v1/service/session/participant/__init__.py index 266396f08f..e2eb3eaae8 100644 --- a/twilio/rest/proxy/v1/service/session/participant/__init__.py +++ b/twilio/rest/proxy/v1/service/session/participant/__init__.py @@ -340,11 +340,10 @@ def create( "ProxyIdentifierSid": proxy_identifier_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ParticipantInstance( @@ -380,11 +379,10 @@ async def create_async( "ProxyIdentifierSid": proxy_identifier_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ParticipantInstance( diff --git a/twilio/rest/proxy/v1/service/session/participant/message_interaction.py b/twilio/rest/proxy/v1/service/session/participant/message_interaction.py index b260b4693f..55ff64074e 100644 --- a/twilio/rest/proxy/v1/service/session/participant/message_interaction.py +++ b/twilio/rest/proxy/v1/service/session/participant/message_interaction.py @@ -332,11 +332,10 @@ def create( "MediaUrl": serialize.map(media_url, lambda e: e), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return MessageInteractionInstance( @@ -367,11 +366,10 @@ async def create_async( "MediaUrl": serialize.map(media_url, lambda e: e), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return MessageInteractionInstance( diff --git a/twilio/rest/proxy/v1/service/short_code.py b/twilio/rest/proxy/v1/service/short_code.py index 712d6f82fa..e26514bff2 100644 --- a/twilio/rest/proxy/v1/service/short_code.py +++ b/twilio/rest/proxy/v1/service/short_code.py @@ -360,11 +360,10 @@ def create(self, sid: str) -> ShortCodeInstance: "Sid": sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ShortCodeInstance( @@ -385,11 +384,10 @@ async def create_async(self, sid: str) -> ShortCodeInstance: "Sid": sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ShortCodeInstance( diff --git a/twilio/rest/serverless/v1/service/__init__.py b/twilio/rest/serverless/v1/service/__init__.py index 0fe404c8f1..1658e671f4 100644 --- a/twilio/rest/serverless/v1/service/__init__.py +++ b/twilio/rest/serverless/v1/service/__init__.py @@ -460,11 +460,10 @@ def create( "UiEditable": serialize.boolean_to_string(ui_editable), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload) @@ -495,11 +494,10 @@ async def create_async( "UiEditable": serialize.boolean_to_string(ui_editable), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload) diff --git a/twilio/rest/serverless/v1/service/asset/__init__.py b/twilio/rest/serverless/v1/service/asset/__init__.py index 2049c9d46b..4e413db1da 100644 --- a/twilio/rest/serverless/v1/service/asset/__init__.py +++ b/twilio/rest/serverless/v1/service/asset/__init__.py @@ -371,11 +371,10 @@ def create(self, friendly_name: str) -> AssetInstance: "FriendlyName": friendly_name, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AssetInstance( @@ -396,11 +395,10 @@ async def create_async(self, friendly_name: str) -> AssetInstance: "FriendlyName": friendly_name, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AssetInstance( diff --git a/twilio/rest/serverless/v1/service/build/__init__.py b/twilio/rest/serverless/v1/service/build/__init__.py index fa7a7947ac..90e5ccec41 100644 --- a/twilio/rest/serverless/v1/service/build/__init__.py +++ b/twilio/rest/serverless/v1/service/build/__init__.py @@ -313,10 +313,12 @@ def create(self, asset_versions: Union[List[str], object]=values.unset, function 'Dependencies': dependencies, 'Runtime': runtime, }) + headers = values.of({ + 'Content-Type': 'application/x-www-form-urlencoded' + }) - - payload = self._version.create(method='POST', uri=self._uri, data=data,) + payload = self._version.create(method='POST', uri=self._uri, data=data, headers=headers) return BuildInstance(self._version, payload, service_sid=self._solution['service_sid']) @@ -338,10 +340,12 @@ async def create_async(self, asset_versions: Union[List[str], object]=values.uns 'Dependencies': dependencies, 'Runtime': runtime, }) + headers = values.of({ + 'Content-Type': 'application/x-www-form-urlencoded' + }) - - payload = await self._version.create_async(method='POST', uri=self._uri, data=data,) + payload = await self._version.create_async(method='POST', uri=self._uri, data=data, headers=headers) return BuildInstance(self._version, payload, service_sid=self._solution['service_sid']) diff --git a/twilio/rest/serverless/v1/service/environment/__init__.py b/twilio/rest/serverless/v1/service/environment/__init__.py index 46b7ddacf4..e9df6ecb2a 100644 --- a/twilio/rest/serverless/v1/service/environment/__init__.py +++ b/twilio/rest/serverless/v1/service/environment/__init__.py @@ -349,11 +349,10 @@ def create( "DomainSuffix": domain_suffix, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return EnvironmentInstance( @@ -378,11 +377,10 @@ async def create_async( "DomainSuffix": domain_suffix, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return EnvironmentInstance( diff --git a/twilio/rest/serverless/v1/service/environment/deployment.py b/twilio/rest/serverless/v1/service/environment/deployment.py index 1ff896f93a..63ef1b4610 100644 --- a/twilio/rest/serverless/v1/service/environment/deployment.py +++ b/twilio/rest/serverless/v1/service/environment/deployment.py @@ -250,11 +250,10 @@ def create( "BuildSid": build_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return DeploymentInstance( @@ -280,11 +279,10 @@ async def create_async( "BuildSid": build_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return DeploymentInstance( diff --git a/twilio/rest/serverless/v1/service/environment/variable.py b/twilio/rest/serverless/v1/service/environment/variable.py index f69c129f81..99027536f3 100644 --- a/twilio/rest/serverless/v1/service/environment/variable.py +++ b/twilio/rest/serverless/v1/service/environment/variable.py @@ -398,11 +398,10 @@ def create(self, key: str, value: str) -> VariableInstance: "Value": value, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return VariableInstance( @@ -428,11 +427,10 @@ async def create_async(self, key: str, value: str) -> VariableInstance: "Value": value, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return VariableInstance( diff --git a/twilio/rest/serverless/v1/service/function/__init__.py b/twilio/rest/serverless/v1/service/function/__init__.py index 71bbad8466..25a3ef935f 100644 --- a/twilio/rest/serverless/v1/service/function/__init__.py +++ b/twilio/rest/serverless/v1/service/function/__init__.py @@ -373,11 +373,10 @@ def create(self, friendly_name: str) -> FunctionInstance: "FriendlyName": friendly_name, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return FunctionInstance( @@ -398,11 +397,10 @@ async def create_async(self, friendly_name: str) -> FunctionInstance: "FriendlyName": friendly_name, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return FunctionInstance( diff --git a/twilio/rest/studio/v1/flow/engagement/__init__.py b/twilio/rest/studio/v1/flow/engagement/__init__.py index f6d95abd5f..db0c846e5c 100644 --- a/twilio/rest/studio/v1/flow/engagement/__init__.py +++ b/twilio/rest/studio/v1/flow/engagement/__init__.py @@ -336,11 +336,10 @@ def create( "Parameters": serialize.object(parameters), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return EngagementInstance( @@ -367,11 +366,10 @@ async def create_async( "Parameters": serialize.object(parameters), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return EngagementInstance( diff --git a/twilio/rest/studio/v1/flow/execution/__init__.py b/twilio/rest/studio/v1/flow/execution/__init__.py index 57239e5154..6a32cb3020 100644 --- a/twilio/rest/studio/v1/flow/execution/__init__.py +++ b/twilio/rest/studio/v1/flow/execution/__init__.py @@ -416,11 +416,10 @@ def create( "Parameters": serialize.object(parameters), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ExecutionInstance( @@ -447,11 +446,10 @@ async def create_async( "Parameters": serialize.object(parameters), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ExecutionInstance( diff --git a/twilio/rest/studio/v2/flow/__init__.py b/twilio/rest/studio/v2/flow/__init__.py index 21138d29cc..057c949696 100644 --- a/twilio/rest/studio/v2/flow/__init__.py +++ b/twilio/rest/studio/v2/flow/__init__.py @@ -464,11 +464,10 @@ def create( "CommitMessage": commit_message, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return FlowInstance(self._version, payload) @@ -499,11 +498,10 @@ async def create_async( "CommitMessage": commit_message, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return FlowInstance(self._version, payload) diff --git a/twilio/rest/studio/v2/flow/execution/__init__.py b/twilio/rest/studio/v2/flow/execution/__init__.py index 38d3b2b539..18dcbf0629 100644 --- a/twilio/rest/studio/v2/flow/execution/__init__.py +++ b/twilio/rest/studio/v2/flow/execution/__init__.py @@ -414,11 +414,10 @@ def create( "Parameters": serialize.object(parameters), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ExecutionInstance( @@ -445,11 +444,10 @@ async def create_async( "Parameters": serialize.object(parameters), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ExecutionInstance( diff --git a/twilio/rest/studio/v2/flow_validate.py b/twilio/rest/studio/v2/flow_validate.py index 43f226e154..34f37e152f 100644 --- a/twilio/rest/studio/v2/flow_validate.py +++ b/twilio/rest/studio/v2/flow_validate.py @@ -84,11 +84,10 @@ def update( "CommitMessage": commit_message, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return FlowValidateInstance(self._version, payload) @@ -119,11 +118,10 @@ async def update_async( "CommitMessage": commit_message, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return FlowValidateInstance(self._version, payload) diff --git a/twilio/rest/supersim/v1/esim_profile.py b/twilio/rest/supersim/v1/esim_profile.py index 847bcae33a..7e176bba7f 100644 --- a/twilio/rest/supersim/v1/esim_profile.py +++ b/twilio/rest/supersim/v1/esim_profile.py @@ -244,11 +244,10 @@ def create( "Eid": eid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return EsimProfileInstance(self._version, payload) @@ -279,11 +278,10 @@ async def create_async( "Eid": eid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return EsimProfileInstance(self._version, payload) diff --git a/twilio/rest/supersim/v1/fleet.py b/twilio/rest/supersim/v1/fleet.py index 2003eb77b5..2b9fbff44e 100644 --- a/twilio/rest/supersim/v1/fleet.py +++ b/twilio/rest/supersim/v1/fleet.py @@ -412,11 +412,10 @@ def create( "SmsCommandsMethod": sms_commands_method, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return FleetInstance(self._version, payload) @@ -462,11 +461,10 @@ async def create_async( "SmsCommandsMethod": sms_commands_method, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return FleetInstance(self._version, payload) diff --git a/twilio/rest/supersim/v1/ip_command.py b/twilio/rest/supersim/v1/ip_command.py index b7610efec6..db6ac26432 100644 --- a/twilio/rest/supersim/v1/ip_command.py +++ b/twilio/rest/supersim/v1/ip_command.py @@ -260,11 +260,10 @@ def create( "CallbackMethod": callback_method, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return IpCommandInstance(self._version, payload) @@ -301,11 +300,10 @@ async def create_async( "CallbackMethod": callback_method, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return IpCommandInstance(self._version, payload) diff --git a/twilio/rest/supersim/v1/network_access_profile/__init__.py b/twilio/rest/supersim/v1/network_access_profile/__init__.py index d0b5374699..4937ac50dd 100644 --- a/twilio/rest/supersim/v1/network_access_profile/__init__.py +++ b/twilio/rest/supersim/v1/network_access_profile/__init__.py @@ -319,11 +319,10 @@ def create( "Networks": serialize.map(networks, lambda e: e), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return NetworkAccessProfileInstance(self._version, payload) @@ -348,11 +347,10 @@ async def create_async( "Networks": serialize.map(networks, lambda e: e), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return NetworkAccessProfileInstance(self._version, payload) diff --git a/twilio/rest/supersim/v1/network_access_profile/network_access_profile_network.py b/twilio/rest/supersim/v1/network_access_profile/network_access_profile_network.py index 50a259550d..cbe4d5c0ea 100644 --- a/twilio/rest/supersim/v1/network_access_profile/network_access_profile_network.py +++ b/twilio/rest/supersim/v1/network_access_profile/network_access_profile_network.py @@ -279,11 +279,10 @@ def create(self, network: str) -> NetworkAccessProfileNetworkInstance: "Network": network, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return NetworkAccessProfileNetworkInstance( @@ -306,11 +305,10 @@ async def create_async(self, network: str) -> NetworkAccessProfileNetworkInstanc "Network": network, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return NetworkAccessProfileNetworkInstance( diff --git a/twilio/rest/supersim/v1/sim/__init__.py b/twilio/rest/supersim/v1/sim/__init__.py index b1ba647336..1452f1eac5 100644 --- a/twilio/rest/supersim/v1/sim/__init__.py +++ b/twilio/rest/supersim/v1/sim/__init__.py @@ -413,11 +413,10 @@ def create(self, iccid: str, registration_code: str) -> SimInstance: "RegistrationCode": registration_code, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SimInstance(self._version, payload) @@ -438,11 +437,10 @@ async def create_async(self, iccid: str, registration_code: str) -> SimInstance: "RegistrationCode": registration_code, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SimInstance(self._version, payload) diff --git a/twilio/rest/supersim/v1/sms_command.py b/twilio/rest/supersim/v1/sms_command.py index 0eb2094103..26d39a0bf8 100644 --- a/twilio/rest/supersim/v1/sms_command.py +++ b/twilio/rest/supersim/v1/sms_command.py @@ -239,11 +239,10 @@ def create( "CallbackUrl": callback_url, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SmsCommandInstance(self._version, payload) @@ -274,11 +273,10 @@ async def create_async( "CallbackUrl": callback_url, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SmsCommandInstance(self._version, payload) diff --git a/twilio/rest/sync/v1/service/__init__.py b/twilio/rest/sync/v1/service/__init__.py index 0bf1045f2b..02d4e8f7e0 100644 --- a/twilio/rest/sync/v1/service/__init__.py +++ b/twilio/rest/sync/v1/service/__init__.py @@ -549,11 +549,10 @@ def create( ), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload) @@ -599,11 +598,10 @@ async def create_async( ), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload) diff --git a/twilio/rest/sync/v1/service/document/__init__.py b/twilio/rest/sync/v1/service/document/__init__.py index f3b89cfe67..033f27cf42 100644 --- a/twilio/rest/sync/v1/service/document/__init__.py +++ b/twilio/rest/sync/v1/service/document/__init__.py @@ -432,11 +432,10 @@ def create( "Ttl": ttl, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return DocumentInstance( @@ -466,11 +465,10 @@ async def create_async( "Ttl": ttl, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return DocumentInstance( diff --git a/twilio/rest/sync/v1/service/sync_list/__init__.py b/twilio/rest/sync/v1/service/sync_list/__init__.py index 7e9ca672c4..235fcbd1b9 100644 --- a/twilio/rest/sync/v1/service/sync_list/__init__.py +++ b/twilio/rest/sync/v1/service/sync_list/__init__.py @@ -436,11 +436,10 @@ def create( "CollectionTtl": collection_ttl, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SyncListInstance( @@ -470,11 +469,10 @@ async def create_async( "CollectionTtl": collection_ttl, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SyncListInstance( diff --git a/twilio/rest/sync/v1/service/sync_list/sync_list_item.py b/twilio/rest/sync/v1/service/sync_list/sync_list_item.py index 02dafcd49b..0db046e1a8 100644 --- a/twilio/rest/sync/v1/service/sync_list/sync_list_item.py +++ b/twilio/rest/sync/v1/service/sync_list/sync_list_item.py @@ -475,11 +475,10 @@ def create( "CollectionTtl": collection_ttl, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SyncListItemInstance( @@ -515,11 +514,10 @@ async def create_async( "CollectionTtl": collection_ttl, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SyncListItemInstance( diff --git a/twilio/rest/sync/v1/service/sync_map/__init__.py b/twilio/rest/sync/v1/service/sync_map/__init__.py index 1a68e8ef4d..1c6b5c9a00 100644 --- a/twilio/rest/sync/v1/service/sync_map/__init__.py +++ b/twilio/rest/sync/v1/service/sync_map/__init__.py @@ -436,11 +436,10 @@ def create( "CollectionTtl": collection_ttl, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SyncMapInstance( @@ -470,11 +469,10 @@ async def create_async( "CollectionTtl": collection_ttl, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SyncMapInstance( diff --git a/twilio/rest/sync/v1/service/sync_map/sync_map_item.py b/twilio/rest/sync/v1/service/sync_map/sync_map_item.py index 7c621f8adc..c5381fc592 100644 --- a/twilio/rest/sync/v1/service/sync_map/sync_map_item.py +++ b/twilio/rest/sync/v1/service/sync_map/sync_map_item.py @@ -478,11 +478,10 @@ def create( "CollectionTtl": collection_ttl, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SyncMapItemInstance( @@ -521,11 +520,10 @@ async def create_async( "CollectionTtl": collection_ttl, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SyncMapItemInstance( diff --git a/twilio/rest/sync/v1/service/sync_stream/__init__.py b/twilio/rest/sync/v1/service/sync_stream/__init__.py index aa10d164a6..c9b98ab7d0 100644 --- a/twilio/rest/sync/v1/service/sync_stream/__init__.py +++ b/twilio/rest/sync/v1/service/sync_stream/__init__.py @@ -387,11 +387,10 @@ def create( "Ttl": ttl, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SyncStreamInstance( @@ -418,11 +417,10 @@ async def create_async( "Ttl": ttl, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SyncStreamInstance( diff --git a/twilio/rest/sync/v1/service/sync_stream/stream_message.py b/twilio/rest/sync/v1/service/sync_stream/stream_message.py index 88a7604a7a..baca803f95 100644 --- a/twilio/rest/sync/v1/service/sync_stream/stream_message.py +++ b/twilio/rest/sync/v1/service/sync_stream/stream_message.py @@ -89,11 +89,10 @@ def create(self, data: object) -> StreamMessageInstance: "Data": serialize.object(data), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return StreamMessageInstance( @@ -117,11 +116,10 @@ async def create_async(self, data: object) -> StreamMessageInstance: "Data": serialize.object(data), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return StreamMessageInstance( diff --git a/twilio/rest/taskrouter/v1/workspace/__init__.py b/twilio/rest/taskrouter/v1/workspace/__init__.py index f1202197c4..60085c1186 100644 --- a/twilio/rest/taskrouter/v1/workspace/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/__init__.py @@ -671,11 +671,10 @@ def create( "PrioritizeQueueOrder": prioritize_queue_order, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return WorkspaceInstance(self._version, payload) @@ -714,11 +713,10 @@ async def create_async( "PrioritizeQueueOrder": prioritize_queue_order, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return WorkspaceInstance(self._version, payload) diff --git a/twilio/rest/taskrouter/v1/workspace/activity.py b/twilio/rest/taskrouter/v1/workspace/activity.py index bae49d5efa..e211ef9f72 100644 --- a/twilio/rest/taskrouter/v1/workspace/activity.py +++ b/twilio/rest/taskrouter/v1/workspace/activity.py @@ -364,11 +364,10 @@ def create( "Available": serialize.boolean_to_string(available), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ActivityInstance( @@ -393,11 +392,10 @@ async def create_async( "Available": serialize.boolean_to_string(available), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ActivityInstance( diff --git a/twilio/rest/taskrouter/v1/workspace/task/__init__.py b/twilio/rest/taskrouter/v1/workspace/task/__init__.py index 9d35415ae3..f71c4bd68f 100644 --- a/twilio/rest/taskrouter/v1/workspace/task/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/task/__init__.py @@ -555,11 +555,10 @@ def create( "TaskQueueSid": task_queue_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return TaskInstance( @@ -607,11 +606,10 @@ async def create_async( "TaskQueueSid": task_queue_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return TaskInstance( diff --git a/twilio/rest/taskrouter/v1/workspace/task_channel.py b/twilio/rest/taskrouter/v1/workspace/task_channel.py index 099f85efb1..95a7e5efaf 100644 --- a/twilio/rest/taskrouter/v1/workspace/task_channel.py +++ b/twilio/rest/taskrouter/v1/workspace/task_channel.py @@ -395,11 +395,10 @@ def create( ), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return TaskChannelInstance( @@ -431,11 +430,10 @@ async def create_async( ), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return TaskChannelInstance( diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue/__init__.py b/twilio/rest/taskrouter/v1/workspace/task_queue/__init__.py index 794fd216d3..027cf8dbfc 100644 --- a/twilio/rest/taskrouter/v1/workspace/task_queue/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/task_queue/__init__.py @@ -555,11 +555,10 @@ def create( "AssignmentActivitySid": assignment_activity_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return TaskQueueInstance( @@ -598,11 +597,10 @@ async def create_async( "AssignmentActivitySid": assignment_activity_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return TaskQueueInstance( 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 index a1c44b1644..9ccef45773 100644 --- 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 @@ -92,7 +92,8 @@ def create( """ data = body.to_dict() - headers = {"Content-Type": "application/json"} + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers @@ -114,7 +115,8 @@ async def create_async( """ data = body.to_dict() - headers = {"Content-Type": "application/json"} + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers diff --git a/twilio/rest/taskrouter/v1/workspace/worker/__init__.py b/twilio/rest/taskrouter/v1/workspace/worker/__init__.py index a236fcae8d..8f6ff4c7e1 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/__init__.py @@ -535,11 +535,10 @@ def create( "Attributes": attributes, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return WorkerInstance( @@ -569,11 +568,10 @@ async def create_async( "Attributes": attributes, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return WorkerInstance( diff --git a/twilio/rest/taskrouter/v1/workspace/workflow/__init__.py b/twilio/rest/taskrouter/v1/workspace/workflow/__init__.py index f01e76d379..96d7aabf0e 100644 --- a/twilio/rest/taskrouter/v1/workspace/workflow/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/workflow/__init__.py @@ -526,11 +526,10 @@ def create( "TaskReservationTimeout": task_reservation_timeout, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return WorkflowInstance( @@ -566,11 +565,10 @@ async def create_async( "TaskReservationTimeout": task_reservation_timeout, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return WorkflowInstance( diff --git a/twilio/rest/trunking/v1/trunk/__init__.py b/twilio/rest/trunking/v1/trunk/__init__.py index 16125ead02..b1bfdba117 100644 --- a/twilio/rest/trunking/v1/trunk/__init__.py +++ b/twilio/rest/trunking/v1/trunk/__init__.py @@ -591,11 +591,10 @@ def create( "TransferCallerId": transfer_caller_id, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return TrunkInstance(self._version, payload) @@ -640,11 +639,10 @@ async def create_async( "TransferCallerId": transfer_caller_id, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return TrunkInstance(self._version, payload) diff --git a/twilio/rest/trunking/v1/trunk/credential_list.py b/twilio/rest/trunking/v1/trunk/credential_list.py index 7dc043d286..e04bb30720 100644 --- a/twilio/rest/trunking/v1/trunk/credential_list.py +++ b/twilio/rest/trunking/v1/trunk/credential_list.py @@ -268,11 +268,10 @@ def create(self, credential_list_sid: str) -> CredentialListInstance: "CredentialListSid": credential_list_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CredentialListInstance( @@ -293,11 +292,10 @@ async def create_async(self, credential_list_sid: str) -> CredentialListInstance "CredentialListSid": credential_list_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CredentialListInstance( diff --git a/twilio/rest/trunking/v1/trunk/ip_access_control_list.py b/twilio/rest/trunking/v1/trunk/ip_access_control_list.py index b361e7fe9f..957084cb62 100644 --- a/twilio/rest/trunking/v1/trunk/ip_access_control_list.py +++ b/twilio/rest/trunking/v1/trunk/ip_access_control_list.py @@ -270,11 +270,10 @@ def create(self, ip_access_control_list_sid: str) -> IpAccessControlListInstance "IpAccessControlListSid": ip_access_control_list_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return IpAccessControlListInstance( @@ -297,11 +296,10 @@ async def create_async( "IpAccessControlListSid": ip_access_control_list_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return IpAccessControlListInstance( diff --git a/twilio/rest/trunking/v1/trunk/origination_url.py b/twilio/rest/trunking/v1/trunk/origination_url.py index bcf0c5205f..e8e77180e8 100644 --- a/twilio/rest/trunking/v1/trunk/origination_url.py +++ b/twilio/rest/trunking/v1/trunk/origination_url.py @@ -429,11 +429,10 @@ def create( "SipUrl": sip_url, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return OriginationUrlInstance( @@ -469,11 +468,10 @@ async def create_async( "SipUrl": sip_url, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return OriginationUrlInstance( diff --git a/twilio/rest/trunking/v1/trunk/phone_number.py b/twilio/rest/trunking/v1/trunk/phone_number.py index 7f0adbeef1..75cb5f6c64 100644 --- a/twilio/rest/trunking/v1/trunk/phone_number.py +++ b/twilio/rest/trunking/v1/trunk/phone_number.py @@ -319,11 +319,10 @@ def create(self, phone_number_sid: str) -> PhoneNumberInstance: "PhoneNumberSid": phone_number_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return PhoneNumberInstance( @@ -344,11 +343,10 @@ async def create_async(self, phone_number_sid: str) -> PhoneNumberInstance: "PhoneNumberSid": phone_number_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return PhoneNumberInstance( diff --git a/twilio/rest/trusthub/v1/compliance_inquiries.py b/twilio/rest/trusthub/v1/compliance_inquiries.py index b1b52a4f78..6fe6c297bd 100644 --- a/twilio/rest/trusthub/v1/compliance_inquiries.py +++ b/twilio/rest/trusthub/v1/compliance_inquiries.py @@ -209,11 +209,10 @@ def create( "NotificationEmail": notification_email, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ComplianceInquiriesInstance(self._version, payload) @@ -238,11 +237,10 @@ async def create_async( "NotificationEmail": notification_email, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ComplianceInquiriesInstance(self._version, payload) diff --git a/twilio/rest/trusthub/v1/compliance_registration_inquiries.py b/twilio/rest/trusthub/v1/compliance_registration_inquiries.py index c279bce12b..2f6c465341 100644 --- a/twilio/rest/trusthub/v1/compliance_registration_inquiries.py +++ b/twilio/rest/trusthub/v1/compliance_registration_inquiries.py @@ -378,11 +378,10 @@ def create( "ThemeSetId": theme_set_id, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ComplianceRegistrationInquiriesInstance(self._version, payload) @@ -527,11 +526,10 @@ async def create_async( "ThemeSetId": theme_set_id, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ComplianceRegistrationInquiriesInstance(self._version, payload) diff --git a/twilio/rest/trusthub/v1/compliance_tollfree_inquiries.py b/twilio/rest/trusthub/v1/compliance_tollfree_inquiries.py index 490f68b4e6..4d8988ab41 100644 --- a/twilio/rest/trusthub/v1/compliance_tollfree_inquiries.py +++ b/twilio/rest/trusthub/v1/compliance_tollfree_inquiries.py @@ -93,6 +93,7 @@ def create( business_contact_email: Union[str, object] = values.unset, business_contact_phone: Union[str, object] = values.unset, theme_set_id: Union[str, object] = values.unset, + skip_messaging_use_case: Union[bool, object] = values.unset, ) -> ComplianceTollfreeInquiriesInstance: """ Create the ComplianceTollfreeInquiriesInstance @@ -119,6 +120,7 @@ def create( :param business_contact_email: The email address of the contact for the business or organization using the Tollfree number. :param business_contact_phone: The phone number of the contact for the business or organization using the Tollfree number. :param theme_set_id: Theme id for styling the inquiry form. + :param skip_messaging_use_case: Skip the messaging use case screen of the inquiry form. :returns: The created ComplianceTollfreeInquiriesInstance """ @@ -147,13 +149,15 @@ def create( "BusinessContactEmail": business_contact_email, "BusinessContactPhone": business_contact_phone, "ThemeSetId": theme_set_id, + "SkipMessagingUseCase": serialize.boolean_to_string( + skip_messaging_use_case + ), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ComplianceTollfreeInquiriesInstance(self._version, payload) @@ -184,6 +188,7 @@ async def create_async( business_contact_email: Union[str, object] = values.unset, business_contact_phone: Union[str, object] = values.unset, theme_set_id: Union[str, object] = values.unset, + skip_messaging_use_case: Union[bool, object] = values.unset, ) -> ComplianceTollfreeInquiriesInstance: """ Asynchronously create the ComplianceTollfreeInquiriesInstance @@ -210,6 +215,7 @@ async def create_async( :param business_contact_email: The email address of the contact for the business or organization using the Tollfree number. :param business_contact_phone: The phone number of the contact for the business or organization using the Tollfree number. :param theme_set_id: Theme id for styling the inquiry form. + :param skip_messaging_use_case: Skip the messaging use case screen of the inquiry form. :returns: The created ComplianceTollfreeInquiriesInstance """ @@ -238,13 +244,15 @@ async def create_async( "BusinessContactEmail": business_contact_email, "BusinessContactPhone": business_contact_phone, "ThemeSetId": theme_set_id, + "SkipMessagingUseCase": serialize.boolean_to_string( + skip_messaging_use_case + ), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ComplianceTollfreeInquiriesInstance(self._version, payload) diff --git a/twilio/rest/trusthub/v1/customer_profiles/__init__.py b/twilio/rest/trusthub/v1/customer_profiles/__init__.py index 5365092777..5079b89e6d 100644 --- a/twilio/rest/trusthub/v1/customer_profiles/__init__.py +++ b/twilio/rest/trusthub/v1/customer_profiles/__init__.py @@ -493,11 +493,10 @@ def create( "StatusCallback": status_callback, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CustomerProfilesInstance(self._version, payload) @@ -528,11 +527,10 @@ async def create_async( "StatusCallback": status_callback, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CustomerProfilesInstance(self._version, payload) diff --git a/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_channel_endpoint_assignment.py b/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_channel_endpoint_assignment.py index 4cb14c5ccd..0369e51d5c 100644 --- a/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_channel_endpoint_assignment.py +++ b/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_channel_endpoint_assignment.py @@ -282,11 +282,10 @@ def create( "ChannelEndpointSid": channel_endpoint_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CustomerProfilesChannelEndpointAssignmentInstance( @@ -313,11 +312,10 @@ async def create_async( "ChannelEndpointSid": channel_endpoint_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CustomerProfilesChannelEndpointAssignmentInstance( diff --git a/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_entity_assignments.py b/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_entity_assignments.py index 5a19ccaabe..8fbb523b8a 100644 --- a/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_entity_assignments.py +++ b/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_entity_assignments.py @@ -282,11 +282,10 @@ def create(self, object_sid: str) -> CustomerProfilesEntityAssignmentsInstance: "ObjectSid": object_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CustomerProfilesEntityAssignmentsInstance( @@ -311,11 +310,10 @@ async def create_async( "ObjectSid": object_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CustomerProfilesEntityAssignmentsInstance( diff --git a/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_evaluations.py b/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_evaluations.py index 60538ee22e..b5c3ba746e 100644 --- a/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_evaluations.py +++ b/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_evaluations.py @@ -245,11 +245,10 @@ def create(self, policy_sid: str) -> CustomerProfilesEvaluationsInstance: "PolicySid": policy_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CustomerProfilesEvaluationsInstance( @@ -274,11 +273,10 @@ async def create_async( "PolicySid": policy_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CustomerProfilesEvaluationsInstance( diff --git a/twilio/rest/trusthub/v1/end_user.py b/twilio/rest/trusthub/v1/end_user.py index b8b08d65ca..42bdb155e0 100644 --- a/twilio/rest/trusthub/v1/end_user.py +++ b/twilio/rest/trusthub/v1/end_user.py @@ -354,11 +354,10 @@ def create( "Attributes": serialize.object(attributes), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return EndUserInstance(self._version, payload) @@ -386,11 +385,10 @@ async def create_async( "Attributes": serialize.object(attributes), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return EndUserInstance(self._version, payload) diff --git a/twilio/rest/trusthub/v1/supporting_document.py b/twilio/rest/trusthub/v1/supporting_document.py index a18293fd8e..2336e1fefa 100644 --- a/twilio/rest/trusthub/v1/supporting_document.py +++ b/twilio/rest/trusthub/v1/supporting_document.py @@ -373,11 +373,10 @@ def create( "Attributes": serialize.object(attributes), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SupportingDocumentInstance(self._version, payload) @@ -405,11 +404,10 @@ async def create_async( "Attributes": serialize.object(attributes), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SupportingDocumentInstance(self._version, payload) diff --git a/twilio/rest/trusthub/v1/trust_products/__init__.py b/twilio/rest/trusthub/v1/trust_products/__init__.py index 35f233cc7a..c819eb0a07 100644 --- a/twilio/rest/trusthub/v1/trust_products/__init__.py +++ b/twilio/rest/trusthub/v1/trust_products/__init__.py @@ -483,11 +483,10 @@ def create( "StatusCallback": status_callback, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return TrustProductsInstance(self._version, payload) @@ -518,11 +517,10 @@ async def create_async( "StatusCallback": status_callback, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return TrustProductsInstance(self._version, payload) diff --git a/twilio/rest/trusthub/v1/trust_products/trust_products_channel_endpoint_assignment.py b/twilio/rest/trusthub/v1/trust_products/trust_products_channel_endpoint_assignment.py index ef2b589ffb..df69d31ddf 100644 --- a/twilio/rest/trusthub/v1/trust_products/trust_products_channel_endpoint_assignment.py +++ b/twilio/rest/trusthub/v1/trust_products/trust_products_channel_endpoint_assignment.py @@ -284,11 +284,10 @@ def create( "ChannelEndpointSid": channel_endpoint_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return TrustProductsChannelEndpointAssignmentInstance( @@ -315,11 +314,10 @@ async def create_async( "ChannelEndpointSid": channel_endpoint_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return TrustProductsChannelEndpointAssignmentInstance( diff --git a/twilio/rest/trusthub/v1/trust_products/trust_products_entity_assignments.py b/twilio/rest/trusthub/v1/trust_products/trust_products_entity_assignments.py index 16f07a8927..57e1b3119c 100644 --- a/twilio/rest/trusthub/v1/trust_products/trust_products_entity_assignments.py +++ b/twilio/rest/trusthub/v1/trust_products/trust_products_entity_assignments.py @@ -276,11 +276,10 @@ def create(self, object_sid: str) -> TrustProductsEntityAssignmentsInstance: "ObjectSid": object_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return TrustProductsEntityAssignmentsInstance( @@ -305,11 +304,10 @@ async def create_async( "ObjectSid": object_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return TrustProductsEntityAssignmentsInstance( diff --git a/twilio/rest/trusthub/v1/trust_products/trust_products_evaluations.py b/twilio/rest/trusthub/v1/trust_products/trust_products_evaluations.py index dfb929bac0..3088a2b1b4 100644 --- a/twilio/rest/trusthub/v1/trust_products/trust_products_evaluations.py +++ b/twilio/rest/trusthub/v1/trust_products/trust_products_evaluations.py @@ -241,11 +241,10 @@ def create(self, policy_sid: str) -> TrustProductsEvaluationsInstance: "PolicySid": policy_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return TrustProductsEvaluationsInstance( @@ -268,11 +267,10 @@ async def create_async(self, policy_sid: str) -> TrustProductsEvaluationsInstanc "PolicySid": policy_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return TrustProductsEvaluationsInstance( diff --git a/twilio/rest/verify/v2/safelist.py b/twilio/rest/verify/v2/safelist.py index fb71369fb1..0ee946a342 100644 --- a/twilio/rest/verify/v2/safelist.py +++ b/twilio/rest/verify/v2/safelist.py @@ -221,11 +221,10 @@ def create(self, phone_number: str) -> SafelistInstance: "PhoneNumber": phone_number, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SafelistInstance(self._version, payload) @@ -244,11 +243,10 @@ async def create_async(self, phone_number: str) -> SafelistInstance: "PhoneNumber": phone_number, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SafelistInstance(self._version, payload) diff --git a/twilio/rest/verify/v2/service/__init__.py b/twilio/rest/verify/v2/service/__init__.py index 36d7c1058b..69a6cf853e 100644 --- a/twilio/rest/verify/v2/service/__init__.py +++ b/twilio/rest/verify/v2/service/__init__.py @@ -821,11 +821,10 @@ def create( ), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload) @@ -910,11 +909,10 @@ async def create_async( ), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload) diff --git a/twilio/rest/verify/v2/service/access_token.py b/twilio/rest/verify/v2/service/access_token.py index 0bb888a08f..917abbc965 100644 --- a/twilio/rest/verify/v2/service/access_token.py +++ b/twilio/rest/verify/v2/service/access_token.py @@ -228,11 +228,10 @@ def create( "Ttl": ttl, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AccessTokenInstance( @@ -265,11 +264,10 @@ async def create_async( "Ttl": ttl, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AccessTokenInstance( diff --git a/twilio/rest/verify/v2/service/entity/__init__.py b/twilio/rest/verify/v2/service/entity/__init__.py index 41541a4ca6..7371edc08f 100644 --- a/twilio/rest/verify/v2/service/entity/__init__.py +++ b/twilio/rest/verify/v2/service/entity/__init__.py @@ -339,11 +339,10 @@ def create(self, identity: str) -> EntityInstance: "Identity": identity, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return EntityInstance( @@ -364,11 +363,10 @@ async def create_async(self, identity: str) -> EntityInstance: "Identity": identity, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return EntityInstance( diff --git a/twilio/rest/verify/v2/service/entity/challenge/__init__.py b/twilio/rest/verify/v2/service/entity/challenge/__init__.py index ab8c7f8d11..9ca2e4089b 100644 --- a/twilio/rest/verify/v2/service/entity/challenge/__init__.py +++ b/twilio/rest/verify/v2/service/entity/challenge/__init__.py @@ -444,11 +444,10 @@ def create( "AuthPayload": auth_payload, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ChallengeInstance( @@ -492,11 +491,10 @@ async def create_async( "AuthPayload": auth_payload, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ChallengeInstance( diff --git a/twilio/rest/verify/v2/service/entity/challenge/notification.py b/twilio/rest/verify/v2/service/entity/challenge/notification.py index 0cfae0a60f..eadf42b81d 100644 --- a/twilio/rest/verify/v2/service/entity/challenge/notification.py +++ b/twilio/rest/verify/v2/service/entity/challenge/notification.py @@ -112,11 +112,10 @@ def create(self, ttl: Union[int, object] = values.unset) -> NotificationInstance "Ttl": ttl, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return NotificationInstance( @@ -143,11 +142,10 @@ async def create_async( "Ttl": ttl, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return NotificationInstance( diff --git a/twilio/rest/verify/v2/service/entity/new_factor.py b/twilio/rest/verify/v2/service/entity/new_factor.py index 7b260a4a3d..c88a945853 100644 --- a/twilio/rest/verify/v2/service/entity/new_factor.py +++ b/twilio/rest/verify/v2/service/entity/new_factor.py @@ -181,11 +181,10 @@ def create( "Metadata": serialize.object(metadata), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return NewFactorInstance( @@ -253,11 +252,10 @@ async def create_async( "Metadata": serialize.object(metadata), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return NewFactorInstance( diff --git a/twilio/rest/verify/v2/service/messaging_configuration.py b/twilio/rest/verify/v2/service/messaging_configuration.py index f412aba1ee..b841770331 100644 --- a/twilio/rest/verify/v2/service/messaging_configuration.py +++ b/twilio/rest/verify/v2/service/messaging_configuration.py @@ -358,11 +358,10 @@ def create( "MessagingServiceSid": messaging_service_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return MessagingConfigurationInstance( @@ -387,11 +386,10 @@ async def create_async( "MessagingServiceSid": messaging_service_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return MessagingConfigurationInstance( diff --git a/twilio/rest/verify/v2/service/rate_limit/__init__.py b/twilio/rest/verify/v2/service/rate_limit/__init__.py index 2d4a18bf0f..bdd165858a 100644 --- a/twilio/rest/verify/v2/service/rate_limit/__init__.py +++ b/twilio/rest/verify/v2/service/rate_limit/__init__.py @@ -385,11 +385,10 @@ def create( "Description": description, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RateLimitInstance( @@ -414,11 +413,10 @@ async def create_async( "Description": description, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RateLimitInstance( diff --git a/twilio/rest/verify/v2/service/rate_limit/bucket.py b/twilio/rest/verify/v2/service/rate_limit/bucket.py index ca4ffaf775..dee84901e5 100644 --- a/twilio/rest/verify/v2/service/rate_limit/bucket.py +++ b/twilio/rest/verify/v2/service/rate_limit/bucket.py @@ -400,11 +400,10 @@ def create(self, max: int, interval: int) -> BucketInstance: "Interval": interval, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return BucketInstance( @@ -430,11 +429,10 @@ async def create_async(self, max: int, interval: int) -> BucketInstance: "Interval": interval, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return BucketInstance( diff --git a/twilio/rest/verify/v2/service/verification.py b/twilio/rest/verify/v2/service/verification.py index 3ab719551b..c8deef535b 100644 --- a/twilio/rest/verify/v2/service/verification.py +++ b/twilio/rest/verify/v2/service/verification.py @@ -373,11 +373,10 @@ def create( "Tags": tags, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return VerificationInstance( @@ -449,11 +448,10 @@ async def create_async( "Tags": tags, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return VerificationInstance( diff --git a/twilio/rest/verify/v2/service/verification_check.py b/twilio/rest/verify/v2/service/verification_check.py index 9744b1bbab..af216a39f6 100644 --- a/twilio/rest/verify/v2/service/verification_check.py +++ b/twilio/rest/verify/v2/service/verification_check.py @@ -130,11 +130,10 @@ def create( "Payee": payee, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return VerificationCheckInstance( @@ -170,11 +169,10 @@ async def create_async( "Payee": payee, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return VerificationCheckInstance( diff --git a/twilio/rest/verify/v2/service/webhook.py b/twilio/rest/verify/v2/service/webhook.py index 4f8772574c..67ffced265 100644 --- a/twilio/rest/verify/v2/service/webhook.py +++ b/twilio/rest/verify/v2/service/webhook.py @@ -446,11 +446,10 @@ def create( "Version": version, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return WebhookInstance( @@ -486,11 +485,10 @@ async def create_async( "Version": version, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return WebhookInstance( diff --git a/twilio/rest/video/v1/composition.py b/twilio/rest/video/v1/composition.py index 30aa33fff8..8add1e74e5 100644 --- a/twilio/rest/video/v1/composition.py +++ b/twilio/rest/video/v1/composition.py @@ -328,11 +328,10 @@ def create( "Trim": serialize.boolean_to_string(trim), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CompositionInstance(self._version, payload) @@ -380,11 +379,10 @@ async def create_async( "Trim": serialize.boolean_to_string(trim), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CompositionInstance(self._version, payload) diff --git a/twilio/rest/video/v1/composition_hook.py b/twilio/rest/video/v1/composition_hook.py index 027a27f740..0f833f793f 100644 --- a/twilio/rest/video/v1/composition_hook.py +++ b/twilio/rest/video/v1/composition_hook.py @@ -504,11 +504,10 @@ def create( "Trim": serialize.boolean_to_string(trim), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CompositionHookInstance(self._version, payload) @@ -559,11 +558,10 @@ async def create_async( "Trim": serialize.boolean_to_string(trim), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CompositionHookInstance(self._version, payload) diff --git a/twilio/rest/video/v1/room/__init__.py b/twilio/rest/video/v1/room/__init__.py index a8ffdb895c..c735e5516f 100644 --- a/twilio/rest/video/v1/room/__init__.py +++ b/twilio/rest/video/v1/room/__init__.py @@ -456,11 +456,10 @@ def create( "LargeRoom": serialize.boolean_to_string(large_room), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RoomInstance(self._version, payload) @@ -526,11 +525,10 @@ async def create_async( "LargeRoom": serialize.boolean_to_string(large_room), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RoomInstance(self._version, payload) diff --git a/twilio/rest/video/v1/room/participant/subscribe_rules.py b/twilio/rest/video/v1/room/participant/subscribe_rules.py index e07d3b5ff9..a155038493 100644 --- a/twilio/rest/video/v1/room/participant/subscribe_rules.py +++ b/twilio/rest/video/v1/room/participant/subscribe_rules.py @@ -95,8 +95,9 @@ def fetch(self) -> SubscribeRulesInstance: :returns: The fetched SubscribeRulesInstance """ + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - payload = self._version.fetch(method="GET", uri=self._uri) + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return SubscribeRulesInstance( self._version, @@ -112,8 +113,11 @@ async def fetch_async(self) -> SubscribeRulesInstance: :returns: The fetched SubscribeRulesInstance """ + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - payload = await self._version.fetch_async(method="GET", uri=self._uri) + payload = await self._version.fetch_async( + method="GET", uri=self._uri, headers=headers + ) return SubscribeRulesInstance( self._version, @@ -138,11 +142,10 @@ def update( "Rules": serialize.object(rules), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SubscribeRulesInstance( @@ -168,11 +171,10 @@ async def update_async( "Rules": serialize.object(rules), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SubscribeRulesInstance( diff --git a/twilio/rest/video/v1/room/recording_rules.py b/twilio/rest/video/v1/room/recording_rules.py index c94bbf1497..f85ebe896e 100644 --- a/twilio/rest/video/v1/room/recording_rules.py +++ b/twilio/rest/video/v1/room/recording_rules.py @@ -80,8 +80,9 @@ def fetch(self) -> RecordingRulesInstance: :returns: The fetched RecordingRulesInstance """ + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - payload = self._version.fetch(method="GET", uri=self._uri) + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return RecordingRulesInstance( self._version, payload, room_sid=self._solution["room_sid"] @@ -94,8 +95,11 @@ async def fetch_async(self) -> RecordingRulesInstance: :returns: The fetched RecordingRulesInstance """ + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - payload = await self._version.fetch_async(method="GET", uri=self._uri) + payload = await self._version.fetch_async( + method="GET", uri=self._uri, headers=headers + ) return RecordingRulesInstance( self._version, payload, room_sid=self._solution["room_sid"] @@ -117,11 +121,10 @@ def update( "Rules": serialize.object(rules), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RecordingRulesInstance( @@ -144,11 +147,10 @@ async def update_async( "Rules": serialize.object(rules), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RecordingRulesInstance( diff --git a/twilio/rest/voice/v1/byoc_trunk.py b/twilio/rest/voice/v1/byoc_trunk.py index a85cae660a..1c3e301d7a 100644 --- a/twilio/rest/voice/v1/byoc_trunk.py +++ b/twilio/rest/voice/v1/byoc_trunk.py @@ -487,11 +487,10 @@ def create( "FromDomainSid": from_domain_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ByocTrunkInstance(self._version, payload) @@ -540,11 +539,10 @@ async def create_async( "FromDomainSid": from_domain_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ByocTrunkInstance(self._version, payload) diff --git a/twilio/rest/voice/v1/connection_policy/__init__.py b/twilio/rest/voice/v1/connection_policy/__init__.py index d1d8aac893..4e65be6519 100644 --- a/twilio/rest/voice/v1/connection_policy/__init__.py +++ b/twilio/rest/voice/v1/connection_policy/__init__.py @@ -357,11 +357,10 @@ def create( "FriendlyName": friendly_name, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ConnectionPolicyInstance(self._version, payload) @@ -382,11 +381,10 @@ async def create_async( "FriendlyName": friendly_name, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ConnectionPolicyInstance(self._version, payload) diff --git a/twilio/rest/voice/v1/connection_policy/connection_policy_target.py b/twilio/rest/voice/v1/connection_policy/connection_policy_target.py index 2fa490880a..05daee6c79 100644 --- a/twilio/rest/voice/v1/connection_policy/connection_policy_target.py +++ b/twilio/rest/voice/v1/connection_policy/connection_policy_target.py @@ -435,11 +435,10 @@ def create( "Enabled": serialize.boolean_to_string(enabled), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ConnectionPolicyTargetInstance( @@ -477,11 +476,10 @@ async def create_async( "Enabled": serialize.boolean_to_string(enabled), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ConnectionPolicyTargetInstance( diff --git a/twilio/rest/voice/v1/dialing_permissions/bulk_country_update.py b/twilio/rest/voice/v1/dialing_permissions/bulk_country_update.py index 60aa2642f0..5b0d35d3d2 100644 --- a/twilio/rest/voice/v1/dialing_permissions/bulk_country_update.py +++ b/twilio/rest/voice/v1/dialing_permissions/bulk_country_update.py @@ -71,11 +71,10 @@ def create(self, update_request: str) -> BulkCountryUpdateInstance: "UpdateRequest": update_request, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return BulkCountryUpdateInstance(self._version, payload) @@ -94,11 +93,10 @@ async def create_async(self, update_request: str) -> BulkCountryUpdateInstance: "UpdateRequest": update_request, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return BulkCountryUpdateInstance(self._version, payload) diff --git a/twilio/rest/voice/v1/ip_record.py b/twilio/rest/voice/v1/ip_record.py index ee409ba78c..5c103bf98e 100644 --- a/twilio/rest/voice/v1/ip_record.py +++ b/twilio/rest/voice/v1/ip_record.py @@ -340,11 +340,10 @@ def create( "CidrPrefixLength": cidr_prefix_length, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return IpRecordInstance(self._version, payload) @@ -372,11 +371,10 @@ async def create_async( "CidrPrefixLength": cidr_prefix_length, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return IpRecordInstance(self._version, payload) diff --git a/twilio/rest/voice/v1/source_ip_mapping.py b/twilio/rest/voice/v1/source_ip_mapping.py index 8a0d4a9126..50e2bbe361 100644 --- a/twilio/rest/voice/v1/source_ip_mapping.py +++ b/twilio/rest/voice/v1/source_ip_mapping.py @@ -325,11 +325,10 @@ def create( "SipDomainSid": sip_domain_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SourceIpMappingInstance(self._version, payload) @@ -352,11 +351,10 @@ async def create_async( "SipDomainSid": sip_domain_sid, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SourceIpMappingInstance(self._version, payload) diff --git a/twilio/rest/wireless/v1/command.py b/twilio/rest/wireless/v1/command.py index f310db8918..3dc78e9b8f 100644 --- a/twilio/rest/wireless/v1/command.py +++ b/twilio/rest/wireless/v1/command.py @@ -308,11 +308,10 @@ def create( ), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CommandInstance(self._version, payload) @@ -354,11 +353,10 @@ async def create_async( ), } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CommandInstance(self._version, payload) diff --git a/twilio/rest/wireless/v1/rate_plan.py b/twilio/rest/wireless/v1/rate_plan.py index 0ee1e205a2..5370ef2ae3 100644 --- a/twilio/rest/wireless/v1/rate_plan.py +++ b/twilio/rest/wireless/v1/rate_plan.py @@ -406,11 +406,10 @@ def create( "InternationalRoamingDataLimit": international_roaming_data_limit, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.create( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RatePlanInstance(self._version, payload) @@ -466,11 +465,10 @@ async def create_async( "InternationalRoamingDataLimit": international_roaming_data_limit, } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RatePlanInstance(self._version, payload) From 1e7cc3917601da3d3a46c830274a48a8427c304d Mon Sep 17 00:00:00 2001 From: Twilio Date: Tue, 18 Jun 2024 17:12:08 +0000 Subject: [PATCH 16/87] Release 9.2.0 --- setup.py | 2 +- twilio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 9d80846085..6f79022049 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name="twilio", - version="9.1.1", + version="9.2.0", description="Twilio API client and TwiML generator", author="Twilio", help_center="https://www.twilio.com/help/contact", diff --git a/twilio/__init__.py b/twilio/__init__.py index 00a5b6d726..f178d17edc 100644 --- a/twilio/__init__.py +++ b/twilio/__init__.py @@ -1,2 +1,2 @@ -__version_info__ = ("9", "1", "1") +__version_info__ = ("9", "2", "0") __version__ = ".".join(__version_info__) From 1a05d02c091fe5d112e7dac2d7cfe65228768b31 Mon Sep 17 00:00:00 2001 From: Twilio Date: Fri, 21 Jun 2024 11:10:55 +0000 Subject: [PATCH 17/87] [Librarian] Regenerated @ 56364e3f3b4f08483045295156a91ba3bd264c7e 7732d46cf642d80c9ec39cf2fab680d67a4f9806 --- CHANGES.md | 6 + twilio/rest/content/v1/content/__init__.py | 475 +++++++++++++++++- .../content/v1/content/approval_create.py | 53 +- .../rest/content/v1/content/approval_fetch.py | 32 +- 4 files changed, 530 insertions(+), 36 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index b76a6331be..bdff147929 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,12 @@ twilio-python Changelog Here you can see the full list of changes between each twilio-python release. +[2024-06-21] Version 9.2.1 +-------------------------- +**Api** +- Add beta feature request managed cert + + [2024-06-18] Version 9.2.0 -------------------------- **Library - Chore** diff --git a/twilio/rest/content/v1/content/__init__.py b/twilio/rest/content/v1/content/__init__.py index 8a1c4212d9..6dd0978f31 100644 --- a/twilio/rest/content/v1/content/__init__.py +++ b/twilio/rest/content/v1/content/__init__.py @@ -25,6 +25,22 @@ class ContentInstance(InstanceResource): + + class AuthenticationActionType(object): + COPY_CODE = "COPY_CODE" + + class CallToActionActionType(object): + URL = "URL" + PHONE_NUMBER = "PHONE_NUMBER" + + class CardActionType(object): + URL = "URL" + PHONE_NUMBER = "PHONE_NUMBER" + QUICK_REPLY = "QUICK_REPLY" + + class QuickReplyActionType(object): + QUICK_REPLY = "QUICK_REPLY" + """ :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. @@ -33,7 +49,7 @@ class ContentInstance(InstanceResource): :ivar friendly_name: A string name used to describe the Content resource. Not visible to the end recipient. :ivar language: Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in. :ivar variables: Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}. - :ivar types: The [Content types](https://www.twilio.com/docs/content/content-types-overview) (e.g. twilio/text) for this Content resource. + :ivar types: The [Content types](https://www.twilio.com/docs/content-api/content-types-overview) (e.g. twilio/text) for this Content resource. :ivar url: The URL of the resource, relative to `https://content.twilio.com`. :ivar links: A list of links related to the Content resource, such as approval_fetch and approval_create """ @@ -275,6 +291,451 @@ def __repr__(self) -> str: class ContentList(ListResource): + class AuthenticationAction(object): + """ + :ivar type: + :ivar copy_code_text: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.type: Optional["ContentInstance.AuthenticationActionType"] = ( + payload.get("type") + ) + self.copy_code_text: Optional[str] = payload.get("copy_code_text") + + def to_dict(self): + return { + "type": self.type.to_dict(), + "copy_code_text": self.copy_code_text, + } + + class CallToActionAction(object): + """ + :ivar type: + :ivar title: + :ivar url: + :ivar phone: + :ivar id: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.type: Optional["ContentInstance.CallToActionActionType"] = payload.get( + "type" + ) + self.title: Optional[str] = payload.get("title") + self.url: Optional[str] = payload.get("url") + self.phone: Optional[str] = payload.get("phone") + self.id: Optional[str] = payload.get("id") + + def to_dict(self): + return { + "type": self.type.to_dict(), + "title": self.title, + "url": self.url, + "phone": self.phone, + "id": self.id, + } + + class CardAction(object): + """ + :ivar type: + :ivar title: + :ivar url: + :ivar phone: + :ivar id: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.type: Optional["ContentInstance.CardActionType"] = payload.get("type") + self.title: Optional[str] = payload.get("title") + self.url: Optional[str] = payload.get("url") + self.phone: Optional[str] = payload.get("phone") + self.id: Optional[str] = payload.get("id") + + def to_dict(self): + return { + "type": self.type.to_dict(), + "title": self.title, + "url": self.url, + "phone": self.phone, + "id": self.id, + } + + class CatalogItem(object): + """ + :ivar id: + :ivar section_title: + :ivar name: + :ivar media_url: + :ivar price: + :ivar description: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.id: Optional[str] = payload.get("id") + self.section_title: Optional[str] = payload.get("section_title") + self.name: Optional[str] = payload.get("name") + self.media_url: Optional[str] = payload.get("media_url") + self.price: Optional[float] = payload.get("price") + self.description: Optional[str] = payload.get("description") + + def to_dict(self): + return { + "id": self.id, + "section_title": self.section_title, + "name": self.name, + "media_url": self.media_url, + "price": self.price, + "description": self.description, + } + + class ContentCreateRequest(object): + """ + :ivar friendly_name: User defined name of the content + :ivar variables: Key value pairs of variable name to value + :ivar language: Language code for the content + :ivar types: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.variables: Optional[dict[str, str]] = payload.get("variables") + self.language: Optional[str] = payload.get("language") + self.types: Optional[ContentList.Types] = payload.get("types") + + def to_dict(self): + return { + "friendly_name": self.friendly_name, + "variables": self.variables, + "language": self.language, + "types": self.types.to_dict(), + } + + class ListItem(object): + """ + :ivar id: + :ivar item: + :ivar description: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.id: Optional[str] = payload.get("id") + self.item: Optional[str] = payload.get("item") + self.description: Optional[str] = payload.get("description") + + def to_dict(self): + return { + "id": self.id, + "item": self.item, + "description": self.description, + } + + class QuickReplyAction(object): + """ + :ivar type: + :ivar title: + :ivar id: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.type: Optional["ContentInstance.QuickReplyActionType"] = payload.get( + "type" + ) + self.title: Optional[str] = payload.get("title") + self.id: Optional[str] = payload.get("id") + + def to_dict(self): + return { + "type": self.type.to_dict(), + "title": self.title, + "id": self.id, + } + + class TwilioCallToAction(object): + """ + :ivar body: + :ivar actions: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.body: Optional[str] = payload.get("body") + self.actions: Optional[List[ContentList.CallToActionAction]] = payload.get( + "actions" + ) + + def to_dict(self): + return { + "body": self.body, + "actions": [actions.to_dict() for actions in self.actions], + } + + class TwilioCard(object): + """ + :ivar title: + :ivar subtitle: + :ivar media: + :ivar actions: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.title: Optional[str] = payload.get("title") + self.subtitle: Optional[str] = payload.get("subtitle") + self.media: Optional[List[str]] = payload.get("media") + self.actions: Optional[List[ContentList.CardAction]] = payload.get( + "actions" + ) + + def to_dict(self): + return { + "title": self.title, + "subtitle": self.subtitle, + "media": self.media, + "actions": [actions.to_dict() for actions in self.actions], + } + + class TwilioCatalog(object): + """ + :ivar title: + :ivar body: + :ivar subtitle: + :ivar id: + :ivar items: + :ivar dynamic_items: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.title: Optional[str] = payload.get("title") + self.body: Optional[str] = payload.get("body") + self.subtitle: Optional[str] = payload.get("subtitle") + self.id: Optional[str] = payload.get("id") + self.items: Optional[List[ContentList.CatalogItem]] = payload.get("items") + self.dynamic_items: Optional[str] = payload.get("dynamic_items") + + def to_dict(self): + return { + "title": self.title, + "body": self.body, + "subtitle": self.subtitle, + "id": self.id, + "items": [items.to_dict() for items in self.items], + "dynamic_items": self.dynamic_items, + } + + class TwilioListPicker(object): + """ + :ivar body: + :ivar button: + :ivar items: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.body: Optional[str] = payload.get("body") + self.button: Optional[str] = payload.get("button") + self.items: Optional[List[ContentList.ListItem]] = payload.get("items") + + def to_dict(self): + return { + "body": self.body, + "button": self.button, + "items": [items.to_dict() for items in self.items], + } + + class TwilioLocation(object): + """ + :ivar latitude: + :ivar longitude: + :ivar label: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.latitude: Optional[float] = payload.get("latitude") + self.longitude: Optional[float] = payload.get("longitude") + self.label: Optional[str] = payload.get("label") + + def to_dict(self): + return { + "latitude": self.latitude, + "longitude": self.longitude, + "label": self.label, + } + + class TwilioMedia(object): + """ + :ivar body: + :ivar media: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.body: Optional[str] = payload.get("body") + self.media: Optional[List[str]] = payload.get("media") + + def to_dict(self): + return { + "body": self.body, + "media": self.media, + } + + class TwilioQuickReply(object): + """ + :ivar body: + :ivar actions: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.body: Optional[str] = payload.get("body") + self.actions: Optional[List[ContentList.QuickReplyAction]] = payload.get( + "actions" + ) + + def to_dict(self): + return { + "body": self.body, + "actions": [actions.to_dict() for actions in self.actions], + } + + class TwilioText(object): + """ + :ivar body: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.body: Optional[str] = payload.get("body") + + def to_dict(self): + return { + "body": self.body, + } + + class Types(object): + """ + :ivar twilio_text: + :ivar twilio_media: + :ivar twilio_location: + :ivar twilio_list_picker: + :ivar twilio_call_to_action: + :ivar twilio_quick_reply: + :ivar twilio_card: + :ivar twilio_catalog: + :ivar whatsapp_card: + :ivar whatsapp_authentication: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.twilio_text: Optional[ContentList.TwilioText] = payload.get( + "twilio_text" + ) + self.twilio_media: Optional[ContentList.TwilioMedia] = payload.get( + "twilio_media" + ) + self.twilio_location: Optional[ContentList.TwilioLocation] = payload.get( + "twilio_location" + ) + self.twilio_list_picker: Optional[ContentList.TwilioListPicker] = ( + payload.get("twilio_list_picker") + ) + self.twilio_call_to_action: Optional[ContentList.TwilioCallToAction] = ( + payload.get("twilio_call_to_action") + ) + self.twilio_quick_reply: Optional[ContentList.TwilioQuickReply] = ( + payload.get("twilio_quick_reply") + ) + self.twilio_card: Optional[ContentList.TwilioCard] = payload.get( + "twilio_card" + ) + self.twilio_catalog: Optional[ContentList.TwilioCatalog] = payload.get( + "twilio_catalog" + ) + self.whatsapp_card: Optional[ContentList.WhatsappCard] = payload.get( + "whatsapp_card" + ) + self.whatsapp_authentication: Optional[ + ContentList.WhatsappAuthentication + ] = payload.get("whatsapp_authentication") + + def to_dict(self): + return { + "twilio_text": self.twilio_text.to_dict(), + "twilio_media": self.twilio_media.to_dict(), + "twilio_location": self.twilio_location.to_dict(), + "twilio_list_picker": self.twilio_list_picker.to_dict(), + "twilio_call_to_action": self.twilio_call_to_action.to_dict(), + "twilio_quick_reply": self.twilio_quick_reply.to_dict(), + "twilio_card": self.twilio_card.to_dict(), + "twilio_catalog": self.twilio_catalog.to_dict(), + "whatsapp_card": self.whatsapp_card.to_dict(), + "whatsapp_authentication": self.whatsapp_authentication.to_dict(), + } + + class WhatsappAuthentication(object): + """ + :ivar add_security_recommendation: + :ivar code_expiration_minutes: + :ivar actions: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.add_security_recommendation: Optional[bool] = payload.get( + "add_security_recommendation" + ) + self.code_expiration_minutes: Optional[float] = payload.get( + "code_expiration_minutes" + ) + self.actions: Optional[List[ContentList.AuthenticationAction]] = ( + payload.get("actions") + ) + + def to_dict(self): + return { + "add_security_recommendation": self.add_security_recommendation, + "code_expiration_minutes": self.code_expiration_minutes, + "actions": [actions.to_dict() for actions in self.actions], + } + + class WhatsappCard(object): + """ + :ivar body: + :ivar footer: + :ivar media: + :ivar header_text: + :ivar actions: + """ + + def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + + self.body: Optional[str] = payload.get("body") + self.footer: Optional[str] = payload.get("footer") + self.media: Optional[List[str]] = payload.get("media") + self.header_text: Optional[str] = payload.get("header_text") + self.actions: Optional[List[ContentList.CardAction]] = payload.get( + "actions" + ) + + def to_dict(self): + return { + "body": self.body, + "footer": self.footer, + "media": self.media, + "header_text": self.header_text, + "actions": [actions.to_dict() for actions in self.actions], + } + def __init__(self, version: Version): """ Initialize the ContentList @@ -286,15 +747,15 @@ def __init__(self, version: Version): self._uri = "/Content" - def create(self, body: Union[object, object] = values.unset) -> ContentInstance: + def create(self, content_create_request: ContentCreateRequest) -> ContentInstance: """ Create the ContentInstance - :param body: + :param content_create_request: :returns: The created ContentInstance """ - data = body.to_dict() + data = content_create_request.to_dict() headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) headers["Content-Type"] = "application/json" @@ -306,16 +767,16 @@ def create(self, body: Union[object, object] = values.unset) -> ContentInstance: return ContentInstance(self._version, payload) async def create_async( - self, body: Union[object, object] = values.unset + self, content_create_request: ContentCreateRequest ) -> ContentInstance: """ Asynchronously create the ContentInstance - :param body: + :param content_create_request: :returns: The created ContentInstance """ - data = body.to_dict() + data = content_create_request.to_dict() headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) headers["Content-Type"] = "application/json" diff --git a/twilio/rest/content/v1/content/approval_create.py b/twilio/rest/content/v1/content/approval_create.py index 137c0a6d0c..6e28052e0d 100644 --- a/twilio/rest/content/v1/content/approval_create.py +++ b/twilio/rest/content/v1/content/approval_create.py @@ -12,7 +12,7 @@ Do not edit the class manually. """ -from typing import Any, Dict, Optional, Union +from typing import Any, Dict, Optional from twilio.base import values from twilio.base.instance_resource import InstanceResource @@ -30,7 +30,7 @@ class ApprovalCreateInstance(InstanceResource): :ivar allow_category_change: """ - def __init__(self, version: Version, payload: Dict[str, Any], sid: str): + def __init__(self, version: Version, payload: Dict[str, Any], content_sid: str): super().__init__(version) self.name: Optional[str] = payload.get("name") @@ -43,7 +43,7 @@ def __init__(self, version: Version, payload: Dict[str, Any], sid: str): ) self._solution = { - "sid": sid, + "content_sid": content_sid, } def __repr__(self) -> str: @@ -58,33 +58,52 @@ def __repr__(self) -> str: class ApprovalCreateList(ListResource): - def __init__(self, version: Version, sid: str): + class ContentApprovalRequest(object): + """ + :ivar name: Name of the template. + :ivar category: A WhatsApp recognized template category. + """ + + def __init__(self, payload: Dict[str, Any], content_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, content_sid: str): """ Initialize the ApprovalCreateList :param version: Version that contains the resource - :param sid: + :param content_sid: """ super().__init__(version) # Path Solution self._solution = { - "sid": sid, + "content_sid": content_sid, } - self._uri = "/Content/{sid}/ApprovalRequests/whatsapp".format(**self._solution) + self._uri = "/Content/{content_sid}/ApprovalRequests/whatsapp".format( + **self._solution + ) def create( - self, body: Union[object, object] = values.unset + self, content_approval_request: ContentApprovalRequest ) -> ApprovalCreateInstance: """ Create the ApprovalCreateInstance - :param body: + :param content_approval_request: :returns: The created ApprovalCreateInstance """ - data = body.to_dict() + data = content_approval_request.to_dict() headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) headers["Content-Type"] = "application/json" @@ -93,19 +112,21 @@ def create( method="POST", uri=self._uri, data=data, headers=headers ) - return ApprovalCreateInstance(self._version, payload, sid=self._solution["sid"]) + return ApprovalCreateInstance( + self._version, payload, content_sid=self._solution["content_sid"] + ) async def create_async( - self, body: Union[object, object] = values.unset + self, content_approval_request: ContentApprovalRequest ) -> ApprovalCreateInstance: """ Asynchronously create the ApprovalCreateInstance - :param body: + :param content_approval_request: :returns: The created ApprovalCreateInstance """ - data = body.to_dict() + data = content_approval_request.to_dict() headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) headers["Content-Type"] = "application/json" @@ -114,7 +135,9 @@ async def create_async( method="POST", uri=self._uri, data=data, headers=headers ) - return ApprovalCreateInstance(self._version, payload, sid=self._solution["sid"]) + return ApprovalCreateInstance( + self._version, payload, content_sid=self._solution["content_sid"] + ) def __repr__(self) -> str: """ diff --git a/twilio/rest/content/v1/content/approval_fetch.py b/twilio/rest/content/v1/content/approval_fetch.py index f35ef6a48f..f679a920a1 100644 --- a/twilio/rest/content/v1/content/approval_fetch.py +++ b/twilio/rest/content/v1/content/approval_fetch.py @@ -27,7 +27,7 @@ class ApprovalFetchInstance(InstanceResource): :ivar url: The URL of the resource, relative to `https://content.twilio.com`. """ - def __init__(self, version: Version, payload: Dict[str, Any], sid: str): + def __init__(self, version: Version, payload: Dict[str, Any], content_sid: str): super().__init__(version) self.sid: Optional[str] = payload.get("sid") @@ -36,7 +36,7 @@ def __init__(self, version: Version, payload: Dict[str, Any], sid: str): self.url: Optional[str] = payload.get("url") self._solution = { - "sid": sid, + "content_sid": content_sid, } self._context: Optional[ApprovalFetchContext] = None @@ -51,7 +51,7 @@ def _proxy(self) -> "ApprovalFetchContext": if self._context is None: self._context = ApprovalFetchContext( self._version, - sid=self._solution["sid"], + content_sid=self._solution["content_sid"], ) return self._context @@ -85,20 +85,20 @@ def __repr__(self) -> str: class ApprovalFetchContext(InstanceContext): - def __init__(self, version: Version, sid: str): + def __init__(self, version: Version, content_sid: str): """ Initialize the ApprovalFetchContext :param version: Version that contains the resource - :param sid: The Twilio-provided string that uniquely identifies the Content resource whose approval information to fetch. + :param content_sid: The Twilio-provided string that uniquely identifies the Content resource whose approval information to fetch. """ super().__init__(version) # Path Solution self._solution = { - "sid": sid, + "content_sid": content_sid, } - self._uri = "/Content/{sid}/ApprovalRequests".format(**self._solution) + self._uri = "/Content/{content_sid}/ApprovalRequests".format(**self._solution) def fetch(self) -> ApprovalFetchInstance: """ @@ -116,7 +116,7 @@ def fetch(self) -> ApprovalFetchInstance: return ApprovalFetchInstance( self._version, payload, - sid=self._solution["sid"], + content_sid=self._solution["content_sid"], ) async def fetch_async(self) -> ApprovalFetchInstance: @@ -135,7 +135,7 @@ async def fetch_async(self) -> ApprovalFetchInstance: return ApprovalFetchInstance( self._version, payload, - sid=self._solution["sid"], + content_sid=self._solution["content_sid"], ) def __repr__(self) -> str: @@ -150,19 +150,19 @@ def __repr__(self) -> str: class ApprovalFetchList(ListResource): - def __init__(self, version: Version, sid: str): + def __init__(self, version: Version, content_sid: str): """ Initialize the ApprovalFetchList :param version: Version that contains the resource - :param sid: The Twilio-provided string that uniquely identifies the Content resource whose approval information to fetch. + :param content_sid: The Twilio-provided string that uniquely identifies the Content resource whose approval information to fetch. """ super().__init__(version) # Path Solution self._solution = { - "sid": sid, + "content_sid": content_sid, } def get(self) -> ApprovalFetchContext: @@ -170,14 +170,18 @@ def get(self) -> ApprovalFetchContext: Constructs a ApprovalFetchContext """ - return ApprovalFetchContext(self._version, sid=self._solution["sid"]) + return ApprovalFetchContext( + self._version, content_sid=self._solution["content_sid"] + ) def __call__(self) -> ApprovalFetchContext: """ Constructs a ApprovalFetchContext """ - return ApprovalFetchContext(self._version, sid=self._solution["sid"]) + return ApprovalFetchContext( + self._version, content_sid=self._solution["content_sid"] + ) def __repr__(self) -> str: """ From 6c7d08a92d431e9d0f1e40bb6ae92ab890503bea Mon Sep 17 00:00:00 2001 From: Twilio Date: Fri, 21 Jun 2024 11:14:59 +0000 Subject: [PATCH 18/87] Release 9.2.1 --- setup.py | 2 +- twilio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 6f79022049..b7fa3a7cf5 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name="twilio", - version="9.2.0", + version="9.2.1", description="Twilio API client and TwiML generator", author="Twilio", help_center="https://www.twilio.com/help/contact", diff --git a/twilio/__init__.py b/twilio/__init__.py index f178d17edc..f7985b5f36 100644 --- a/twilio/__init__.py +++ b/twilio/__init__.py @@ -1,2 +1,2 @@ -__version_info__ = ("9", "2", "0") +__version_info__ = ("9", "2", "1") __version__ = ".".join(__version_info__) From 4fe254c012bf28616c4f6745440cf3438c101a7c Mon Sep 17 00:00:00 2001 From: Twilio Date: Thu, 27 Jun 2024 19:40:36 +0000 Subject: [PATCH 19/87] [Librarian] Regenerated @ 93a2de5505384cb61be7440d3563d93d5cf980df 5146479cf5e06841f2d634d763cfd8acec49eb7e --- CHANGES.md | 18 + twilio/rest/__init__.py | 15 + .../rest/api/v2010/account/call/__init__.py | 22 + .../api/v2010/account/call/transcription.py | 1605 +++++++++++++++++ twilio/rest/content/v1/content/__init__.py | 8 +- .../rest/content/v1/content/approval_fetch.py | 32 +- .../rest/content/v1/content_and_approvals.py | 2 +- twilio/rest/content/v1/legacy_content.py | 2 +- .../installed_add_on_usage.py | 22 +- .../v2/regulatory_compliance/regulation.py | 66 +- twilio/twiml/voice_response.py | 168 +- 11 files changed, 1899 insertions(+), 61 deletions(-) create mode 100644 twilio/rest/api/v2010/account/call/transcription.py diff --git a/CHANGES.md b/CHANGES.md index bdff147929..1d0111abde 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,24 @@ twilio-python Changelog Here you can see the full list of changes between each twilio-python release. +[2024-06-27] Version 9.2.2 +-------------------------- +**Api** +- Add `transcription` resource + +**Flex** +- Changed mount name for flex_team v2 api + +**Intelligence** +- Add `X-Rate-Limit-Limit`, `X-Rate-Limit-Remaining`, and `X-Rate-Limit-Config` as Response Headers to Operator resources + +**Numbers** +- Added include_constraints query parameter to the Regulations API + +**Twiml** +- Add support for `` noun + + [2024-06-21] Version 9.2.1 -------------------------- **Api** diff --git a/twilio/rest/__init__.py b/twilio/rest/__init__.py index 2dc0a4930f..31d114a6c0 100644 --- a/twilio/rest/__init__.py +++ b/twilio/rest/__init__.py @@ -23,6 +23,7 @@ from twilio.rest.events import Events from twilio.rest.flex_api import FlexApi from twilio.rest.frontline_api import FrontlineApi + from twilio.rest.preview_iam import PreviewIam from twilio.rest.insights import Insights from twilio.rest.intelligence import Intelligence from twilio.rest.ip_messaging import IpMessaging @@ -131,6 +132,7 @@ def __init__( self._events: Optional["Events"] = None self._flex_api: Optional["FlexApi"] = None self._frontline_api: Optional["FrontlineApi"] = None + self._preview_iam: Optional["PreviewIam"] = None self._insights: Optional["Insights"] = None self._intelligence: Optional["Intelligence"] = None self._ip_messaging: Optional["IpMessaging"] = None @@ -275,6 +277,19 @@ def frontline_api(self) -> "FrontlineApi": self._frontline_api = FrontlineApi(self) return self._frontline_api + @property + def preview_iam(self) -> "PreviewIam": + """ + Access the PreviewIam Twilio Domain + + :returns: PreviewIam Twilio Domain + """ + if self._preview_iam is None: + from twilio.rest.preview_iam import PreviewIam + + self._preview_iam = PreviewIam(self) + return self._preview_iam + @property def insights(self) -> "Insights": """ diff --git a/twilio/rest/api/v2010/account/call/__init__.py b/twilio/rest/api/v2010/account/call/__init__.py index fa8e40707b..ff9e98b09f 100644 --- a/twilio/rest/api/v2010/account/call/__init__.py +++ b/twilio/rest/api/v2010/account/call/__init__.py @@ -26,6 +26,7 @@ from twilio.rest.api.v2010.account.call.recording import RecordingList from twilio.rest.api.v2010.account.call.siprec import SiprecList from twilio.rest.api.v2010.account.call.stream import StreamList +from twilio.rest.api.v2010.account.call.transcription import TranscriptionList from twilio.rest.api.v2010.account.call.user_defined_message import ( UserDefinedMessageList, ) @@ -303,6 +304,13 @@ def streams(self) -> StreamList: """ return self._proxy.streams + @property + def transcriptions(self) -> TranscriptionList: + """ + Access the transcriptions + """ + return self._proxy.transcriptions + @property def user_defined_messages(self) -> UserDefinedMessageList: """ @@ -352,6 +360,7 @@ def __init__(self, version: Version, account_sid: str, sid: str): self._recordings: Optional[RecordingList] = None self._siprec: Optional[SiprecList] = None self._streams: Optional[StreamList] = None + self._transcriptions: Optional[TranscriptionList] = None self._user_defined_messages: Optional[UserDefinedMessageList] = None self._user_defined_message_subscriptions: Optional[ UserDefinedMessageSubscriptionList @@ -607,6 +616,19 @@ def streams(self) -> StreamList: ) return self._streams + @property + def transcriptions(self) -> TranscriptionList: + """ + Access the transcriptions + """ + if self._transcriptions is None: + self._transcriptions = TranscriptionList( + self._version, + self._solution["account_sid"], + self._solution["sid"], + ) + return self._transcriptions + @property def user_defined_messages(self) -> UserDefinedMessageList: """ diff --git a/twilio/rest/api/v2010/account/call/transcription.py b/twilio/rest/api/v2010/account/call/transcription.py new file mode 100644 index 0000000000..96554eaa02 --- /dev/null +++ b/twilio/rest/api/v2010/account/call/transcription.py @@ -0,0 +1,1605 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + 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 datetime import datetime +from typing import Any, Dict, Optional, Union +from twilio.base import deserialize, serialize, values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class TranscriptionInstance(InstanceResource): + + class Status(object): + IN_PROGRESS = "in-progress" + STOPPED = "stopped" + + class Track(object): + INBOUND_TRACK = "inbound_track" + OUTBOUND_TRACK = "outbound_track" + BOTH_TRACKS = "both_tracks" + + class UpdateStatus(object): + STOPPED = "stopped" + + """ + :ivar sid: The SID of the Transcription resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Transcription resource. + :ivar call_sid: The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Transcription resource is associated with. + :ivar name: The user-specified name of this Transcription, if one was given when the Transcription was created. This may be used to stop the Transcription. + :ivar status: + :ivar date_updated: The date and time in GMT that this resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar uri: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + account_sid: str, + call_sid: str, + sid: Optional[str] = None, + ): + super().__init__(version) + + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.call_sid: Optional[str] = payload.get("call_sid") + self.name: Optional[str] = payload.get("name") + self.status: Optional["TranscriptionInstance.Status"] = payload.get("status") + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.uri: Optional[str] = payload.get("uri") + + self._solution = { + "account_sid": account_sid, + "call_sid": call_sid, + "sid": sid or self.sid, + } + self._context: Optional[TranscriptionContext] = None + + @property + def _proxy(self) -> "TranscriptionContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: TranscriptionContext for this TranscriptionInstance + """ + if self._context is None: + self._context = TranscriptionContext( + self._version, + account_sid=self._solution["account_sid"], + call_sid=self._solution["call_sid"], + sid=self._solution["sid"], + ) + return self._context + + def update( + self, status: "TranscriptionInstance.UpdateStatus" + ) -> "TranscriptionInstance": + """ + Update the TranscriptionInstance + + :param status: + + :returns: The updated TranscriptionInstance + """ + return self._proxy.update( + status=status, + ) + + async def update_async( + self, status: "TranscriptionInstance.UpdateStatus" + ) -> "TranscriptionInstance": + """ + Asynchronous coroutine to update the TranscriptionInstance + + :param status: + + :returns: The updated TranscriptionInstance + """ + return await self._proxy.update_async( + status=status, + ) + + 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 TranscriptionContext(InstanceContext): + + def __init__(self, version: Version, account_sid: str, call_sid: str, sid: str): + """ + Initialize the TranscriptionContext + + :param version: Version that contains the resource + :param account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Transcription resource. + :param call_sid: The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Transcription resource is associated with. + :param sid: The SID of the Transcription resource, or the `name` used when creating the resource + """ + super().__init__(version) + + # Path Solution + self._solution = { + "account_sid": account_sid, + "call_sid": call_sid, + "sid": sid, + } + self._uri = ( + "/Accounts/{account_sid}/Calls/{call_sid}/Transcriptions/{sid}.json".format( + **self._solution + ) + ) + + def update( + self, status: "TranscriptionInstance.UpdateStatus" + ) -> TranscriptionInstance: + """ + Update the TranscriptionInstance + + :param status: + + :returns: The updated TranscriptionInstance + """ + data = values.of( + { + "Status": status, + } + ) + + payload = self._version.update( + method="POST", + uri=self._uri, + data=data, + ) + + return TranscriptionInstance( + self._version, + payload, + account_sid=self._solution["account_sid"], + call_sid=self._solution["call_sid"], + sid=self._solution["sid"], + ) + + async def update_async( + self, status: "TranscriptionInstance.UpdateStatus" + ) -> TranscriptionInstance: + """ + Asynchronous coroutine to update the TranscriptionInstance + + :param status: + + :returns: The updated TranscriptionInstance + """ + data = values.of( + { + "Status": status, + } + ) + + payload = await self._version.update_async( + method="POST", + uri=self._uri, + data=data, + ) + + return TranscriptionInstance( + self._version, + payload, + account_sid=self._solution["account_sid"], + call_sid=self._solution["call_sid"], + sid=self._solution["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 TranscriptionList(ListResource): + + def __init__(self, version: Version, account_sid: str, call_sid: str): + """ + Initialize the TranscriptionList + + :param version: Version that contains the resource + :param account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Transcription resource. + :param call_sid: The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Transcription resource is associated with. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "account_sid": account_sid, + "call_sid": call_sid, + } + self._uri = ( + "/Accounts/{account_sid}/Calls/{call_sid}/Transcriptions.json".format( + **self._solution + ) + ) + + def create( + self, + name: Union[str, object] = values.unset, + track: Union["TranscriptionInstance.Track", object] = values.unset, + status_callback_url: Union[str, object] = values.unset, + status_callback_method: Union[str, object] = values.unset, + inbound_track_label: Union[str, object] = values.unset, + outbound_track_label: Union[str, object] = values.unset, + partial_results: Union[bool, object] = values.unset, + language_code: Union[str, object] = values.unset, + transcription_engine: Union[str, object] = values.unset, + profanity_filter: Union[bool, object] = values.unset, + speech_model: Union[str, object] = values.unset, + hints: Union[str, object] = values.unset, + enable_automatic_punctuation: Union[bool, object] = values.unset, + parameter1_name: Union[str, object] = values.unset, + parameter1_value: Union[str, object] = values.unset, + parameter2_name: Union[str, object] = values.unset, + parameter2_value: Union[str, object] = values.unset, + parameter3_name: Union[str, object] = values.unset, + parameter3_value: Union[str, object] = values.unset, + parameter4_name: Union[str, object] = values.unset, + parameter4_value: Union[str, object] = values.unset, + parameter5_name: Union[str, object] = values.unset, + parameter5_value: Union[str, object] = values.unset, + parameter6_name: Union[str, object] = values.unset, + parameter6_value: Union[str, object] = values.unset, + parameter7_name: Union[str, object] = values.unset, + parameter7_value: Union[str, object] = values.unset, + parameter8_name: Union[str, object] = values.unset, + parameter8_value: Union[str, object] = values.unset, + parameter9_name: Union[str, object] = values.unset, + parameter9_value: Union[str, object] = values.unset, + parameter10_name: Union[str, object] = values.unset, + parameter10_value: Union[str, object] = values.unset, + parameter11_name: Union[str, object] = values.unset, + parameter11_value: Union[str, object] = values.unset, + parameter12_name: Union[str, object] = values.unset, + parameter12_value: Union[str, object] = values.unset, + parameter13_name: Union[str, object] = values.unset, + parameter13_value: Union[str, object] = values.unset, + parameter14_name: Union[str, object] = values.unset, + parameter14_value: Union[str, object] = values.unset, + parameter15_name: Union[str, object] = values.unset, + parameter15_value: Union[str, object] = values.unset, + parameter16_name: Union[str, object] = values.unset, + parameter16_value: Union[str, object] = values.unset, + parameter17_name: Union[str, object] = values.unset, + parameter17_value: Union[str, object] = values.unset, + parameter18_name: Union[str, object] = values.unset, + parameter18_value: Union[str, object] = values.unset, + parameter19_name: Union[str, object] = values.unset, + parameter19_value: Union[str, object] = values.unset, + parameter20_name: Union[str, object] = values.unset, + parameter20_value: Union[str, object] = values.unset, + parameter21_name: Union[str, object] = values.unset, + parameter21_value: Union[str, object] = values.unset, + parameter22_name: Union[str, object] = values.unset, + parameter22_value: Union[str, object] = values.unset, + parameter23_name: Union[str, object] = values.unset, + parameter23_value: Union[str, object] = values.unset, + parameter24_name: Union[str, object] = values.unset, + parameter24_value: Union[str, object] = values.unset, + parameter25_name: Union[str, object] = values.unset, + parameter25_value: Union[str, object] = values.unset, + parameter26_name: Union[str, object] = values.unset, + parameter26_value: Union[str, object] = values.unset, + parameter27_name: Union[str, object] = values.unset, + parameter27_value: Union[str, object] = values.unset, + parameter28_name: Union[str, object] = values.unset, + parameter28_value: Union[str, object] = values.unset, + parameter29_name: Union[str, object] = values.unset, + parameter29_value: Union[str, object] = values.unset, + parameter30_name: Union[str, object] = values.unset, + parameter30_value: Union[str, object] = values.unset, + parameter31_name: Union[str, object] = values.unset, + parameter31_value: Union[str, object] = values.unset, + parameter32_name: Union[str, object] = values.unset, + parameter32_value: Union[str, object] = values.unset, + parameter33_name: Union[str, object] = values.unset, + parameter33_value: Union[str, object] = values.unset, + parameter34_name: Union[str, object] = values.unset, + parameter34_value: Union[str, object] = values.unset, + parameter35_name: Union[str, object] = values.unset, + parameter35_value: Union[str, object] = values.unset, + parameter36_name: Union[str, object] = values.unset, + parameter36_value: Union[str, object] = values.unset, + parameter37_name: Union[str, object] = values.unset, + parameter37_value: Union[str, object] = values.unset, + parameter38_name: Union[str, object] = values.unset, + parameter38_value: Union[str, object] = values.unset, + parameter39_name: Union[str, object] = values.unset, + parameter39_value: Union[str, object] = values.unset, + parameter40_name: Union[str, object] = values.unset, + parameter40_value: Union[str, object] = values.unset, + parameter41_name: Union[str, object] = values.unset, + parameter41_value: Union[str, object] = values.unset, + parameter42_name: Union[str, object] = values.unset, + parameter42_value: Union[str, object] = values.unset, + parameter43_name: Union[str, object] = values.unset, + parameter43_value: Union[str, object] = values.unset, + parameter44_name: Union[str, object] = values.unset, + parameter44_value: Union[str, object] = values.unset, + parameter45_name: Union[str, object] = values.unset, + parameter45_value: Union[str, object] = values.unset, + parameter46_name: Union[str, object] = values.unset, + parameter46_value: Union[str, object] = values.unset, + parameter47_name: Union[str, object] = values.unset, + parameter47_value: Union[str, object] = values.unset, + parameter48_name: Union[str, object] = values.unset, + parameter48_value: Union[str, object] = values.unset, + parameter49_name: Union[str, object] = values.unset, + parameter49_value: Union[str, object] = values.unset, + parameter50_name: Union[str, object] = values.unset, + parameter50_value: Union[str, object] = values.unset, + parameter51_name: Union[str, object] = values.unset, + parameter51_value: Union[str, object] = values.unset, + parameter52_name: Union[str, object] = values.unset, + parameter52_value: Union[str, object] = values.unset, + parameter53_name: Union[str, object] = values.unset, + parameter53_value: Union[str, object] = values.unset, + parameter54_name: Union[str, object] = values.unset, + parameter54_value: Union[str, object] = values.unset, + parameter55_name: Union[str, object] = values.unset, + parameter55_value: Union[str, object] = values.unset, + parameter56_name: Union[str, object] = values.unset, + parameter56_value: Union[str, object] = values.unset, + parameter57_name: Union[str, object] = values.unset, + parameter57_value: Union[str, object] = values.unset, + parameter58_name: Union[str, object] = values.unset, + parameter58_value: Union[str, object] = values.unset, + parameter59_name: Union[str, object] = values.unset, + parameter59_value: Union[str, object] = values.unset, + parameter60_name: Union[str, object] = values.unset, + parameter60_value: Union[str, object] = values.unset, + parameter61_name: Union[str, object] = values.unset, + parameter61_value: Union[str, object] = values.unset, + parameter62_name: Union[str, object] = values.unset, + parameter62_value: Union[str, object] = values.unset, + parameter63_name: Union[str, object] = values.unset, + parameter63_value: Union[str, object] = values.unset, + parameter64_name: Union[str, object] = values.unset, + parameter64_value: Union[str, object] = values.unset, + parameter65_name: Union[str, object] = values.unset, + parameter65_value: Union[str, object] = values.unset, + parameter66_name: Union[str, object] = values.unset, + parameter66_value: Union[str, object] = values.unset, + parameter67_name: Union[str, object] = values.unset, + parameter67_value: Union[str, object] = values.unset, + parameter68_name: Union[str, object] = values.unset, + parameter68_value: Union[str, object] = values.unset, + parameter69_name: Union[str, object] = values.unset, + parameter69_value: Union[str, object] = values.unset, + parameter70_name: Union[str, object] = values.unset, + parameter70_value: Union[str, object] = values.unset, + parameter71_name: Union[str, object] = values.unset, + parameter71_value: Union[str, object] = values.unset, + parameter72_name: Union[str, object] = values.unset, + parameter72_value: Union[str, object] = values.unset, + parameter73_name: Union[str, object] = values.unset, + parameter73_value: Union[str, object] = values.unset, + parameter74_name: Union[str, object] = values.unset, + parameter74_value: Union[str, object] = values.unset, + parameter75_name: Union[str, object] = values.unset, + parameter75_value: Union[str, object] = values.unset, + parameter76_name: Union[str, object] = values.unset, + parameter76_value: Union[str, object] = values.unset, + parameter77_name: Union[str, object] = values.unset, + parameter77_value: Union[str, object] = values.unset, + parameter78_name: Union[str, object] = values.unset, + parameter78_value: Union[str, object] = values.unset, + parameter79_name: Union[str, object] = values.unset, + parameter79_value: Union[str, object] = values.unset, + parameter80_name: Union[str, object] = values.unset, + parameter80_value: Union[str, object] = values.unset, + parameter81_name: Union[str, object] = values.unset, + parameter81_value: Union[str, object] = values.unset, + parameter82_name: Union[str, object] = values.unset, + parameter82_value: Union[str, object] = values.unset, + parameter83_name: Union[str, object] = values.unset, + parameter83_value: Union[str, object] = values.unset, + parameter84_name: Union[str, object] = values.unset, + parameter84_value: Union[str, object] = values.unset, + parameter85_name: Union[str, object] = values.unset, + parameter85_value: Union[str, object] = values.unset, + parameter86_name: Union[str, object] = values.unset, + parameter86_value: Union[str, object] = values.unset, + parameter87_name: Union[str, object] = values.unset, + parameter87_value: Union[str, object] = values.unset, + parameter88_name: Union[str, object] = values.unset, + parameter88_value: Union[str, object] = values.unset, + parameter89_name: Union[str, object] = values.unset, + parameter89_value: Union[str, object] = values.unset, + parameter90_name: Union[str, object] = values.unset, + parameter90_value: Union[str, object] = values.unset, + parameter91_name: Union[str, object] = values.unset, + parameter91_value: Union[str, object] = values.unset, + parameter92_name: Union[str, object] = values.unset, + parameter92_value: Union[str, object] = values.unset, + parameter93_name: Union[str, object] = values.unset, + parameter93_value: Union[str, object] = values.unset, + parameter94_name: Union[str, object] = values.unset, + parameter94_value: Union[str, object] = values.unset, + parameter95_name: Union[str, object] = values.unset, + parameter95_value: Union[str, object] = values.unset, + parameter96_name: Union[str, object] = values.unset, + parameter96_value: Union[str, object] = values.unset, + parameter97_name: Union[str, object] = values.unset, + parameter97_value: Union[str, object] = values.unset, + parameter98_name: Union[str, object] = values.unset, + parameter98_value: Union[str, object] = values.unset, + parameter99_name: Union[str, object] = values.unset, + parameter99_value: Union[str, object] = values.unset, + ) -> TranscriptionInstance: + """ + Create the TranscriptionInstance + + :param name: The user-specified name of this Transcription, if one was given when the Transcription was created. This may be used to stop the Transcription. + :param track: + :param status_callback_url: Absolute URL of the status callback. + :param status_callback_method: The http method for the status_callback (one of GET, POST). + :param inbound_track_label: Friendly name given to the Inbound Track + :param outbound_track_label: Friendly name given to the Outbound Track + :param partial_results: Indicates if partial results are going to be send to the customer + :param language_code: Language code used by the transcription engine, specified in [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) format + :param transcription_engine: Definition of the transcription engine to be used, between those supported by Twilio + :param profanity_filter: indicates if the server will attempt to filter out profanities, replacing all but the initial character in each filtered word with asterisks + :param speech_model: Recognition model used by the transcription engine, between those supported by the provider + :param hints: A Phrase contains words and phrase \\\"hints\\\" so that the speech recognition engine is more likely to recognize them. + :param enable_automatic_punctuation: The provider will adds punctuation to recognition result hypotheses + :param parameter1_name: Parameter name + :param parameter1_value: Parameter value + :param parameter2_name: Parameter name + :param parameter2_value: Parameter value + :param parameter3_name: Parameter name + :param parameter3_value: Parameter value + :param parameter4_name: Parameter name + :param parameter4_value: Parameter value + :param parameter5_name: Parameter name + :param parameter5_value: Parameter value + :param parameter6_name: Parameter name + :param parameter6_value: Parameter value + :param parameter7_name: Parameter name + :param parameter7_value: Parameter value + :param parameter8_name: Parameter name + :param parameter8_value: Parameter value + :param parameter9_name: Parameter name + :param parameter9_value: Parameter value + :param parameter10_name: Parameter name + :param parameter10_value: Parameter value + :param parameter11_name: Parameter name + :param parameter11_value: Parameter value + :param parameter12_name: Parameter name + :param parameter12_value: Parameter value + :param parameter13_name: Parameter name + :param parameter13_value: Parameter value + :param parameter14_name: Parameter name + :param parameter14_value: Parameter value + :param parameter15_name: Parameter name + :param parameter15_value: Parameter value + :param parameter16_name: Parameter name + :param parameter16_value: Parameter value + :param parameter17_name: Parameter name + :param parameter17_value: Parameter value + :param parameter18_name: Parameter name + :param parameter18_value: Parameter value + :param parameter19_name: Parameter name + :param parameter19_value: Parameter value + :param parameter20_name: Parameter name + :param parameter20_value: Parameter value + :param parameter21_name: Parameter name + :param parameter21_value: Parameter value + :param parameter22_name: Parameter name + :param parameter22_value: Parameter value + :param parameter23_name: Parameter name + :param parameter23_value: Parameter value + :param parameter24_name: Parameter name + :param parameter24_value: Parameter value + :param parameter25_name: Parameter name + :param parameter25_value: Parameter value + :param parameter26_name: Parameter name + :param parameter26_value: Parameter value + :param parameter27_name: Parameter name + :param parameter27_value: Parameter value + :param parameter28_name: Parameter name + :param parameter28_value: Parameter value + :param parameter29_name: Parameter name + :param parameter29_value: Parameter value + :param parameter30_name: Parameter name + :param parameter30_value: Parameter value + :param parameter31_name: Parameter name + :param parameter31_value: Parameter value + :param parameter32_name: Parameter name + :param parameter32_value: Parameter value + :param parameter33_name: Parameter name + :param parameter33_value: Parameter value + :param parameter34_name: Parameter name + :param parameter34_value: Parameter value + :param parameter35_name: Parameter name + :param parameter35_value: Parameter value + :param parameter36_name: Parameter name + :param parameter36_value: Parameter value + :param parameter37_name: Parameter name + :param parameter37_value: Parameter value + :param parameter38_name: Parameter name + :param parameter38_value: Parameter value + :param parameter39_name: Parameter name + :param parameter39_value: Parameter value + :param parameter40_name: Parameter name + :param parameter40_value: Parameter value + :param parameter41_name: Parameter name + :param parameter41_value: Parameter value + :param parameter42_name: Parameter name + :param parameter42_value: Parameter value + :param parameter43_name: Parameter name + :param parameter43_value: Parameter value + :param parameter44_name: Parameter name + :param parameter44_value: Parameter value + :param parameter45_name: Parameter name + :param parameter45_value: Parameter value + :param parameter46_name: Parameter name + :param parameter46_value: Parameter value + :param parameter47_name: Parameter name + :param parameter47_value: Parameter value + :param parameter48_name: Parameter name + :param parameter48_value: Parameter value + :param parameter49_name: Parameter name + :param parameter49_value: Parameter value + :param parameter50_name: Parameter name + :param parameter50_value: Parameter value + :param parameter51_name: Parameter name + :param parameter51_value: Parameter value + :param parameter52_name: Parameter name + :param parameter52_value: Parameter value + :param parameter53_name: Parameter name + :param parameter53_value: Parameter value + :param parameter54_name: Parameter name + :param parameter54_value: Parameter value + :param parameter55_name: Parameter name + :param parameter55_value: Parameter value + :param parameter56_name: Parameter name + :param parameter56_value: Parameter value + :param parameter57_name: Parameter name + :param parameter57_value: Parameter value + :param parameter58_name: Parameter name + :param parameter58_value: Parameter value + :param parameter59_name: Parameter name + :param parameter59_value: Parameter value + :param parameter60_name: Parameter name + :param parameter60_value: Parameter value + :param parameter61_name: Parameter name + :param parameter61_value: Parameter value + :param parameter62_name: Parameter name + :param parameter62_value: Parameter value + :param parameter63_name: Parameter name + :param parameter63_value: Parameter value + :param parameter64_name: Parameter name + :param parameter64_value: Parameter value + :param parameter65_name: Parameter name + :param parameter65_value: Parameter value + :param parameter66_name: Parameter name + :param parameter66_value: Parameter value + :param parameter67_name: Parameter name + :param parameter67_value: Parameter value + :param parameter68_name: Parameter name + :param parameter68_value: Parameter value + :param parameter69_name: Parameter name + :param parameter69_value: Parameter value + :param parameter70_name: Parameter name + :param parameter70_value: Parameter value + :param parameter71_name: Parameter name + :param parameter71_value: Parameter value + :param parameter72_name: Parameter name + :param parameter72_value: Parameter value + :param parameter73_name: Parameter name + :param parameter73_value: Parameter value + :param parameter74_name: Parameter name + :param parameter74_value: Parameter value + :param parameter75_name: Parameter name + :param parameter75_value: Parameter value + :param parameter76_name: Parameter name + :param parameter76_value: Parameter value + :param parameter77_name: Parameter name + :param parameter77_value: Parameter value + :param parameter78_name: Parameter name + :param parameter78_value: Parameter value + :param parameter79_name: Parameter name + :param parameter79_value: Parameter value + :param parameter80_name: Parameter name + :param parameter80_value: Parameter value + :param parameter81_name: Parameter name + :param parameter81_value: Parameter value + :param parameter82_name: Parameter name + :param parameter82_value: Parameter value + :param parameter83_name: Parameter name + :param parameter83_value: Parameter value + :param parameter84_name: Parameter name + :param parameter84_value: Parameter value + :param parameter85_name: Parameter name + :param parameter85_value: Parameter value + :param parameter86_name: Parameter name + :param parameter86_value: Parameter value + :param parameter87_name: Parameter name + :param parameter87_value: Parameter value + :param parameter88_name: Parameter name + :param parameter88_value: Parameter value + :param parameter89_name: Parameter name + :param parameter89_value: Parameter value + :param parameter90_name: Parameter name + :param parameter90_value: Parameter value + :param parameter91_name: Parameter name + :param parameter91_value: Parameter value + :param parameter92_name: Parameter name + :param parameter92_value: Parameter value + :param parameter93_name: Parameter name + :param parameter93_value: Parameter value + :param parameter94_name: Parameter name + :param parameter94_value: Parameter value + :param parameter95_name: Parameter name + :param parameter95_value: Parameter value + :param parameter96_name: Parameter name + :param parameter96_value: Parameter value + :param parameter97_name: Parameter name + :param parameter97_value: Parameter value + :param parameter98_name: Parameter name + :param parameter98_value: Parameter value + :param parameter99_name: Parameter name + :param parameter99_value: Parameter value + + :returns: The created TranscriptionInstance + """ + + data = values.of( + { + "Name": name, + "Track": track, + "StatusCallbackUrl": status_callback_url, + "StatusCallbackMethod": status_callback_method, + "InboundTrackLabel": inbound_track_label, + "OutboundTrackLabel": outbound_track_label, + "PartialResults": serialize.boolean_to_string(partial_results), + "LanguageCode": language_code, + "TranscriptionEngine": transcription_engine, + "ProfanityFilter": serialize.boolean_to_string(profanity_filter), + "SpeechModel": speech_model, + "Hints": hints, + "EnableAutomaticPunctuation": serialize.boolean_to_string( + enable_automatic_punctuation + ), + "Parameter1.Name": parameter1_name, + "Parameter1.Value": parameter1_value, + "Parameter2.Name": parameter2_name, + "Parameter2.Value": parameter2_value, + "Parameter3.Name": parameter3_name, + "Parameter3.Value": parameter3_value, + "Parameter4.Name": parameter4_name, + "Parameter4.Value": parameter4_value, + "Parameter5.Name": parameter5_name, + "Parameter5.Value": parameter5_value, + "Parameter6.Name": parameter6_name, + "Parameter6.Value": parameter6_value, + "Parameter7.Name": parameter7_name, + "Parameter7.Value": parameter7_value, + "Parameter8.Name": parameter8_name, + "Parameter8.Value": parameter8_value, + "Parameter9.Name": parameter9_name, + "Parameter9.Value": parameter9_value, + "Parameter10.Name": parameter10_name, + "Parameter10.Value": parameter10_value, + "Parameter11.Name": parameter11_name, + "Parameter11.Value": parameter11_value, + "Parameter12.Name": parameter12_name, + "Parameter12.Value": parameter12_value, + "Parameter13.Name": parameter13_name, + "Parameter13.Value": parameter13_value, + "Parameter14.Name": parameter14_name, + "Parameter14.Value": parameter14_value, + "Parameter15.Name": parameter15_name, + "Parameter15.Value": parameter15_value, + "Parameter16.Name": parameter16_name, + "Parameter16.Value": parameter16_value, + "Parameter17.Name": parameter17_name, + "Parameter17.Value": parameter17_value, + "Parameter18.Name": parameter18_name, + "Parameter18.Value": parameter18_value, + "Parameter19.Name": parameter19_name, + "Parameter19.Value": parameter19_value, + "Parameter20.Name": parameter20_name, + "Parameter20.Value": parameter20_value, + "Parameter21.Name": parameter21_name, + "Parameter21.Value": parameter21_value, + "Parameter22.Name": parameter22_name, + "Parameter22.Value": parameter22_value, + "Parameter23.Name": parameter23_name, + "Parameter23.Value": parameter23_value, + "Parameter24.Name": parameter24_name, + "Parameter24.Value": parameter24_value, + "Parameter25.Name": parameter25_name, + "Parameter25.Value": parameter25_value, + "Parameter26.Name": parameter26_name, + "Parameter26.Value": parameter26_value, + "Parameter27.Name": parameter27_name, + "Parameter27.Value": parameter27_value, + "Parameter28.Name": parameter28_name, + "Parameter28.Value": parameter28_value, + "Parameter29.Name": parameter29_name, + "Parameter29.Value": parameter29_value, + "Parameter30.Name": parameter30_name, + "Parameter30.Value": parameter30_value, + "Parameter31.Name": parameter31_name, + "Parameter31.Value": parameter31_value, + "Parameter32.Name": parameter32_name, + "Parameter32.Value": parameter32_value, + "Parameter33.Name": parameter33_name, + "Parameter33.Value": parameter33_value, + "Parameter34.Name": parameter34_name, + "Parameter34.Value": parameter34_value, + "Parameter35.Name": parameter35_name, + "Parameter35.Value": parameter35_value, + "Parameter36.Name": parameter36_name, + "Parameter36.Value": parameter36_value, + "Parameter37.Name": parameter37_name, + "Parameter37.Value": parameter37_value, + "Parameter38.Name": parameter38_name, + "Parameter38.Value": parameter38_value, + "Parameter39.Name": parameter39_name, + "Parameter39.Value": parameter39_value, + "Parameter40.Name": parameter40_name, + "Parameter40.Value": parameter40_value, + "Parameter41.Name": parameter41_name, + "Parameter41.Value": parameter41_value, + "Parameter42.Name": parameter42_name, + "Parameter42.Value": parameter42_value, + "Parameter43.Name": parameter43_name, + "Parameter43.Value": parameter43_value, + "Parameter44.Name": parameter44_name, + "Parameter44.Value": parameter44_value, + "Parameter45.Name": parameter45_name, + "Parameter45.Value": parameter45_value, + "Parameter46.Name": parameter46_name, + "Parameter46.Value": parameter46_value, + "Parameter47.Name": parameter47_name, + "Parameter47.Value": parameter47_value, + "Parameter48.Name": parameter48_name, + "Parameter48.Value": parameter48_value, + "Parameter49.Name": parameter49_name, + "Parameter49.Value": parameter49_value, + "Parameter50.Name": parameter50_name, + "Parameter50.Value": parameter50_value, + "Parameter51.Name": parameter51_name, + "Parameter51.Value": parameter51_value, + "Parameter52.Name": parameter52_name, + "Parameter52.Value": parameter52_value, + "Parameter53.Name": parameter53_name, + "Parameter53.Value": parameter53_value, + "Parameter54.Name": parameter54_name, + "Parameter54.Value": parameter54_value, + "Parameter55.Name": parameter55_name, + "Parameter55.Value": parameter55_value, + "Parameter56.Name": parameter56_name, + "Parameter56.Value": parameter56_value, + "Parameter57.Name": parameter57_name, + "Parameter57.Value": parameter57_value, + "Parameter58.Name": parameter58_name, + "Parameter58.Value": parameter58_value, + "Parameter59.Name": parameter59_name, + "Parameter59.Value": parameter59_value, + "Parameter60.Name": parameter60_name, + "Parameter60.Value": parameter60_value, + "Parameter61.Name": parameter61_name, + "Parameter61.Value": parameter61_value, + "Parameter62.Name": parameter62_name, + "Parameter62.Value": parameter62_value, + "Parameter63.Name": parameter63_name, + "Parameter63.Value": parameter63_value, + "Parameter64.Name": parameter64_name, + "Parameter64.Value": parameter64_value, + "Parameter65.Name": parameter65_name, + "Parameter65.Value": parameter65_value, + "Parameter66.Name": parameter66_name, + "Parameter66.Value": parameter66_value, + "Parameter67.Name": parameter67_name, + "Parameter67.Value": parameter67_value, + "Parameter68.Name": parameter68_name, + "Parameter68.Value": parameter68_value, + "Parameter69.Name": parameter69_name, + "Parameter69.Value": parameter69_value, + "Parameter70.Name": parameter70_name, + "Parameter70.Value": parameter70_value, + "Parameter71.Name": parameter71_name, + "Parameter71.Value": parameter71_value, + "Parameter72.Name": parameter72_name, + "Parameter72.Value": parameter72_value, + "Parameter73.Name": parameter73_name, + "Parameter73.Value": parameter73_value, + "Parameter74.Name": parameter74_name, + "Parameter74.Value": parameter74_value, + "Parameter75.Name": parameter75_name, + "Parameter75.Value": parameter75_value, + "Parameter76.Name": parameter76_name, + "Parameter76.Value": parameter76_value, + "Parameter77.Name": parameter77_name, + "Parameter77.Value": parameter77_value, + "Parameter78.Name": parameter78_name, + "Parameter78.Value": parameter78_value, + "Parameter79.Name": parameter79_name, + "Parameter79.Value": parameter79_value, + "Parameter80.Name": parameter80_name, + "Parameter80.Value": parameter80_value, + "Parameter81.Name": parameter81_name, + "Parameter81.Value": parameter81_value, + "Parameter82.Name": parameter82_name, + "Parameter82.Value": parameter82_value, + "Parameter83.Name": parameter83_name, + "Parameter83.Value": parameter83_value, + "Parameter84.Name": parameter84_name, + "Parameter84.Value": parameter84_value, + "Parameter85.Name": parameter85_name, + "Parameter85.Value": parameter85_value, + "Parameter86.Name": parameter86_name, + "Parameter86.Value": parameter86_value, + "Parameter87.Name": parameter87_name, + "Parameter87.Value": parameter87_value, + "Parameter88.Name": parameter88_name, + "Parameter88.Value": parameter88_value, + "Parameter89.Name": parameter89_name, + "Parameter89.Value": parameter89_value, + "Parameter90.Name": parameter90_name, + "Parameter90.Value": parameter90_value, + "Parameter91.Name": parameter91_name, + "Parameter91.Value": parameter91_value, + "Parameter92.Name": parameter92_name, + "Parameter92.Value": parameter92_value, + "Parameter93.Name": parameter93_name, + "Parameter93.Value": parameter93_value, + "Parameter94.Name": parameter94_name, + "Parameter94.Value": parameter94_value, + "Parameter95.Name": parameter95_name, + "Parameter95.Value": parameter95_value, + "Parameter96.Name": parameter96_name, + "Parameter96.Value": parameter96_value, + "Parameter97.Name": parameter97_name, + "Parameter97.Value": parameter97_value, + "Parameter98.Name": parameter98_name, + "Parameter98.Value": parameter98_value, + "Parameter99.Name": parameter99_name, + "Parameter99.Value": parameter99_value, + } + ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return TranscriptionInstance( + self._version, + payload, + account_sid=self._solution["account_sid"], + call_sid=self._solution["call_sid"], + ) + + async def create_async( + self, + name: Union[str, object] = values.unset, + track: Union["TranscriptionInstance.Track", object] = values.unset, + status_callback_url: Union[str, object] = values.unset, + status_callback_method: Union[str, object] = values.unset, + inbound_track_label: Union[str, object] = values.unset, + outbound_track_label: Union[str, object] = values.unset, + partial_results: Union[bool, object] = values.unset, + language_code: Union[str, object] = values.unset, + transcription_engine: Union[str, object] = values.unset, + profanity_filter: Union[bool, object] = values.unset, + speech_model: Union[str, object] = values.unset, + hints: Union[str, object] = values.unset, + enable_automatic_punctuation: Union[bool, object] = values.unset, + parameter1_name: Union[str, object] = values.unset, + parameter1_value: Union[str, object] = values.unset, + parameter2_name: Union[str, object] = values.unset, + parameter2_value: Union[str, object] = values.unset, + parameter3_name: Union[str, object] = values.unset, + parameter3_value: Union[str, object] = values.unset, + parameter4_name: Union[str, object] = values.unset, + parameter4_value: Union[str, object] = values.unset, + parameter5_name: Union[str, object] = values.unset, + parameter5_value: Union[str, object] = values.unset, + parameter6_name: Union[str, object] = values.unset, + parameter6_value: Union[str, object] = values.unset, + parameter7_name: Union[str, object] = values.unset, + parameter7_value: Union[str, object] = values.unset, + parameter8_name: Union[str, object] = values.unset, + parameter8_value: Union[str, object] = values.unset, + parameter9_name: Union[str, object] = values.unset, + parameter9_value: Union[str, object] = values.unset, + parameter10_name: Union[str, object] = values.unset, + parameter10_value: Union[str, object] = values.unset, + parameter11_name: Union[str, object] = values.unset, + parameter11_value: Union[str, object] = values.unset, + parameter12_name: Union[str, object] = values.unset, + parameter12_value: Union[str, object] = values.unset, + parameter13_name: Union[str, object] = values.unset, + parameter13_value: Union[str, object] = values.unset, + parameter14_name: Union[str, object] = values.unset, + parameter14_value: Union[str, object] = values.unset, + parameter15_name: Union[str, object] = values.unset, + parameter15_value: Union[str, object] = values.unset, + parameter16_name: Union[str, object] = values.unset, + parameter16_value: Union[str, object] = values.unset, + parameter17_name: Union[str, object] = values.unset, + parameter17_value: Union[str, object] = values.unset, + parameter18_name: Union[str, object] = values.unset, + parameter18_value: Union[str, object] = values.unset, + parameter19_name: Union[str, object] = values.unset, + parameter19_value: Union[str, object] = values.unset, + parameter20_name: Union[str, object] = values.unset, + parameter20_value: Union[str, object] = values.unset, + parameter21_name: Union[str, object] = values.unset, + parameter21_value: Union[str, object] = values.unset, + parameter22_name: Union[str, object] = values.unset, + parameter22_value: Union[str, object] = values.unset, + parameter23_name: Union[str, object] = values.unset, + parameter23_value: Union[str, object] = values.unset, + parameter24_name: Union[str, object] = values.unset, + parameter24_value: Union[str, object] = values.unset, + parameter25_name: Union[str, object] = values.unset, + parameter25_value: Union[str, object] = values.unset, + parameter26_name: Union[str, object] = values.unset, + parameter26_value: Union[str, object] = values.unset, + parameter27_name: Union[str, object] = values.unset, + parameter27_value: Union[str, object] = values.unset, + parameter28_name: Union[str, object] = values.unset, + parameter28_value: Union[str, object] = values.unset, + parameter29_name: Union[str, object] = values.unset, + parameter29_value: Union[str, object] = values.unset, + parameter30_name: Union[str, object] = values.unset, + parameter30_value: Union[str, object] = values.unset, + parameter31_name: Union[str, object] = values.unset, + parameter31_value: Union[str, object] = values.unset, + parameter32_name: Union[str, object] = values.unset, + parameter32_value: Union[str, object] = values.unset, + parameter33_name: Union[str, object] = values.unset, + parameter33_value: Union[str, object] = values.unset, + parameter34_name: Union[str, object] = values.unset, + parameter34_value: Union[str, object] = values.unset, + parameter35_name: Union[str, object] = values.unset, + parameter35_value: Union[str, object] = values.unset, + parameter36_name: Union[str, object] = values.unset, + parameter36_value: Union[str, object] = values.unset, + parameter37_name: Union[str, object] = values.unset, + parameter37_value: Union[str, object] = values.unset, + parameter38_name: Union[str, object] = values.unset, + parameter38_value: Union[str, object] = values.unset, + parameter39_name: Union[str, object] = values.unset, + parameter39_value: Union[str, object] = values.unset, + parameter40_name: Union[str, object] = values.unset, + parameter40_value: Union[str, object] = values.unset, + parameter41_name: Union[str, object] = values.unset, + parameter41_value: Union[str, object] = values.unset, + parameter42_name: Union[str, object] = values.unset, + parameter42_value: Union[str, object] = values.unset, + parameter43_name: Union[str, object] = values.unset, + parameter43_value: Union[str, object] = values.unset, + parameter44_name: Union[str, object] = values.unset, + parameter44_value: Union[str, object] = values.unset, + parameter45_name: Union[str, object] = values.unset, + parameter45_value: Union[str, object] = values.unset, + parameter46_name: Union[str, object] = values.unset, + parameter46_value: Union[str, object] = values.unset, + parameter47_name: Union[str, object] = values.unset, + parameter47_value: Union[str, object] = values.unset, + parameter48_name: Union[str, object] = values.unset, + parameter48_value: Union[str, object] = values.unset, + parameter49_name: Union[str, object] = values.unset, + parameter49_value: Union[str, object] = values.unset, + parameter50_name: Union[str, object] = values.unset, + parameter50_value: Union[str, object] = values.unset, + parameter51_name: Union[str, object] = values.unset, + parameter51_value: Union[str, object] = values.unset, + parameter52_name: Union[str, object] = values.unset, + parameter52_value: Union[str, object] = values.unset, + parameter53_name: Union[str, object] = values.unset, + parameter53_value: Union[str, object] = values.unset, + parameter54_name: Union[str, object] = values.unset, + parameter54_value: Union[str, object] = values.unset, + parameter55_name: Union[str, object] = values.unset, + parameter55_value: Union[str, object] = values.unset, + parameter56_name: Union[str, object] = values.unset, + parameter56_value: Union[str, object] = values.unset, + parameter57_name: Union[str, object] = values.unset, + parameter57_value: Union[str, object] = values.unset, + parameter58_name: Union[str, object] = values.unset, + parameter58_value: Union[str, object] = values.unset, + parameter59_name: Union[str, object] = values.unset, + parameter59_value: Union[str, object] = values.unset, + parameter60_name: Union[str, object] = values.unset, + parameter60_value: Union[str, object] = values.unset, + parameter61_name: Union[str, object] = values.unset, + parameter61_value: Union[str, object] = values.unset, + parameter62_name: Union[str, object] = values.unset, + parameter62_value: Union[str, object] = values.unset, + parameter63_name: Union[str, object] = values.unset, + parameter63_value: Union[str, object] = values.unset, + parameter64_name: Union[str, object] = values.unset, + parameter64_value: Union[str, object] = values.unset, + parameter65_name: Union[str, object] = values.unset, + parameter65_value: Union[str, object] = values.unset, + parameter66_name: Union[str, object] = values.unset, + parameter66_value: Union[str, object] = values.unset, + parameter67_name: Union[str, object] = values.unset, + parameter67_value: Union[str, object] = values.unset, + parameter68_name: Union[str, object] = values.unset, + parameter68_value: Union[str, object] = values.unset, + parameter69_name: Union[str, object] = values.unset, + parameter69_value: Union[str, object] = values.unset, + parameter70_name: Union[str, object] = values.unset, + parameter70_value: Union[str, object] = values.unset, + parameter71_name: Union[str, object] = values.unset, + parameter71_value: Union[str, object] = values.unset, + parameter72_name: Union[str, object] = values.unset, + parameter72_value: Union[str, object] = values.unset, + parameter73_name: Union[str, object] = values.unset, + parameter73_value: Union[str, object] = values.unset, + parameter74_name: Union[str, object] = values.unset, + parameter74_value: Union[str, object] = values.unset, + parameter75_name: Union[str, object] = values.unset, + parameter75_value: Union[str, object] = values.unset, + parameter76_name: Union[str, object] = values.unset, + parameter76_value: Union[str, object] = values.unset, + parameter77_name: Union[str, object] = values.unset, + parameter77_value: Union[str, object] = values.unset, + parameter78_name: Union[str, object] = values.unset, + parameter78_value: Union[str, object] = values.unset, + parameter79_name: Union[str, object] = values.unset, + parameter79_value: Union[str, object] = values.unset, + parameter80_name: Union[str, object] = values.unset, + parameter80_value: Union[str, object] = values.unset, + parameter81_name: Union[str, object] = values.unset, + parameter81_value: Union[str, object] = values.unset, + parameter82_name: Union[str, object] = values.unset, + parameter82_value: Union[str, object] = values.unset, + parameter83_name: Union[str, object] = values.unset, + parameter83_value: Union[str, object] = values.unset, + parameter84_name: Union[str, object] = values.unset, + parameter84_value: Union[str, object] = values.unset, + parameter85_name: Union[str, object] = values.unset, + parameter85_value: Union[str, object] = values.unset, + parameter86_name: Union[str, object] = values.unset, + parameter86_value: Union[str, object] = values.unset, + parameter87_name: Union[str, object] = values.unset, + parameter87_value: Union[str, object] = values.unset, + parameter88_name: Union[str, object] = values.unset, + parameter88_value: Union[str, object] = values.unset, + parameter89_name: Union[str, object] = values.unset, + parameter89_value: Union[str, object] = values.unset, + parameter90_name: Union[str, object] = values.unset, + parameter90_value: Union[str, object] = values.unset, + parameter91_name: Union[str, object] = values.unset, + parameter91_value: Union[str, object] = values.unset, + parameter92_name: Union[str, object] = values.unset, + parameter92_value: Union[str, object] = values.unset, + parameter93_name: Union[str, object] = values.unset, + parameter93_value: Union[str, object] = values.unset, + parameter94_name: Union[str, object] = values.unset, + parameter94_value: Union[str, object] = values.unset, + parameter95_name: Union[str, object] = values.unset, + parameter95_value: Union[str, object] = values.unset, + parameter96_name: Union[str, object] = values.unset, + parameter96_value: Union[str, object] = values.unset, + parameter97_name: Union[str, object] = values.unset, + parameter97_value: Union[str, object] = values.unset, + parameter98_name: Union[str, object] = values.unset, + parameter98_value: Union[str, object] = values.unset, + parameter99_name: Union[str, object] = values.unset, + parameter99_value: Union[str, object] = values.unset, + ) -> TranscriptionInstance: + """ + Asynchronously create the TranscriptionInstance + + :param name: The user-specified name of this Transcription, if one was given when the Transcription was created. This may be used to stop the Transcription. + :param track: + :param status_callback_url: Absolute URL of the status callback. + :param status_callback_method: The http method for the status_callback (one of GET, POST). + :param inbound_track_label: Friendly name given to the Inbound Track + :param outbound_track_label: Friendly name given to the Outbound Track + :param partial_results: Indicates if partial results are going to be send to the customer + :param language_code: Language code used by the transcription engine, specified in [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) format + :param transcription_engine: Definition of the transcription engine to be used, between those supported by Twilio + :param profanity_filter: indicates if the server will attempt to filter out profanities, replacing all but the initial character in each filtered word with asterisks + :param speech_model: Recognition model used by the transcription engine, between those supported by the provider + :param hints: A Phrase contains words and phrase \\\"hints\\\" so that the speech recognition engine is more likely to recognize them. + :param enable_automatic_punctuation: The provider will adds punctuation to recognition result hypotheses + :param parameter1_name: Parameter name + :param parameter1_value: Parameter value + :param parameter2_name: Parameter name + :param parameter2_value: Parameter value + :param parameter3_name: Parameter name + :param parameter3_value: Parameter value + :param parameter4_name: Parameter name + :param parameter4_value: Parameter value + :param parameter5_name: Parameter name + :param parameter5_value: Parameter value + :param parameter6_name: Parameter name + :param parameter6_value: Parameter value + :param parameter7_name: Parameter name + :param parameter7_value: Parameter value + :param parameter8_name: Parameter name + :param parameter8_value: Parameter value + :param parameter9_name: Parameter name + :param parameter9_value: Parameter value + :param parameter10_name: Parameter name + :param parameter10_value: Parameter value + :param parameter11_name: Parameter name + :param parameter11_value: Parameter value + :param parameter12_name: Parameter name + :param parameter12_value: Parameter value + :param parameter13_name: Parameter name + :param parameter13_value: Parameter value + :param parameter14_name: Parameter name + :param parameter14_value: Parameter value + :param parameter15_name: Parameter name + :param parameter15_value: Parameter value + :param parameter16_name: Parameter name + :param parameter16_value: Parameter value + :param parameter17_name: Parameter name + :param parameter17_value: Parameter value + :param parameter18_name: Parameter name + :param parameter18_value: Parameter value + :param parameter19_name: Parameter name + :param parameter19_value: Parameter value + :param parameter20_name: Parameter name + :param parameter20_value: Parameter value + :param parameter21_name: Parameter name + :param parameter21_value: Parameter value + :param parameter22_name: Parameter name + :param parameter22_value: Parameter value + :param parameter23_name: Parameter name + :param parameter23_value: Parameter value + :param parameter24_name: Parameter name + :param parameter24_value: Parameter value + :param parameter25_name: Parameter name + :param parameter25_value: Parameter value + :param parameter26_name: Parameter name + :param parameter26_value: Parameter value + :param parameter27_name: Parameter name + :param parameter27_value: Parameter value + :param parameter28_name: Parameter name + :param parameter28_value: Parameter value + :param parameter29_name: Parameter name + :param parameter29_value: Parameter value + :param parameter30_name: Parameter name + :param parameter30_value: Parameter value + :param parameter31_name: Parameter name + :param parameter31_value: Parameter value + :param parameter32_name: Parameter name + :param parameter32_value: Parameter value + :param parameter33_name: Parameter name + :param parameter33_value: Parameter value + :param parameter34_name: Parameter name + :param parameter34_value: Parameter value + :param parameter35_name: Parameter name + :param parameter35_value: Parameter value + :param parameter36_name: Parameter name + :param parameter36_value: Parameter value + :param parameter37_name: Parameter name + :param parameter37_value: Parameter value + :param parameter38_name: Parameter name + :param parameter38_value: Parameter value + :param parameter39_name: Parameter name + :param parameter39_value: Parameter value + :param parameter40_name: Parameter name + :param parameter40_value: Parameter value + :param parameter41_name: Parameter name + :param parameter41_value: Parameter value + :param parameter42_name: Parameter name + :param parameter42_value: Parameter value + :param parameter43_name: Parameter name + :param parameter43_value: Parameter value + :param parameter44_name: Parameter name + :param parameter44_value: Parameter value + :param parameter45_name: Parameter name + :param parameter45_value: Parameter value + :param parameter46_name: Parameter name + :param parameter46_value: Parameter value + :param parameter47_name: Parameter name + :param parameter47_value: Parameter value + :param parameter48_name: Parameter name + :param parameter48_value: Parameter value + :param parameter49_name: Parameter name + :param parameter49_value: Parameter value + :param parameter50_name: Parameter name + :param parameter50_value: Parameter value + :param parameter51_name: Parameter name + :param parameter51_value: Parameter value + :param parameter52_name: Parameter name + :param parameter52_value: Parameter value + :param parameter53_name: Parameter name + :param parameter53_value: Parameter value + :param parameter54_name: Parameter name + :param parameter54_value: Parameter value + :param parameter55_name: Parameter name + :param parameter55_value: Parameter value + :param parameter56_name: Parameter name + :param parameter56_value: Parameter value + :param parameter57_name: Parameter name + :param parameter57_value: Parameter value + :param parameter58_name: Parameter name + :param parameter58_value: Parameter value + :param parameter59_name: Parameter name + :param parameter59_value: Parameter value + :param parameter60_name: Parameter name + :param parameter60_value: Parameter value + :param parameter61_name: Parameter name + :param parameter61_value: Parameter value + :param parameter62_name: Parameter name + :param parameter62_value: Parameter value + :param parameter63_name: Parameter name + :param parameter63_value: Parameter value + :param parameter64_name: Parameter name + :param parameter64_value: Parameter value + :param parameter65_name: Parameter name + :param parameter65_value: Parameter value + :param parameter66_name: Parameter name + :param parameter66_value: Parameter value + :param parameter67_name: Parameter name + :param parameter67_value: Parameter value + :param parameter68_name: Parameter name + :param parameter68_value: Parameter value + :param parameter69_name: Parameter name + :param parameter69_value: Parameter value + :param parameter70_name: Parameter name + :param parameter70_value: Parameter value + :param parameter71_name: Parameter name + :param parameter71_value: Parameter value + :param parameter72_name: Parameter name + :param parameter72_value: Parameter value + :param parameter73_name: Parameter name + :param parameter73_value: Parameter value + :param parameter74_name: Parameter name + :param parameter74_value: Parameter value + :param parameter75_name: Parameter name + :param parameter75_value: Parameter value + :param parameter76_name: Parameter name + :param parameter76_value: Parameter value + :param parameter77_name: Parameter name + :param parameter77_value: Parameter value + :param parameter78_name: Parameter name + :param parameter78_value: Parameter value + :param parameter79_name: Parameter name + :param parameter79_value: Parameter value + :param parameter80_name: Parameter name + :param parameter80_value: Parameter value + :param parameter81_name: Parameter name + :param parameter81_value: Parameter value + :param parameter82_name: Parameter name + :param parameter82_value: Parameter value + :param parameter83_name: Parameter name + :param parameter83_value: Parameter value + :param parameter84_name: Parameter name + :param parameter84_value: Parameter value + :param parameter85_name: Parameter name + :param parameter85_value: Parameter value + :param parameter86_name: Parameter name + :param parameter86_value: Parameter value + :param parameter87_name: Parameter name + :param parameter87_value: Parameter value + :param parameter88_name: Parameter name + :param parameter88_value: Parameter value + :param parameter89_name: Parameter name + :param parameter89_value: Parameter value + :param parameter90_name: Parameter name + :param parameter90_value: Parameter value + :param parameter91_name: Parameter name + :param parameter91_value: Parameter value + :param parameter92_name: Parameter name + :param parameter92_value: Parameter value + :param parameter93_name: Parameter name + :param parameter93_value: Parameter value + :param parameter94_name: Parameter name + :param parameter94_value: Parameter value + :param parameter95_name: Parameter name + :param parameter95_value: Parameter value + :param parameter96_name: Parameter name + :param parameter96_value: Parameter value + :param parameter97_name: Parameter name + :param parameter97_value: Parameter value + :param parameter98_name: Parameter name + :param parameter98_value: Parameter value + :param parameter99_name: Parameter name + :param parameter99_value: Parameter value + + :returns: The created TranscriptionInstance + """ + + data = values.of( + { + "Name": name, + "Track": track, + "StatusCallbackUrl": status_callback_url, + "StatusCallbackMethod": status_callback_method, + "InboundTrackLabel": inbound_track_label, + "OutboundTrackLabel": outbound_track_label, + "PartialResults": serialize.boolean_to_string(partial_results), + "LanguageCode": language_code, + "TranscriptionEngine": transcription_engine, + "ProfanityFilter": serialize.boolean_to_string(profanity_filter), + "SpeechModel": speech_model, + "Hints": hints, + "EnableAutomaticPunctuation": serialize.boolean_to_string( + enable_automatic_punctuation + ), + "Parameter1.Name": parameter1_name, + "Parameter1.Value": parameter1_value, + "Parameter2.Name": parameter2_name, + "Parameter2.Value": parameter2_value, + "Parameter3.Name": parameter3_name, + "Parameter3.Value": parameter3_value, + "Parameter4.Name": parameter4_name, + "Parameter4.Value": parameter4_value, + "Parameter5.Name": parameter5_name, + "Parameter5.Value": parameter5_value, + "Parameter6.Name": parameter6_name, + "Parameter6.Value": parameter6_value, + "Parameter7.Name": parameter7_name, + "Parameter7.Value": parameter7_value, + "Parameter8.Name": parameter8_name, + "Parameter8.Value": parameter8_value, + "Parameter9.Name": parameter9_name, + "Parameter9.Value": parameter9_value, + "Parameter10.Name": parameter10_name, + "Parameter10.Value": parameter10_value, + "Parameter11.Name": parameter11_name, + "Parameter11.Value": parameter11_value, + "Parameter12.Name": parameter12_name, + "Parameter12.Value": parameter12_value, + "Parameter13.Name": parameter13_name, + "Parameter13.Value": parameter13_value, + "Parameter14.Name": parameter14_name, + "Parameter14.Value": parameter14_value, + "Parameter15.Name": parameter15_name, + "Parameter15.Value": parameter15_value, + "Parameter16.Name": parameter16_name, + "Parameter16.Value": parameter16_value, + "Parameter17.Name": parameter17_name, + "Parameter17.Value": parameter17_value, + "Parameter18.Name": parameter18_name, + "Parameter18.Value": parameter18_value, + "Parameter19.Name": parameter19_name, + "Parameter19.Value": parameter19_value, + "Parameter20.Name": parameter20_name, + "Parameter20.Value": parameter20_value, + "Parameter21.Name": parameter21_name, + "Parameter21.Value": parameter21_value, + "Parameter22.Name": parameter22_name, + "Parameter22.Value": parameter22_value, + "Parameter23.Name": parameter23_name, + "Parameter23.Value": parameter23_value, + "Parameter24.Name": parameter24_name, + "Parameter24.Value": parameter24_value, + "Parameter25.Name": parameter25_name, + "Parameter25.Value": parameter25_value, + "Parameter26.Name": parameter26_name, + "Parameter26.Value": parameter26_value, + "Parameter27.Name": parameter27_name, + "Parameter27.Value": parameter27_value, + "Parameter28.Name": parameter28_name, + "Parameter28.Value": parameter28_value, + "Parameter29.Name": parameter29_name, + "Parameter29.Value": parameter29_value, + "Parameter30.Name": parameter30_name, + "Parameter30.Value": parameter30_value, + "Parameter31.Name": parameter31_name, + "Parameter31.Value": parameter31_value, + "Parameter32.Name": parameter32_name, + "Parameter32.Value": parameter32_value, + "Parameter33.Name": parameter33_name, + "Parameter33.Value": parameter33_value, + "Parameter34.Name": parameter34_name, + "Parameter34.Value": parameter34_value, + "Parameter35.Name": parameter35_name, + "Parameter35.Value": parameter35_value, + "Parameter36.Name": parameter36_name, + "Parameter36.Value": parameter36_value, + "Parameter37.Name": parameter37_name, + "Parameter37.Value": parameter37_value, + "Parameter38.Name": parameter38_name, + "Parameter38.Value": parameter38_value, + "Parameter39.Name": parameter39_name, + "Parameter39.Value": parameter39_value, + "Parameter40.Name": parameter40_name, + "Parameter40.Value": parameter40_value, + "Parameter41.Name": parameter41_name, + "Parameter41.Value": parameter41_value, + "Parameter42.Name": parameter42_name, + "Parameter42.Value": parameter42_value, + "Parameter43.Name": parameter43_name, + "Parameter43.Value": parameter43_value, + "Parameter44.Name": parameter44_name, + "Parameter44.Value": parameter44_value, + "Parameter45.Name": parameter45_name, + "Parameter45.Value": parameter45_value, + "Parameter46.Name": parameter46_name, + "Parameter46.Value": parameter46_value, + "Parameter47.Name": parameter47_name, + "Parameter47.Value": parameter47_value, + "Parameter48.Name": parameter48_name, + "Parameter48.Value": parameter48_value, + "Parameter49.Name": parameter49_name, + "Parameter49.Value": parameter49_value, + "Parameter50.Name": parameter50_name, + "Parameter50.Value": parameter50_value, + "Parameter51.Name": parameter51_name, + "Parameter51.Value": parameter51_value, + "Parameter52.Name": parameter52_name, + "Parameter52.Value": parameter52_value, + "Parameter53.Name": parameter53_name, + "Parameter53.Value": parameter53_value, + "Parameter54.Name": parameter54_name, + "Parameter54.Value": parameter54_value, + "Parameter55.Name": parameter55_name, + "Parameter55.Value": parameter55_value, + "Parameter56.Name": parameter56_name, + "Parameter56.Value": parameter56_value, + "Parameter57.Name": parameter57_name, + "Parameter57.Value": parameter57_value, + "Parameter58.Name": parameter58_name, + "Parameter58.Value": parameter58_value, + "Parameter59.Name": parameter59_name, + "Parameter59.Value": parameter59_value, + "Parameter60.Name": parameter60_name, + "Parameter60.Value": parameter60_value, + "Parameter61.Name": parameter61_name, + "Parameter61.Value": parameter61_value, + "Parameter62.Name": parameter62_name, + "Parameter62.Value": parameter62_value, + "Parameter63.Name": parameter63_name, + "Parameter63.Value": parameter63_value, + "Parameter64.Name": parameter64_name, + "Parameter64.Value": parameter64_value, + "Parameter65.Name": parameter65_name, + "Parameter65.Value": parameter65_value, + "Parameter66.Name": parameter66_name, + "Parameter66.Value": parameter66_value, + "Parameter67.Name": parameter67_name, + "Parameter67.Value": parameter67_value, + "Parameter68.Name": parameter68_name, + "Parameter68.Value": parameter68_value, + "Parameter69.Name": parameter69_name, + "Parameter69.Value": parameter69_value, + "Parameter70.Name": parameter70_name, + "Parameter70.Value": parameter70_value, + "Parameter71.Name": parameter71_name, + "Parameter71.Value": parameter71_value, + "Parameter72.Name": parameter72_name, + "Parameter72.Value": parameter72_value, + "Parameter73.Name": parameter73_name, + "Parameter73.Value": parameter73_value, + "Parameter74.Name": parameter74_name, + "Parameter74.Value": parameter74_value, + "Parameter75.Name": parameter75_name, + "Parameter75.Value": parameter75_value, + "Parameter76.Name": parameter76_name, + "Parameter76.Value": parameter76_value, + "Parameter77.Name": parameter77_name, + "Parameter77.Value": parameter77_value, + "Parameter78.Name": parameter78_name, + "Parameter78.Value": parameter78_value, + "Parameter79.Name": parameter79_name, + "Parameter79.Value": parameter79_value, + "Parameter80.Name": parameter80_name, + "Parameter80.Value": parameter80_value, + "Parameter81.Name": parameter81_name, + "Parameter81.Value": parameter81_value, + "Parameter82.Name": parameter82_name, + "Parameter82.Value": parameter82_value, + "Parameter83.Name": parameter83_name, + "Parameter83.Value": parameter83_value, + "Parameter84.Name": parameter84_name, + "Parameter84.Value": parameter84_value, + "Parameter85.Name": parameter85_name, + "Parameter85.Value": parameter85_value, + "Parameter86.Name": parameter86_name, + "Parameter86.Value": parameter86_value, + "Parameter87.Name": parameter87_name, + "Parameter87.Value": parameter87_value, + "Parameter88.Name": parameter88_name, + "Parameter88.Value": parameter88_value, + "Parameter89.Name": parameter89_name, + "Parameter89.Value": parameter89_value, + "Parameter90.Name": parameter90_name, + "Parameter90.Value": parameter90_value, + "Parameter91.Name": parameter91_name, + "Parameter91.Value": parameter91_value, + "Parameter92.Name": parameter92_name, + "Parameter92.Value": parameter92_value, + "Parameter93.Name": parameter93_name, + "Parameter93.Value": parameter93_value, + "Parameter94.Name": parameter94_name, + "Parameter94.Value": parameter94_value, + "Parameter95.Name": parameter95_name, + "Parameter95.Value": parameter95_value, + "Parameter96.Name": parameter96_name, + "Parameter96.Value": parameter96_value, + "Parameter97.Name": parameter97_name, + "Parameter97.Value": parameter97_value, + "Parameter98.Name": parameter98_name, + "Parameter98.Value": parameter98_value, + "Parameter99.Name": parameter99_name, + "Parameter99.Value": parameter99_value, + } + ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return TranscriptionInstance( + self._version, + payload, + account_sid=self._solution["account_sid"], + call_sid=self._solution["call_sid"], + ) + + def get(self, sid: str) -> TranscriptionContext: + """ + Constructs a TranscriptionContext + + :param sid: The SID of the Transcription resource, or the `name` used when creating the resource + """ + return TranscriptionContext( + self._version, + account_sid=self._solution["account_sid"], + call_sid=self._solution["call_sid"], + sid=sid, + ) + + def __call__(self, sid: str) -> TranscriptionContext: + """ + Constructs a TranscriptionContext + + :param sid: The SID of the Transcription resource, or the `name` used when creating the resource + """ + return TranscriptionContext( + self._version, + account_sid=self._solution["account_sid"], + call_sid=self._solution["call_sid"], + sid=sid, + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/content/v1/content/__init__.py b/twilio/rest/content/v1/content/__init__.py index 6dd0978f31..0fcbd1c19e 100644 --- a/twilio/rest/content/v1/content/__init__.py +++ b/twilio/rest/content/v1/content/__init__.py @@ -306,7 +306,7 @@ def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): def to_dict(self): return { - "type": self.type.to_dict(), + "type": self.type, "copy_code_text": self.copy_code_text, } @@ -331,7 +331,7 @@ def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): def to_dict(self): return { - "type": self.type.to_dict(), + "type": self.type, "title": self.title, "url": self.url, "phone": self.phone, @@ -357,7 +357,7 @@ def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): def to_dict(self): return { - "type": self.type.to_dict(), + "type": self.type, "title": self.title, "url": self.url, "phone": self.phone, @@ -453,7 +453,7 @@ def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): def to_dict(self): return { - "type": self.type.to_dict(), + "type": self.type, "title": self.title, "id": self.id, } diff --git a/twilio/rest/content/v1/content/approval_fetch.py b/twilio/rest/content/v1/content/approval_fetch.py index f679a920a1..f35ef6a48f 100644 --- a/twilio/rest/content/v1/content/approval_fetch.py +++ b/twilio/rest/content/v1/content/approval_fetch.py @@ -27,7 +27,7 @@ class ApprovalFetchInstance(InstanceResource): :ivar url: The URL of the resource, relative to `https://content.twilio.com`. """ - def __init__(self, version: Version, payload: Dict[str, Any], content_sid: str): + def __init__(self, version: Version, payload: Dict[str, Any], sid: str): super().__init__(version) self.sid: Optional[str] = payload.get("sid") @@ -36,7 +36,7 @@ def __init__(self, version: Version, payload: Dict[str, Any], content_sid: str): self.url: Optional[str] = payload.get("url") self._solution = { - "content_sid": content_sid, + "sid": sid, } self._context: Optional[ApprovalFetchContext] = None @@ -51,7 +51,7 @@ def _proxy(self) -> "ApprovalFetchContext": if self._context is None: self._context = ApprovalFetchContext( self._version, - content_sid=self._solution["content_sid"], + sid=self._solution["sid"], ) return self._context @@ -85,20 +85,20 @@ def __repr__(self) -> str: class ApprovalFetchContext(InstanceContext): - def __init__(self, version: Version, content_sid: str): + def __init__(self, version: Version, sid: str): """ Initialize the ApprovalFetchContext :param version: Version that contains the resource - :param content_sid: The Twilio-provided string that uniquely identifies the Content resource whose approval information to fetch. + :param sid: The Twilio-provided string that uniquely identifies the Content resource whose approval information to fetch. """ super().__init__(version) # Path Solution self._solution = { - "content_sid": content_sid, + "sid": sid, } - self._uri = "/Content/{content_sid}/ApprovalRequests".format(**self._solution) + self._uri = "/Content/{sid}/ApprovalRequests".format(**self._solution) def fetch(self) -> ApprovalFetchInstance: """ @@ -116,7 +116,7 @@ def fetch(self) -> ApprovalFetchInstance: return ApprovalFetchInstance( self._version, payload, - content_sid=self._solution["content_sid"], + sid=self._solution["sid"], ) async def fetch_async(self) -> ApprovalFetchInstance: @@ -135,7 +135,7 @@ async def fetch_async(self) -> ApprovalFetchInstance: return ApprovalFetchInstance( self._version, payload, - content_sid=self._solution["content_sid"], + sid=self._solution["sid"], ) def __repr__(self) -> str: @@ -150,19 +150,19 @@ def __repr__(self) -> str: class ApprovalFetchList(ListResource): - def __init__(self, version: Version, content_sid: str): + def __init__(self, version: Version, sid: str): """ Initialize the ApprovalFetchList :param version: Version that contains the resource - :param content_sid: The Twilio-provided string that uniquely identifies the Content resource whose approval information to fetch. + :param sid: The Twilio-provided string that uniquely identifies the Content resource whose approval information to fetch. """ super().__init__(version) # Path Solution self._solution = { - "content_sid": content_sid, + "sid": sid, } def get(self) -> ApprovalFetchContext: @@ -170,18 +170,14 @@ def get(self) -> ApprovalFetchContext: Constructs a ApprovalFetchContext """ - return ApprovalFetchContext( - self._version, content_sid=self._solution["content_sid"] - ) + return ApprovalFetchContext(self._version, sid=self._solution["sid"]) def __call__(self) -> ApprovalFetchContext: """ Constructs a ApprovalFetchContext """ - return ApprovalFetchContext( - self._version, content_sid=self._solution["content_sid"] - ) + return ApprovalFetchContext(self._version, sid=self._solution["sid"]) def __repr__(self) -> str: """ diff --git a/twilio/rest/content/v1/content_and_approvals.py b/twilio/rest/content/v1/content_and_approvals.py index e2d6d72aaf..de40cfc172 100644 --- a/twilio/rest/content/v1/content_and_approvals.py +++ b/twilio/rest/content/v1/content_and_approvals.py @@ -31,7 +31,7 @@ class ContentAndApprovalsInstance(InstanceResource): :ivar friendly_name: A string name used to describe the Content resource. Not visible to the end recipient. :ivar language: Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in. :ivar variables: Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}. - :ivar types: The [Content types](https://www.twilio.com/docs/content/content-types-overview) (e.g. twilio/text) for this Content resource. + :ivar types: The [Content types](https://www.twilio.com/docs/content-api/content-types-overview) (e.g. twilio/text) for this Content resource. :ivar approval_requests: The submitted information and approval request status of the Content resource. """ diff --git a/twilio/rest/content/v1/legacy_content.py b/twilio/rest/content/v1/legacy_content.py index 5705c33b0b..cfb4ac698d 100644 --- a/twilio/rest/content/v1/legacy_content.py +++ b/twilio/rest/content/v1/legacy_content.py @@ -31,7 +31,7 @@ class LegacyContentInstance(InstanceResource): :ivar friendly_name: A string name used to describe the Content resource. Not visible to the end recipient. :ivar language: Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in. :ivar variables: Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}. - :ivar types: The [Content types](https://www.twilio.com/docs/content/content-types-overview) (e.g. twilio/text) for this Content resource. + :ivar types: The [Content types](https://www.twilio.com/docs/content-api/content-types-overview) (e.g. twilio/text) for this Content resource. :ivar legacy_template_name: The string name of the legacy content template associated with this Content resource, unique across all template names for its account. Only lowercase letters, numbers and underscores are allowed :ivar legacy_body: The string body field of the legacy content template associated with this Content resource :ivar url: The URL of the resource, relative to `https://content.twilio.com`. diff --git a/twilio/rest/marketplace/v1/installed_add_on/installed_add_on_usage.py b/twilio/rest/marketplace/v1/installed_add_on/installed_add_on_usage.py index 3d8d694a22..3f9415ed49 100644 --- a/twilio/rest/marketplace/v1/installed_add_on/installed_add_on_usage.py +++ b/twilio/rest/marketplace/v1/installed_add_on/installed_add_on_usage.py @@ -52,7 +52,7 @@ def __repr__(self) -> str: class InstalledAddOnUsageList(ListResource): - class CreateMarketplaceBillingUsageRequest(object): + class CreateBillingUsageRequest(object): """ :ivar billable_items: """ @@ -60,9 +60,7 @@ class CreateMarketplaceBillingUsageRequest(object): def __init__(self, payload: Dict[str, Any], installed_add_on_sid: str): self.billable_items: Optional[ - List[ - InstalledAddOnUsageList.CreateMarketplaceBillingUsageRequestBillableItems - ] + List[InstalledAddOnUsageList.CreateBillingUsageRequestBillableItems] ] = payload.get("billable_items") def to_dict(self): @@ -72,7 +70,7 @@ def to_dict(self): ], } - class CreateMarketplaceBillingUsageRequestBillableItems(object): + class CreateBillingUsageRequestBillableItems(object): """ :ivar quantity: :ivar sid: @@ -108,17 +106,16 @@ def __init__(self, version: Version, installed_add_on_sid: str): ) def create( - self, - create_marketplace_billing_usage_request: CreateMarketplaceBillingUsageRequest, + self, create_billing_usage_request: CreateBillingUsageRequest ) -> InstalledAddOnUsageInstance: """ Create the InstalledAddOnUsageInstance - :param create_marketplace_billing_usage_request: + :param create_billing_usage_request: :returns: The created InstalledAddOnUsageInstance """ - data = create_marketplace_billing_usage_request.to_dict() + data = create_billing_usage_request.to_dict() headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) headers["Content-Type"] = "application/json" @@ -134,17 +131,16 @@ def create( ) async def create_async( - self, - create_marketplace_billing_usage_request: CreateMarketplaceBillingUsageRequest, + self, create_billing_usage_request: CreateBillingUsageRequest ) -> InstalledAddOnUsageInstance: """ Asynchronously create the InstalledAddOnUsageInstance - :param create_marketplace_billing_usage_request: + :param create_billing_usage_request: :returns: The created InstalledAddOnUsageInstance """ - data = create_marketplace_billing_usage_request.to_dict() + data = create_billing_usage_request.to_dict() headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) headers["Content-Type"] = "application/json" diff --git a/twilio/rest/numbers/v2/regulatory_compliance/regulation.py b/twilio/rest/numbers/v2/regulatory_compliance/regulation.py index 9d9a508810..706853bcee 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/regulation.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/regulation.py @@ -13,7 +13,7 @@ """ from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import values +from twilio.base import serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -72,23 +72,33 @@ def _proxy(self) -> "RegulationContext": ) return self._context - def fetch(self) -> "RegulationInstance": + def fetch( + self, include_constraints: Union[bool, object] = values.unset + ) -> "RegulationInstance": """ Fetch the RegulationInstance + :param include_constraints: A boolean parameter indicating whether to include constraints or not for supporting end user, documents and their fields :returns: The fetched RegulationInstance """ - return self._proxy.fetch() + return self._proxy.fetch( + include_constraints=include_constraints, + ) - async def fetch_async(self) -> "RegulationInstance": + async def fetch_async( + self, include_constraints: Union[bool, object] = values.unset + ) -> "RegulationInstance": """ Asynchronous coroutine to fetch the RegulationInstance + :param include_constraints: A boolean parameter indicating whether to include constraints or not for supporting end user, documents and their fields :returns: The fetched RegulationInstance """ - return await self._proxy.fetch_async() + return await self._proxy.fetch_async( + include_constraints=include_constraints, + ) def __repr__(self) -> str: """ @@ -117,36 +127,50 @@ def __init__(self, version: Version, sid: str): } self._uri = "/RegulatoryCompliance/Regulations/{sid}".format(**self._solution) - def fetch(self) -> RegulationInstance: + def fetch( + self, include_constraints: Union[bool, object] = values.unset + ) -> RegulationInstance: """ Fetch the RegulationInstance + :param include_constraints: A boolean parameter indicating whether to include constraints or not for supporting end user, documents and their fields :returns: The fetched RegulationInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, + data = values.of( + { + "IncludeConstraints": serialize.boolean_to_string(include_constraints), + } ) + payload = self._version.fetch(method="GET", uri=self._uri, params=data) + return RegulationInstance( self._version, payload, sid=self._solution["sid"], ) - async def fetch_async(self) -> RegulationInstance: + async def fetch_async( + self, include_constraints: Union[bool, object] = values.unset + ) -> RegulationInstance: """ Asynchronous coroutine to fetch the RegulationInstance + :param include_constraints: A boolean parameter indicating whether to include constraints or not for supporting end user, documents and their fields :returns: The fetched RegulationInstance """ + data = values.of( + { + "IncludeConstraints": serialize.boolean_to_string(include_constraints), + } + ) + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, params=data ) return RegulationInstance( @@ -202,6 +226,7 @@ def stream( end_user_type: Union["RegulationInstance.EndUserType", object] = values.unset, iso_country: Union[str, object] = values.unset, number_type: Union[str, object] = values.unset, + include_constraints: Union[bool, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> Iterator[RegulationInstance]: @@ -214,6 +239,7 @@ def stream( :param "RegulationInstance.EndUserType" end_user_type: The type of End User the regulation requires - can be `individual` or `business`. :param str iso_country: The ISO country code of the phone number's country. :param str number_type: The type of phone number that the regulatory requiremnt is restricting. + :param bool include_constraints: A boolean parameter indicating whether to include constraints or not for supporting end user, documents and their fields :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 @@ -228,6 +254,7 @@ def stream( end_user_type=end_user_type, iso_country=iso_country, number_type=number_type, + include_constraints=include_constraints, page_size=limits["page_size"], ) @@ -238,6 +265,7 @@ async def stream_async( end_user_type: Union["RegulationInstance.EndUserType", object] = values.unset, iso_country: Union[str, object] = values.unset, number_type: Union[str, object] = values.unset, + include_constraints: Union[bool, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> AsyncIterator[RegulationInstance]: @@ -250,6 +278,7 @@ async def stream_async( :param "RegulationInstance.EndUserType" end_user_type: The type of End User the regulation requires - can be `individual` or `business`. :param str iso_country: The ISO country code of the phone number's country. :param str number_type: The type of phone number that the regulatory requiremnt is restricting. + :param bool include_constraints: A boolean parameter indicating whether to include constraints or not for supporting end user, documents and their fields :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 @@ -264,6 +293,7 @@ async def stream_async( end_user_type=end_user_type, iso_country=iso_country, number_type=number_type, + include_constraints=include_constraints, page_size=limits["page_size"], ) @@ -274,6 +304,7 @@ def list( end_user_type: Union["RegulationInstance.EndUserType", object] = values.unset, iso_country: Union[str, object] = values.unset, number_type: Union[str, object] = values.unset, + include_constraints: Union[bool, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> List[RegulationInstance]: @@ -285,6 +316,7 @@ def list( :param "RegulationInstance.EndUserType" end_user_type: The type of End User the regulation requires - can be `individual` or `business`. :param str iso_country: The ISO country code of the phone number's country. :param str number_type: The type of phone number that the regulatory requiremnt is restricting. + :param bool include_constraints: A boolean parameter indicating whether to include constraints or not for supporting end user, documents and their fields :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 @@ -299,6 +331,7 @@ def list( end_user_type=end_user_type, iso_country=iso_country, number_type=number_type, + include_constraints=include_constraints, limit=limit, page_size=page_size, ) @@ -309,6 +342,7 @@ async def list_async( end_user_type: Union["RegulationInstance.EndUserType", object] = values.unset, iso_country: Union[str, object] = values.unset, number_type: Union[str, object] = values.unset, + include_constraints: Union[bool, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> List[RegulationInstance]: @@ -320,6 +354,7 @@ async def list_async( :param "RegulationInstance.EndUserType" end_user_type: The type of End User the regulation requires - can be `individual` or `business`. :param str iso_country: The ISO country code of the phone number's country. :param str number_type: The type of phone number that the regulatory requiremnt is restricting. + :param bool include_constraints: A boolean parameter indicating whether to include constraints or not for supporting end user, documents and their fields :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 @@ -335,6 +370,7 @@ async def list_async( end_user_type=end_user_type, iso_country=iso_country, number_type=number_type, + include_constraints=include_constraints, limit=limit, page_size=page_size, ) @@ -345,6 +381,7 @@ def page( end_user_type: Union["RegulationInstance.EndUserType", object] = values.unset, iso_country: Union[str, object] = values.unset, number_type: Union[str, object] = values.unset, + include_constraints: Union[bool, object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, page_size: Union[int, object] = values.unset, @@ -356,6 +393,7 @@ def page( :param end_user_type: The type of End User the regulation requires - can be `individual` or `business`. :param iso_country: The ISO country code of the phone number's country. :param number_type: The type of phone number that the regulatory requiremnt is restricting. + :param include_constraints: A boolean parameter indicating whether to include constraints or not for supporting end user, documents and their fields :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 @@ -367,6 +405,7 @@ def page( "EndUserType": end_user_type, "IsoCountry": iso_country, "NumberType": number_type, + "IncludeConstraints": serialize.boolean_to_string(include_constraints), "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -381,6 +420,7 @@ async def page_async( end_user_type: Union["RegulationInstance.EndUserType", object] = values.unset, iso_country: Union[str, object] = values.unset, number_type: Union[str, object] = values.unset, + include_constraints: Union[bool, object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, page_size: Union[int, object] = values.unset, @@ -392,6 +432,7 @@ async def page_async( :param end_user_type: The type of End User the regulation requires - can be `individual` or `business`. :param iso_country: The ISO country code of the phone number's country. :param number_type: The type of phone number that the regulatory requiremnt is restricting. + :param include_constraints: A boolean parameter indicating whether to include constraints or not for supporting end user, documents and their fields :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 @@ -403,6 +444,7 @@ async def page_async( "EndUserType": end_user_type, "IsoCountry": iso_country, "NumberType": number_type, + "IncludeConstraints": serialize.boolean_to_string(include_constraints), "PageToken": page_token, "Page": page_number, "PageSize": page_size, diff --git a/twilio/twiml/voice_response.py b/twilio/twiml/voice_response.py index 6beb109dc5..c6d453e143 100644 --- a/twilio/twiml/voice_response.py +++ b/twilio/twiml/voice_response.py @@ -663,13 +663,81 @@ def siprec( ) ) + def transcription( + self, + name=None, + track=None, + status_callback_url=None, + status_callback_method=None, + inbound_track_label=None, + outbound_track_label=None, + partial_results=None, + language_code=None, + transcription_engine=None, + profanity_filter=None, + speech_model=None, + hints=None, + enable_automatic_punctuation=None, + **kwargs + ): + """ + Create a element -class Siprec(TwiML): - """ TwiML Noun""" + :param name: Friendly name given to the Transcription + :param track: Track to be analyze by the provider + :param status_callback_url: Status Callback URL + :param status_callback_method: Status Callback URL method + :param inbound_track_label: Friendly name given to the Inbound Track + :param outbound_track_label: Friendly name given to the Outbound Track Label + :param partial_results: Indicates if partial results are going to be send to the customer + :param language_code: Language Code used by the transcription engine + :param transcription_engine: Transcription Engine to be used + :param profanity_filter: Enable Profanity Filter + :param speech_model: Speech Model used by the transcription engine + :param hints: Hints to be provided to the transcription engine + :param enable_automatic_punctuation: Enable Automatic Punctuation + :param kwargs: additional attributes + + :returns: element + """ + return self.nest( + Transcription( + name=name, + track=track, + status_callback_url=status_callback_url, + status_callback_method=status_callback_method, + inbound_track_label=inbound_track_label, + outbound_track_label=outbound_track_label, + partial_results=partial_results, + language_code=language_code, + transcription_engine=transcription_engine, + profanity_filter=profanity_filter, + speech_model=speech_model, + hints=hints, + enable_automatic_punctuation=enable_automatic_punctuation, + **kwargs + ) + ) + + +class Transcription(TwiML): + """ TwiML Noun""" def __init__(self, **kwargs): - super(Siprec, self).__init__(**kwargs) - self.name = "Siprec" + super(Transcription, self).__init__(**kwargs) + self.name = "Transcription" + + def config(self, name=None, value=None, **kwargs): + """ + Create a element + + :param name: The name of the custom config + :param value: The value of the custom config + :param kwargs: additional attributes + + :returns: element + """ + return self.nest(Config(name=name, value=value, **kwargs)) def parameter(self, name=None, value=None, **kwargs): """ @@ -692,6 +760,34 @@ def __init__(self, **kwargs): self.name = "Parameter" +class Config(TwiML): + """ TwiML Noun""" + + def __init__(self, **kwargs): + super(Config, self).__init__(**kwargs) + self.name = "Config" + + +class Siprec(TwiML): + """ TwiML Noun""" + + def __init__(self, **kwargs): + super(Siprec, self).__init__(**kwargs) + self.name = "Siprec" + + def parameter(self, name=None, value=None, **kwargs): + """ + Create a element + + :param name: The name of the custom parameter + :param value: The value of the custom parameter + :param kwargs: additional attributes + + :returns: element + """ + return self.nest(Parameter(name=name, value=value, **kwargs)) + + class Stream(TwiML): """ TwiML Noun""" @@ -786,6 +882,62 @@ def siprec( ) ) + def transcription( + self, + name=None, + track=None, + status_callback_url=None, + status_callback_method=None, + inbound_track_label=None, + outbound_track_label=None, + partial_results=None, + language_code=None, + transcription_engine=None, + profanity_filter=None, + speech_model=None, + hints=None, + enable_automatic_punctuation=None, + **kwargs + ): + """ + Create a element + + :param name: Friendly name given to the Transcription + :param track: Track to be analyze by the provider + :param status_callback_url: Status Callback URL + :param status_callback_method: Status Callback URL method + :param inbound_track_label: Friendly name given to the Inbound Track + :param outbound_track_label: Friendly name given to the Outbound Track Label + :param partial_results: Indicates if partial results are going to be send to the customer + :param language_code: Language Code used by the transcription engine + :param transcription_engine: Transcription Engine to be used + :param profanity_filter: Enable Profanity Filter + :param speech_model: Speech Model used by the transcription engine + :param hints: Hints to be provided to the transcription engine + :param enable_automatic_punctuation: Enable Automatic Punctuation + :param kwargs: additional attributes + + :returns: element + """ + return self.nest( + Transcription( + name=name, + track=track, + status_callback_url=status_callback_url, + status_callback_method=status_callback_method, + inbound_track_label=inbound_track_label, + outbound_track_label=outbound_track_label, + partial_results=partial_results, + language_code=language_code, + transcription_engine=transcription_engine, + profanity_filter=profanity_filter, + speech_model=speech_model, + hints=hints, + enable_automatic_punctuation=enable_automatic_punctuation, + **kwargs + ) + ) + class Prompt(TwiML): """ Twiml Verb""" @@ -2614,14 +2766,6 @@ def parameter(self, name=None, value=None, **kwargs): return self.nest(Parameter(name=name, value=value, **kwargs)) -class Config(TwiML): - """ TwiML Noun""" - - def __init__(self, **kwargs): - super(Config, self).__init__(**kwargs) - self.name = "Config" - - class Autopilot(TwiML): """ TwiML Noun""" From 35bc17436ef0542b090472494a0c111b9333c247 Mon Sep 17 00:00:00 2001 From: Twilio Date: Thu, 27 Jun 2024 19:44:50 +0000 Subject: [PATCH 20/87] Release 9.2.2 --- setup.py | 2 +- twilio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index b7fa3a7cf5..76dccd0d66 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name="twilio", - version="9.2.1", + version="9.2.2", description="Twilio API client and TwiML generator", author="Twilio", help_center="https://www.twilio.com/help/contact", diff --git a/twilio/__init__.py b/twilio/__init__.py index f7985b5f36..149012e549 100644 --- a/twilio/__init__.py +++ b/twilio/__init__.py @@ -1,2 +1,2 @@ -__version_info__ = ("9", "2", "1") +__version_info__ = ("9", "2", "2") __version__ = ".".join(__version_info__) From bd426ae6b529a28e8f8da0e5d44cd59c7f00b701 Mon Sep 17 00:00:00 2001 From: Twilio Date: Tue, 2 Jul 2024 09:31:02 +0000 Subject: [PATCH 21/87] [Librarian] Regenerated @ a412066ed53a791734369f33f4b2f579662850b3 e43180215d9b6a7f705d187446184940bb3dfac1 --- CHANGES.md | 6 ++++ .../rest/content/v1/content/approval_fetch.py | 32 +++++++++++-------- twilio/rest/numbers/v1/__init__.py | 24 +++++--------- ...hook_configuration_fetch.py => webhook.py} | 26 +++++++-------- 4 files changed, 45 insertions(+), 43 deletions(-) rename twilio/rest/numbers/v1/{porting_webhook_configuration_fetch.py => webhook.py} (76%) diff --git a/CHANGES.md b/CHANGES.md index 1d0111abde..a9e6811010 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,12 @@ twilio-python Changelog Here you can see the full list of changes between each twilio-python release. +[2024-07-02] Version 9.2.3 +-------------------------- +**Intelligence** +- Deprecate account flag api.twilio-intelligence.v2 + + [2024-06-27] Version 9.2.2 -------------------------- **Api** diff --git a/twilio/rest/content/v1/content/approval_fetch.py b/twilio/rest/content/v1/content/approval_fetch.py index f35ef6a48f..f679a920a1 100644 --- a/twilio/rest/content/v1/content/approval_fetch.py +++ b/twilio/rest/content/v1/content/approval_fetch.py @@ -27,7 +27,7 @@ class ApprovalFetchInstance(InstanceResource): :ivar url: The URL of the resource, relative to `https://content.twilio.com`. """ - def __init__(self, version: Version, payload: Dict[str, Any], sid: str): + def __init__(self, version: Version, payload: Dict[str, Any], content_sid: str): super().__init__(version) self.sid: Optional[str] = payload.get("sid") @@ -36,7 +36,7 @@ def __init__(self, version: Version, payload: Dict[str, Any], sid: str): self.url: Optional[str] = payload.get("url") self._solution = { - "sid": sid, + "content_sid": content_sid, } self._context: Optional[ApprovalFetchContext] = None @@ -51,7 +51,7 @@ def _proxy(self) -> "ApprovalFetchContext": if self._context is None: self._context = ApprovalFetchContext( self._version, - sid=self._solution["sid"], + content_sid=self._solution["content_sid"], ) return self._context @@ -85,20 +85,20 @@ def __repr__(self) -> str: class ApprovalFetchContext(InstanceContext): - def __init__(self, version: Version, sid: str): + def __init__(self, version: Version, content_sid: str): """ Initialize the ApprovalFetchContext :param version: Version that contains the resource - :param sid: The Twilio-provided string that uniquely identifies the Content resource whose approval information to fetch. + :param content_sid: The Twilio-provided string that uniquely identifies the Content resource whose approval information to fetch. """ super().__init__(version) # Path Solution self._solution = { - "sid": sid, + "content_sid": content_sid, } - self._uri = "/Content/{sid}/ApprovalRequests".format(**self._solution) + self._uri = "/Content/{content_sid}/ApprovalRequests".format(**self._solution) def fetch(self) -> ApprovalFetchInstance: """ @@ -116,7 +116,7 @@ def fetch(self) -> ApprovalFetchInstance: return ApprovalFetchInstance( self._version, payload, - sid=self._solution["sid"], + content_sid=self._solution["content_sid"], ) async def fetch_async(self) -> ApprovalFetchInstance: @@ -135,7 +135,7 @@ async def fetch_async(self) -> ApprovalFetchInstance: return ApprovalFetchInstance( self._version, payload, - sid=self._solution["sid"], + content_sid=self._solution["content_sid"], ) def __repr__(self) -> str: @@ -150,19 +150,19 @@ def __repr__(self) -> str: class ApprovalFetchList(ListResource): - def __init__(self, version: Version, sid: str): + def __init__(self, version: Version, content_sid: str): """ Initialize the ApprovalFetchList :param version: Version that contains the resource - :param sid: The Twilio-provided string that uniquely identifies the Content resource whose approval information to fetch. + :param content_sid: The Twilio-provided string that uniquely identifies the Content resource whose approval information to fetch. """ super().__init__(version) # Path Solution self._solution = { - "sid": sid, + "content_sid": content_sid, } def get(self) -> ApprovalFetchContext: @@ -170,14 +170,18 @@ def get(self) -> ApprovalFetchContext: Constructs a ApprovalFetchContext """ - return ApprovalFetchContext(self._version, sid=self._solution["sid"]) + return ApprovalFetchContext( + self._version, content_sid=self._solution["content_sid"] + ) def __call__(self) -> ApprovalFetchContext: """ Constructs a ApprovalFetchContext """ - return ApprovalFetchContext(self._version, sid=self._solution["sid"]) + return ApprovalFetchContext( + self._version, content_sid=self._solution["content_sid"] + ) def __repr__(self) -> str: """ diff --git a/twilio/rest/numbers/v1/__init__.py b/twilio/rest/numbers/v1/__init__.py index 043364c3d5..68f078a88d 100644 --- a/twilio/rest/numbers/v1/__init__.py +++ b/twilio/rest/numbers/v1/__init__.py @@ -28,12 +28,10 @@ from twilio.rest.numbers.v1.porting_webhook_configuration_delete import ( PortingWebhookConfigurationDeleteList, ) -from twilio.rest.numbers.v1.porting_webhook_configuration_fetch import ( - PortingWebhookConfigurationFetchList, -) from twilio.rest.numbers.v1.signing_request_configuration import ( SigningRequestConfigurationList, ) +from twilio.rest.numbers.v1.webhook import WebhookList class V1(Version): @@ -58,12 +56,10 @@ def __init__(self, domain: Domain): self._porting_webhook_configurations_delete: Optional[ PortingWebhookConfigurationDeleteList ] = None - self._porting_webhook_configuration_fetch: Optional[ - PortingWebhookConfigurationFetchList - ] = None self._signing_request_configurations: Optional[ SigningRequestConfigurationList ] = None + self._webhook: Optional[WebhookList] = None @property def bulk_eligibilities(self) -> BulkEligibilityList: @@ -111,22 +107,18 @@ def porting_webhook_configurations_delete( ) return self._porting_webhook_configurations_delete - @property - def porting_webhook_configuration_fetch( - self, - ) -> PortingWebhookConfigurationFetchList: - if self._porting_webhook_configuration_fetch is None: - self._porting_webhook_configuration_fetch = ( - PortingWebhookConfigurationFetchList(self) - ) - return self._porting_webhook_configuration_fetch - @property def signing_request_configurations(self) -> SigningRequestConfigurationList: if self._signing_request_configurations is None: self._signing_request_configurations = SigningRequestConfigurationList(self) return self._signing_request_configurations + @property + def webhook(self) -> WebhookList: + if self._webhook is None: + self._webhook = WebhookList(self) + return self._webhook + def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py b/twilio/rest/numbers/v1/webhook.py similarity index 76% rename from twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py rename to twilio/rest/numbers/v1/webhook.py index 0119fe002f..0986db12f3 100644 --- a/twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py +++ b/twilio/rest/numbers/v1/webhook.py @@ -21,7 +21,7 @@ from twilio.base.version import Version -class PortingWebhookConfigurationFetchInstance(InstanceResource): +class WebhookInstance(InstanceResource): """ :ivar url: The URL of the webhook configuration request :ivar port_in_target_url: Webhook URL to send a request when a port in request or port in phone number event happens @@ -52,14 +52,14 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" -class PortingWebhookConfigurationFetchList(ListResource): +class WebhookList(ListResource): def __init__(self, version: Version): """ - Initialize the PortingWebhookConfigurationFetchList + Initialize the WebhookList :param version: Version that contains the resource @@ -68,25 +68,25 @@ def __init__(self, version: Version): self._uri = "/Porting/Configuration/Webhook" - def fetch(self) -> PortingWebhookConfigurationFetchInstance: + def fetch(self) -> WebhookInstance: """ - Asynchronously fetch the PortingWebhookConfigurationFetchInstance + Asynchronously fetch the WebhookInstance - :returns: The fetched PortingWebhookConfigurationFetchInstance + :returns: The fetched WebhookInstance """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) - return PortingWebhookConfigurationFetchInstance(self._version, payload) + return WebhookInstance(self._version, payload) - async def fetch_async(self) -> PortingWebhookConfigurationFetchInstance: + async def fetch_async(self) -> WebhookInstance: """ - Asynchronously fetch the PortingWebhookConfigurationFetchInstance + Asynchronously fetch the WebhookInstance - :returns: The fetched PortingWebhookConfigurationFetchInstance + :returns: The fetched WebhookInstance """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -94,7 +94,7 @@ async def fetch_async(self) -> PortingWebhookConfigurationFetchInstance: method="GET", uri=self._uri, headers=headers ) - return PortingWebhookConfigurationFetchInstance(self._version, payload) + return WebhookInstance(self._version, payload) def __repr__(self) -> str: """ @@ -102,4 +102,4 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" From 6324a1cf55ebf7efcb20f67fdb6ed1fbe1f31e10 Mon Sep 17 00:00:00 2001 From: Twilio Date: Tue, 2 Jul 2024 09:35:15 +0000 Subject: [PATCH 22/87] Release 9.2.3 --- setup.py | 2 +- twilio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 76dccd0d66..8fee9aa182 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name="twilio", - version="9.2.2", + version="9.2.3", description="Twilio API client and TwiML generator", author="Twilio", help_center="https://www.twilio.com/help/contact", diff --git a/twilio/__init__.py b/twilio/__init__.py index 149012e549..bb8cd36f5d 100644 --- a/twilio/__init__.py +++ b/twilio/__init__.py @@ -1,2 +1,2 @@ -__version_info__ = ("9", "2", "2") +__version_info__ = ("9", "2", "3") __version__ = ".".join(__version_info__) From dd72ebead6ced3eef5c5faf92b2bb2a1d88506ff Mon Sep 17 00:00:00 2001 From: Manisha Singh Date: Mon, 22 Jul 2024 21:32:03 +0530 Subject: [PATCH 23/87] chore: oauth sdk implementation (#804) --- twilio/rest/marketplace/__init__.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 twilio/rest/marketplace/__init__.py diff --git a/twilio/rest/marketplace/__init__.py b/twilio/rest/marketplace/__init__.py new file mode 100644 index 0000000000..79b10ef6c4 --- /dev/null +++ b/twilio/rest/marketplace/__init__.py @@ -0,0 +1,10 @@ +from twilio.rest.marketplace.MarketplaceBase import MarketplaceBase + + +class Marketplace(MarketplaceBase): + def available_add_ons(self): + return self.v1.available_add_ons + + def installed_add_ons(self): + return self.v1.installed_add_ons + From 0cd40b58765fc669f8c6093343d08bda605577f3 Mon Sep 17 00:00:00 2001 From: Shubham Date: Fri, 2 Aug 2024 16:13:43 +0530 Subject: [PATCH 24/87] chore: update intersphinx_mapping (#807) * chore: test change * chore: update intersphinx_mapping * chore: fixed quotes * chore: updating docs link --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 405c2e99af..017b358093 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -203,4 +203,4 @@ # -- Options for intersphinx extension --------------------------------------- # Example configuration for intersphinx: refer to the Python standard library. -intersphinx_mapping = {"https://docs.python.org/": None} +intersphinx_mapping = {"python": ("https://docs.python.org/3", None)} From fdd6edce6310e9bc7dfed866037ec287e3708813 Mon Sep 17 00:00:00 2001 From: Manisha Singh Date: Mon, 12 Aug 2024 11:43:52 +0530 Subject: [PATCH 25/87] chore: preview iam removal (#808) --- twilio/rest/__init__.py | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/twilio/rest/__init__.py b/twilio/rest/__init__.py index 31d114a6c0..2c1aa3b9dc 100644 --- a/twilio/rest/__init__.py +++ b/twilio/rest/__init__.py @@ -23,7 +23,6 @@ from twilio.rest.events import Events from twilio.rest.flex_api import FlexApi from twilio.rest.frontline_api import FrontlineApi - from twilio.rest.preview_iam import PreviewIam from twilio.rest.insights import Insights from twilio.rest.intelligence import Intelligence from twilio.rest.ip_messaging import IpMessaging @@ -132,7 +131,6 @@ def __init__( self._events: Optional["Events"] = None self._flex_api: Optional["FlexApi"] = None self._frontline_api: Optional["FrontlineApi"] = None - self._preview_iam: Optional["PreviewIam"] = None self._insights: Optional["Insights"] = None self._intelligence: Optional["Intelligence"] = None self._ip_messaging: Optional["IpMessaging"] = None @@ -277,18 +275,6 @@ def frontline_api(self) -> "FrontlineApi": self._frontline_api = FrontlineApi(self) return self._frontline_api - @property - def preview_iam(self) -> "PreviewIam": - """ - Access the PreviewIam Twilio Domain - - :returns: PreviewIam Twilio Domain - """ - if self._preview_iam is None: - from twilio.rest.preview_iam import PreviewIam - - self._preview_iam = PreviewIam(self) - return self._preview_iam @property def insights(self) -> "Insights": From 2b875ec54e34cfa3bbebc6f439ca6ccfafb3fd75 Mon Sep 17 00:00:00 2001 From: Matthias Schoettle Date: Fri, 23 Aug 2024 12:57:58 -0400 Subject: [PATCH 26/87] chore: add license identifier to project metadata (#810) --- setup.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.cfg b/setup.cfg index c8673986ed..0df04dde4d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -3,6 +3,7 @@ universal = 1 [metadata] description-file = README.md +license = MIT [flake8] exclude = ./twilio/rest,./twilio/twiml,./tests/integration From f4e7765caccd0063c13eff105f611efa8488422e Mon Sep 17 00:00:00 2001 From: Twilio Date: Mon, 26 Aug 2024 11:18:54 +0000 Subject: [PATCH 27/87] [Librarian] Regenerated @ c8ce9820730ef3b2a48912311d45afb8c26b9ee7 2ee5b1fa49840dd67929ff69952e93618b74425b --- CHANGES.md | 43 + twilio/rest/__init__.py | 1 - .../api/v2010/account/call/transcription.py | 1204 +---------------- .../api/v2010/account/message/__init__.py | 4 +- .../{payload.py => payload/__init__.py} | 25 + .../recording/add_on_result/payload/data.py | 242 ++++ twilio/rest/content/v1/content/__init__.py | 116 +- .../content/v1/content/approval_create.py | 2 +- twilio/rest/flex_api/v2/flex_user.py | 164 ++- twilio/rest/insights/v1/call_summaries.py | 196 ++- twilio/rest/intelligence/v2/operator_type.py | 6 +- .../intelligence/v2/transcript/sentence.py | 30 +- twilio/rest/marketplace/__init__.py | 1 - twilio/rest/marketplace/v1/__init__.py | 8 + .../installed_add_on_usage.py | 30 +- .../marketplace/v1/module_data_management.py | 28 +- .../marketplace/v1/referral_conversion.py | 198 +++ twilio/rest/messaging/v1/external_campaign.py | 18 +- .../messaging/v1/service/channel_sender.py | 94 ++ twilio/rest/numbers/v1/__init__.py | 24 +- twilio/rest/numbers/v1/porting_port_in.py | 16 +- .../v1/porting_port_in_phone_number.py | 38 +- twilio/rest/numbers/v1/porting_portability.py | 22 +- .../v1/porting_webhook_configuration.py | 6 +- .../porting_webhook_configuration_delete.py | 6 +- ...=> porting_webhook_configuration_fetch.py} | 32 +- .../v1/signing_request_configuration.py | 243 +++- twilio/rest/numbers/v2/__init__.py | 8 + twilio/rest/numbers/v2/bundle_clone.py | 268 ++++ .../regulatory_compliance/bundle/__init__.py | 6 + .../taskrouter/v1/workspace/task/__init__.py | 6 +- .../rest/trusthub/v1/compliance_inquiries.py | 26 +- twilio/rest/verify/v2/service/__init__.py | 14 +- 33 files changed, 1767 insertions(+), 1358 deletions(-) rename twilio/rest/api/v2010/account/recording/add_on_result/{payload.py => payload/__init__.py} (96%) create mode 100644 twilio/rest/api/v2010/account/recording/add_on_result/payload/data.py create mode 100644 twilio/rest/marketplace/v1/referral_conversion.py rename twilio/rest/numbers/v1/{webhook.py => porting_webhook_configuration_fetch.py} (64%) create mode 100644 twilio/rest/numbers/v2/bundle_clone.py diff --git a/CHANGES.md b/CHANGES.md index a9e6811010..2222dfc4d5 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,49 @@ twilio-python Changelog Here you can see the full list of changes between each twilio-python release. +[2024-08-26] Version 9.2.4 +-------------------------- +**Library - Chore** +- [PR #810](https://github.com/twilio/twilio-python/pull/810): add license identifier to project metadata. Thanks to [@mschoettle](https://github.com/mschoettle)! +- [PR #808](https://github.com/twilio/twilio-python/pull/808): preview iam removal. Thanks to [@manisha1997](https://github.com/manisha1997)! +- [PR #807](https://github.com/twilio/twilio-python/pull/807): update intersphinx_mapping. Thanks to [@tiwarishubham635](https://github.com/tiwarishubham635)! +- [PR #804](https://github.com/twilio/twilio-python/pull/804): add init file. Thanks to [@manisha1997](https://github.com/manisha1997)! + +**Api** +- Update documentation of `error_code` and `error_message` on the Message resource. +- Remove generic parameters from `transcription` resource +- Added public documentation for Payload Data retrieval API + +**Flex** +- Adding update Flex User api + +**Insights** +- Added 'branded', 'business_profile' and 'voice_integrity' fields in List Call Summary + +**Intelligence** +- Add `words` array information to the Sentences v2 entity. +- Add `X-Rate-Limit-Limit`, `X-Rate-Limit-Remaining`, and `X-Rate-Limit-Config` headers for Operator Results. +- Change the path parameter when fetching an `/OperatorType/{}` from `sid` to `string` to support searching by SID or by name +- Add `X-Rate-Limit-Limit`, `X-Rate-Limit-Remaining`, and `X-Rate-Limit-Config` headers for Transcript and Service endpoints. + +**Messaging** +- Adds two new channel senders api to add/remove channel senders to/from a messaging service +- Extend ERC api to accept an optional attribute in request body to indicate CNP migration for an ERC + +**Numbers** +- Modify visibility to public in bundle clone API +- Add `port_date` field to Port In Request and Port In Phone Numbers Fetch APIs +- Change properties docs for port in phone numbers api +- Add is_test body param to the Bundle Create API +- Change properties docs for port in api + +**Trusthub** +- Add new field in themeSetId in compliance_inquiry. + +**Verify** +- Update `custom_code_enabled` description on verification docs + + [2024-07-02] Version 9.2.3 -------------------------- **Intelligence** diff --git a/twilio/rest/__init__.py b/twilio/rest/__init__.py index 2c1aa3b9dc..2dc0a4930f 100644 --- a/twilio/rest/__init__.py +++ b/twilio/rest/__init__.py @@ -275,7 +275,6 @@ def frontline_api(self) -> "FrontlineApi": self._frontline_api = FrontlineApi(self) return self._frontline_api - @property def insights(self) -> "Insights": """ diff --git a/twilio/rest/api/v2010/account/call/transcription.py b/twilio/rest/api/v2010/account/call/transcription.py index 96554eaa02..d4aa87e3df 100644 --- a/twilio/rest/api/v2010/account/call/transcription.py +++ b/twilio/rest/api/v2010/account/call/transcription.py @@ -261,204 +261,6 @@ def create( speech_model: Union[str, object] = values.unset, hints: Union[str, object] = values.unset, enable_automatic_punctuation: Union[bool, object] = values.unset, - parameter1_name: Union[str, object] = values.unset, - parameter1_value: Union[str, object] = values.unset, - parameter2_name: Union[str, object] = values.unset, - parameter2_value: Union[str, object] = values.unset, - parameter3_name: Union[str, object] = values.unset, - parameter3_value: Union[str, object] = values.unset, - parameter4_name: Union[str, object] = values.unset, - parameter4_value: Union[str, object] = values.unset, - parameter5_name: Union[str, object] = values.unset, - parameter5_value: Union[str, object] = values.unset, - parameter6_name: Union[str, object] = values.unset, - parameter6_value: Union[str, object] = values.unset, - parameter7_name: Union[str, object] = values.unset, - parameter7_value: Union[str, object] = values.unset, - parameter8_name: Union[str, object] = values.unset, - parameter8_value: Union[str, object] = values.unset, - parameter9_name: Union[str, object] = values.unset, - parameter9_value: Union[str, object] = values.unset, - parameter10_name: Union[str, object] = values.unset, - parameter10_value: Union[str, object] = values.unset, - parameter11_name: Union[str, object] = values.unset, - parameter11_value: Union[str, object] = values.unset, - parameter12_name: Union[str, object] = values.unset, - parameter12_value: Union[str, object] = values.unset, - parameter13_name: Union[str, object] = values.unset, - parameter13_value: Union[str, object] = values.unset, - parameter14_name: Union[str, object] = values.unset, - parameter14_value: Union[str, object] = values.unset, - parameter15_name: Union[str, object] = values.unset, - parameter15_value: Union[str, object] = values.unset, - parameter16_name: Union[str, object] = values.unset, - parameter16_value: Union[str, object] = values.unset, - parameter17_name: Union[str, object] = values.unset, - parameter17_value: Union[str, object] = values.unset, - parameter18_name: Union[str, object] = values.unset, - parameter18_value: Union[str, object] = values.unset, - parameter19_name: Union[str, object] = values.unset, - parameter19_value: Union[str, object] = values.unset, - parameter20_name: Union[str, object] = values.unset, - parameter20_value: Union[str, object] = values.unset, - parameter21_name: Union[str, object] = values.unset, - parameter21_value: Union[str, object] = values.unset, - parameter22_name: Union[str, object] = values.unset, - parameter22_value: Union[str, object] = values.unset, - parameter23_name: Union[str, object] = values.unset, - parameter23_value: Union[str, object] = values.unset, - parameter24_name: Union[str, object] = values.unset, - parameter24_value: Union[str, object] = values.unset, - parameter25_name: Union[str, object] = values.unset, - parameter25_value: Union[str, object] = values.unset, - parameter26_name: Union[str, object] = values.unset, - parameter26_value: Union[str, object] = values.unset, - parameter27_name: Union[str, object] = values.unset, - parameter27_value: Union[str, object] = values.unset, - parameter28_name: Union[str, object] = values.unset, - parameter28_value: Union[str, object] = values.unset, - parameter29_name: Union[str, object] = values.unset, - parameter29_value: Union[str, object] = values.unset, - parameter30_name: Union[str, object] = values.unset, - parameter30_value: Union[str, object] = values.unset, - parameter31_name: Union[str, object] = values.unset, - parameter31_value: Union[str, object] = values.unset, - parameter32_name: Union[str, object] = values.unset, - parameter32_value: Union[str, object] = values.unset, - parameter33_name: Union[str, object] = values.unset, - parameter33_value: Union[str, object] = values.unset, - parameter34_name: Union[str, object] = values.unset, - parameter34_value: Union[str, object] = values.unset, - parameter35_name: Union[str, object] = values.unset, - parameter35_value: Union[str, object] = values.unset, - parameter36_name: Union[str, object] = values.unset, - parameter36_value: Union[str, object] = values.unset, - parameter37_name: Union[str, object] = values.unset, - parameter37_value: Union[str, object] = values.unset, - parameter38_name: Union[str, object] = values.unset, - parameter38_value: Union[str, object] = values.unset, - parameter39_name: Union[str, object] = values.unset, - parameter39_value: Union[str, object] = values.unset, - parameter40_name: Union[str, object] = values.unset, - parameter40_value: Union[str, object] = values.unset, - parameter41_name: Union[str, object] = values.unset, - parameter41_value: Union[str, object] = values.unset, - parameter42_name: Union[str, object] = values.unset, - parameter42_value: Union[str, object] = values.unset, - parameter43_name: Union[str, object] = values.unset, - parameter43_value: Union[str, object] = values.unset, - parameter44_name: Union[str, object] = values.unset, - parameter44_value: Union[str, object] = values.unset, - parameter45_name: Union[str, object] = values.unset, - parameter45_value: Union[str, object] = values.unset, - parameter46_name: Union[str, object] = values.unset, - parameter46_value: Union[str, object] = values.unset, - parameter47_name: Union[str, object] = values.unset, - parameter47_value: Union[str, object] = values.unset, - parameter48_name: Union[str, object] = values.unset, - parameter48_value: Union[str, object] = values.unset, - parameter49_name: Union[str, object] = values.unset, - parameter49_value: Union[str, object] = values.unset, - parameter50_name: Union[str, object] = values.unset, - parameter50_value: Union[str, object] = values.unset, - parameter51_name: Union[str, object] = values.unset, - parameter51_value: Union[str, object] = values.unset, - parameter52_name: Union[str, object] = values.unset, - parameter52_value: Union[str, object] = values.unset, - parameter53_name: Union[str, object] = values.unset, - parameter53_value: Union[str, object] = values.unset, - parameter54_name: Union[str, object] = values.unset, - parameter54_value: Union[str, object] = values.unset, - parameter55_name: Union[str, object] = values.unset, - parameter55_value: Union[str, object] = values.unset, - parameter56_name: Union[str, object] = values.unset, - parameter56_value: Union[str, object] = values.unset, - parameter57_name: Union[str, object] = values.unset, - parameter57_value: Union[str, object] = values.unset, - parameter58_name: Union[str, object] = values.unset, - parameter58_value: Union[str, object] = values.unset, - parameter59_name: Union[str, object] = values.unset, - parameter59_value: Union[str, object] = values.unset, - parameter60_name: Union[str, object] = values.unset, - parameter60_value: Union[str, object] = values.unset, - parameter61_name: Union[str, object] = values.unset, - parameter61_value: Union[str, object] = values.unset, - parameter62_name: Union[str, object] = values.unset, - parameter62_value: Union[str, object] = values.unset, - parameter63_name: Union[str, object] = values.unset, - parameter63_value: Union[str, object] = values.unset, - parameter64_name: Union[str, object] = values.unset, - parameter64_value: Union[str, object] = values.unset, - parameter65_name: Union[str, object] = values.unset, - parameter65_value: Union[str, object] = values.unset, - parameter66_name: Union[str, object] = values.unset, - parameter66_value: Union[str, object] = values.unset, - parameter67_name: Union[str, object] = values.unset, - parameter67_value: Union[str, object] = values.unset, - parameter68_name: Union[str, object] = values.unset, - parameter68_value: Union[str, object] = values.unset, - parameter69_name: Union[str, object] = values.unset, - parameter69_value: Union[str, object] = values.unset, - parameter70_name: Union[str, object] = values.unset, - parameter70_value: Union[str, object] = values.unset, - parameter71_name: Union[str, object] = values.unset, - parameter71_value: Union[str, object] = values.unset, - parameter72_name: Union[str, object] = values.unset, - parameter72_value: Union[str, object] = values.unset, - parameter73_name: Union[str, object] = values.unset, - parameter73_value: Union[str, object] = values.unset, - parameter74_name: Union[str, object] = values.unset, - parameter74_value: Union[str, object] = values.unset, - parameter75_name: Union[str, object] = values.unset, - parameter75_value: Union[str, object] = values.unset, - parameter76_name: Union[str, object] = values.unset, - parameter76_value: Union[str, object] = values.unset, - parameter77_name: Union[str, object] = values.unset, - parameter77_value: Union[str, object] = values.unset, - parameter78_name: Union[str, object] = values.unset, - parameter78_value: Union[str, object] = values.unset, - parameter79_name: Union[str, object] = values.unset, - parameter79_value: Union[str, object] = values.unset, - parameter80_name: Union[str, object] = values.unset, - parameter80_value: Union[str, object] = values.unset, - parameter81_name: Union[str, object] = values.unset, - parameter81_value: Union[str, object] = values.unset, - parameter82_name: Union[str, object] = values.unset, - parameter82_value: Union[str, object] = values.unset, - parameter83_name: Union[str, object] = values.unset, - parameter83_value: Union[str, object] = values.unset, - parameter84_name: Union[str, object] = values.unset, - parameter84_value: Union[str, object] = values.unset, - parameter85_name: Union[str, object] = values.unset, - parameter85_value: Union[str, object] = values.unset, - parameter86_name: Union[str, object] = values.unset, - parameter86_value: Union[str, object] = values.unset, - parameter87_name: Union[str, object] = values.unset, - parameter87_value: Union[str, object] = values.unset, - parameter88_name: Union[str, object] = values.unset, - parameter88_value: Union[str, object] = values.unset, - parameter89_name: Union[str, object] = values.unset, - parameter89_value: Union[str, object] = values.unset, - parameter90_name: Union[str, object] = values.unset, - parameter90_value: Union[str, object] = values.unset, - parameter91_name: Union[str, object] = values.unset, - parameter91_value: Union[str, object] = values.unset, - parameter92_name: Union[str, object] = values.unset, - parameter92_value: Union[str, object] = values.unset, - parameter93_name: Union[str, object] = values.unset, - parameter93_value: Union[str, object] = values.unset, - parameter94_name: Union[str, object] = values.unset, - parameter94_value: Union[str, object] = values.unset, - parameter95_name: Union[str, object] = values.unset, - parameter95_value: Union[str, object] = values.unset, - parameter96_name: Union[str, object] = values.unset, - parameter96_value: Union[str, object] = values.unset, - parameter97_name: Union[str, object] = values.unset, - parameter97_value: Union[str, object] = values.unset, - parameter98_name: Union[str, object] = values.unset, - parameter98_value: Union[str, object] = values.unset, - parameter99_name: Union[str, object] = values.unset, - parameter99_value: Union[str, object] = values.unset, ) -> TranscriptionInstance: """ Create the TranscriptionInstance @@ -469,211 +271,13 @@ def create( :param status_callback_method: The http method for the status_callback (one of GET, POST). :param inbound_track_label: Friendly name given to the Inbound Track :param outbound_track_label: Friendly name given to the Outbound Track - :param partial_results: Indicates if partial results are going to be send to the customer + :param partial_results: Indicates if partial results are going to be sent to the customer :param language_code: Language code used by the transcription engine, specified in [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) format - :param transcription_engine: Definition of the transcription engine to be used, between those supported by Twilio + :param transcription_engine: Definition of the transcription engine to be used, among those supported by Twilio :param profanity_filter: indicates if the server will attempt to filter out profanities, replacing all but the initial character in each filtered word with asterisks - :param speech_model: Recognition model used by the transcription engine, between those supported by the provider + :param speech_model: Recognition model used by the transcription engine, among those supported by the provider :param hints: A Phrase contains words and phrase \\\"hints\\\" so that the speech recognition engine is more likely to recognize them. - :param enable_automatic_punctuation: The provider will adds punctuation to recognition result hypotheses - :param parameter1_name: Parameter name - :param parameter1_value: Parameter value - :param parameter2_name: Parameter name - :param parameter2_value: Parameter value - :param parameter3_name: Parameter name - :param parameter3_value: Parameter value - :param parameter4_name: Parameter name - :param parameter4_value: Parameter value - :param parameter5_name: Parameter name - :param parameter5_value: Parameter value - :param parameter6_name: Parameter name - :param parameter6_value: Parameter value - :param parameter7_name: Parameter name - :param parameter7_value: Parameter value - :param parameter8_name: Parameter name - :param parameter8_value: Parameter value - :param parameter9_name: Parameter name - :param parameter9_value: Parameter value - :param parameter10_name: Parameter name - :param parameter10_value: Parameter value - :param parameter11_name: Parameter name - :param parameter11_value: Parameter value - :param parameter12_name: Parameter name - :param parameter12_value: Parameter value - :param parameter13_name: Parameter name - :param parameter13_value: Parameter value - :param parameter14_name: Parameter name - :param parameter14_value: Parameter value - :param parameter15_name: Parameter name - :param parameter15_value: Parameter value - :param parameter16_name: Parameter name - :param parameter16_value: Parameter value - :param parameter17_name: Parameter name - :param parameter17_value: Parameter value - :param parameter18_name: Parameter name - :param parameter18_value: Parameter value - :param parameter19_name: Parameter name - :param parameter19_value: Parameter value - :param parameter20_name: Parameter name - :param parameter20_value: Parameter value - :param parameter21_name: Parameter name - :param parameter21_value: Parameter value - :param parameter22_name: Parameter name - :param parameter22_value: Parameter value - :param parameter23_name: Parameter name - :param parameter23_value: Parameter value - :param parameter24_name: Parameter name - :param parameter24_value: Parameter value - :param parameter25_name: Parameter name - :param parameter25_value: Parameter value - :param parameter26_name: Parameter name - :param parameter26_value: Parameter value - :param parameter27_name: Parameter name - :param parameter27_value: Parameter value - :param parameter28_name: Parameter name - :param parameter28_value: Parameter value - :param parameter29_name: Parameter name - :param parameter29_value: Parameter value - :param parameter30_name: Parameter name - :param parameter30_value: Parameter value - :param parameter31_name: Parameter name - :param parameter31_value: Parameter value - :param parameter32_name: Parameter name - :param parameter32_value: Parameter value - :param parameter33_name: Parameter name - :param parameter33_value: Parameter value - :param parameter34_name: Parameter name - :param parameter34_value: Parameter value - :param parameter35_name: Parameter name - :param parameter35_value: Parameter value - :param parameter36_name: Parameter name - :param parameter36_value: Parameter value - :param parameter37_name: Parameter name - :param parameter37_value: Parameter value - :param parameter38_name: Parameter name - :param parameter38_value: Parameter value - :param parameter39_name: Parameter name - :param parameter39_value: Parameter value - :param parameter40_name: Parameter name - :param parameter40_value: Parameter value - :param parameter41_name: Parameter name - :param parameter41_value: Parameter value - :param parameter42_name: Parameter name - :param parameter42_value: Parameter value - :param parameter43_name: Parameter name - :param parameter43_value: Parameter value - :param parameter44_name: Parameter name - :param parameter44_value: Parameter value - :param parameter45_name: Parameter name - :param parameter45_value: Parameter value - :param parameter46_name: Parameter name - :param parameter46_value: Parameter value - :param parameter47_name: Parameter name - :param parameter47_value: Parameter value - :param parameter48_name: Parameter name - :param parameter48_value: Parameter value - :param parameter49_name: Parameter name - :param parameter49_value: Parameter value - :param parameter50_name: Parameter name - :param parameter50_value: Parameter value - :param parameter51_name: Parameter name - :param parameter51_value: Parameter value - :param parameter52_name: Parameter name - :param parameter52_value: Parameter value - :param parameter53_name: Parameter name - :param parameter53_value: Parameter value - :param parameter54_name: Parameter name - :param parameter54_value: Parameter value - :param parameter55_name: Parameter name - :param parameter55_value: Parameter value - :param parameter56_name: Parameter name - :param parameter56_value: Parameter value - :param parameter57_name: Parameter name - :param parameter57_value: Parameter value - :param parameter58_name: Parameter name - :param parameter58_value: Parameter value - :param parameter59_name: Parameter name - :param parameter59_value: Parameter value - :param parameter60_name: Parameter name - :param parameter60_value: Parameter value - :param parameter61_name: Parameter name - :param parameter61_value: Parameter value - :param parameter62_name: Parameter name - :param parameter62_value: Parameter value - :param parameter63_name: Parameter name - :param parameter63_value: Parameter value - :param parameter64_name: Parameter name - :param parameter64_value: Parameter value - :param parameter65_name: Parameter name - :param parameter65_value: Parameter value - :param parameter66_name: Parameter name - :param parameter66_value: Parameter value - :param parameter67_name: Parameter name - :param parameter67_value: Parameter value - :param parameter68_name: Parameter name - :param parameter68_value: Parameter value - :param parameter69_name: Parameter name - :param parameter69_value: Parameter value - :param parameter70_name: Parameter name - :param parameter70_value: Parameter value - :param parameter71_name: Parameter name - :param parameter71_value: Parameter value - :param parameter72_name: Parameter name - :param parameter72_value: Parameter value - :param parameter73_name: Parameter name - :param parameter73_value: Parameter value - :param parameter74_name: Parameter name - :param parameter74_value: Parameter value - :param parameter75_name: Parameter name - :param parameter75_value: Parameter value - :param parameter76_name: Parameter name - :param parameter76_value: Parameter value - :param parameter77_name: Parameter name - :param parameter77_value: Parameter value - :param parameter78_name: Parameter name - :param parameter78_value: Parameter value - :param parameter79_name: Parameter name - :param parameter79_value: Parameter value - :param parameter80_name: Parameter name - :param parameter80_value: Parameter value - :param parameter81_name: Parameter name - :param parameter81_value: Parameter value - :param parameter82_name: Parameter name - :param parameter82_value: Parameter value - :param parameter83_name: Parameter name - :param parameter83_value: Parameter value - :param parameter84_name: Parameter name - :param parameter84_value: Parameter value - :param parameter85_name: Parameter name - :param parameter85_value: Parameter value - :param parameter86_name: Parameter name - :param parameter86_value: Parameter value - :param parameter87_name: Parameter name - :param parameter87_value: Parameter value - :param parameter88_name: Parameter name - :param parameter88_value: Parameter value - :param parameter89_name: Parameter name - :param parameter89_value: Parameter value - :param parameter90_name: Parameter name - :param parameter90_value: Parameter value - :param parameter91_name: Parameter name - :param parameter91_value: Parameter value - :param parameter92_name: Parameter name - :param parameter92_value: Parameter value - :param parameter93_name: Parameter name - :param parameter93_value: Parameter value - :param parameter94_name: Parameter name - :param parameter94_value: Parameter value - :param parameter95_name: Parameter name - :param parameter95_value: Parameter value - :param parameter96_name: Parameter name - :param parameter96_value: Parameter value - :param parameter97_name: Parameter name - :param parameter97_value: Parameter value - :param parameter98_name: Parameter name - :param parameter98_value: Parameter value - :param parameter99_name: Parameter name - :param parameter99_value: Parameter value + :param enable_automatic_punctuation: The provider will add punctuation to recognition result :returns: The created TranscriptionInstance """ @@ -695,204 +299,6 @@ def create( "EnableAutomaticPunctuation": serialize.boolean_to_string( enable_automatic_punctuation ), - "Parameter1.Name": parameter1_name, - "Parameter1.Value": parameter1_value, - "Parameter2.Name": parameter2_name, - "Parameter2.Value": parameter2_value, - "Parameter3.Name": parameter3_name, - "Parameter3.Value": parameter3_value, - "Parameter4.Name": parameter4_name, - "Parameter4.Value": parameter4_value, - "Parameter5.Name": parameter5_name, - "Parameter5.Value": parameter5_value, - "Parameter6.Name": parameter6_name, - "Parameter6.Value": parameter6_value, - "Parameter7.Name": parameter7_name, - "Parameter7.Value": parameter7_value, - "Parameter8.Name": parameter8_name, - "Parameter8.Value": parameter8_value, - "Parameter9.Name": parameter9_name, - "Parameter9.Value": parameter9_value, - "Parameter10.Name": parameter10_name, - "Parameter10.Value": parameter10_value, - "Parameter11.Name": parameter11_name, - "Parameter11.Value": parameter11_value, - "Parameter12.Name": parameter12_name, - "Parameter12.Value": parameter12_value, - "Parameter13.Name": parameter13_name, - "Parameter13.Value": parameter13_value, - "Parameter14.Name": parameter14_name, - "Parameter14.Value": parameter14_value, - "Parameter15.Name": parameter15_name, - "Parameter15.Value": parameter15_value, - "Parameter16.Name": parameter16_name, - "Parameter16.Value": parameter16_value, - "Parameter17.Name": parameter17_name, - "Parameter17.Value": parameter17_value, - "Parameter18.Name": parameter18_name, - "Parameter18.Value": parameter18_value, - "Parameter19.Name": parameter19_name, - "Parameter19.Value": parameter19_value, - "Parameter20.Name": parameter20_name, - "Parameter20.Value": parameter20_value, - "Parameter21.Name": parameter21_name, - "Parameter21.Value": parameter21_value, - "Parameter22.Name": parameter22_name, - "Parameter22.Value": parameter22_value, - "Parameter23.Name": parameter23_name, - "Parameter23.Value": parameter23_value, - "Parameter24.Name": parameter24_name, - "Parameter24.Value": parameter24_value, - "Parameter25.Name": parameter25_name, - "Parameter25.Value": parameter25_value, - "Parameter26.Name": parameter26_name, - "Parameter26.Value": parameter26_value, - "Parameter27.Name": parameter27_name, - "Parameter27.Value": parameter27_value, - "Parameter28.Name": parameter28_name, - "Parameter28.Value": parameter28_value, - "Parameter29.Name": parameter29_name, - "Parameter29.Value": parameter29_value, - "Parameter30.Name": parameter30_name, - "Parameter30.Value": parameter30_value, - "Parameter31.Name": parameter31_name, - "Parameter31.Value": parameter31_value, - "Parameter32.Name": parameter32_name, - "Parameter32.Value": parameter32_value, - "Parameter33.Name": parameter33_name, - "Parameter33.Value": parameter33_value, - "Parameter34.Name": parameter34_name, - "Parameter34.Value": parameter34_value, - "Parameter35.Name": parameter35_name, - "Parameter35.Value": parameter35_value, - "Parameter36.Name": parameter36_name, - "Parameter36.Value": parameter36_value, - "Parameter37.Name": parameter37_name, - "Parameter37.Value": parameter37_value, - "Parameter38.Name": parameter38_name, - "Parameter38.Value": parameter38_value, - "Parameter39.Name": parameter39_name, - "Parameter39.Value": parameter39_value, - "Parameter40.Name": parameter40_name, - "Parameter40.Value": parameter40_value, - "Parameter41.Name": parameter41_name, - "Parameter41.Value": parameter41_value, - "Parameter42.Name": parameter42_name, - "Parameter42.Value": parameter42_value, - "Parameter43.Name": parameter43_name, - "Parameter43.Value": parameter43_value, - "Parameter44.Name": parameter44_name, - "Parameter44.Value": parameter44_value, - "Parameter45.Name": parameter45_name, - "Parameter45.Value": parameter45_value, - "Parameter46.Name": parameter46_name, - "Parameter46.Value": parameter46_value, - "Parameter47.Name": parameter47_name, - "Parameter47.Value": parameter47_value, - "Parameter48.Name": parameter48_name, - "Parameter48.Value": parameter48_value, - "Parameter49.Name": parameter49_name, - "Parameter49.Value": parameter49_value, - "Parameter50.Name": parameter50_name, - "Parameter50.Value": parameter50_value, - "Parameter51.Name": parameter51_name, - "Parameter51.Value": parameter51_value, - "Parameter52.Name": parameter52_name, - "Parameter52.Value": parameter52_value, - "Parameter53.Name": parameter53_name, - "Parameter53.Value": parameter53_value, - "Parameter54.Name": parameter54_name, - "Parameter54.Value": parameter54_value, - "Parameter55.Name": parameter55_name, - "Parameter55.Value": parameter55_value, - "Parameter56.Name": parameter56_name, - "Parameter56.Value": parameter56_value, - "Parameter57.Name": parameter57_name, - "Parameter57.Value": parameter57_value, - "Parameter58.Name": parameter58_name, - "Parameter58.Value": parameter58_value, - "Parameter59.Name": parameter59_name, - "Parameter59.Value": parameter59_value, - "Parameter60.Name": parameter60_name, - "Parameter60.Value": parameter60_value, - "Parameter61.Name": parameter61_name, - "Parameter61.Value": parameter61_value, - "Parameter62.Name": parameter62_name, - "Parameter62.Value": parameter62_value, - "Parameter63.Name": parameter63_name, - "Parameter63.Value": parameter63_value, - "Parameter64.Name": parameter64_name, - "Parameter64.Value": parameter64_value, - "Parameter65.Name": parameter65_name, - "Parameter65.Value": parameter65_value, - "Parameter66.Name": parameter66_name, - "Parameter66.Value": parameter66_value, - "Parameter67.Name": parameter67_name, - "Parameter67.Value": parameter67_value, - "Parameter68.Name": parameter68_name, - "Parameter68.Value": parameter68_value, - "Parameter69.Name": parameter69_name, - "Parameter69.Value": parameter69_value, - "Parameter70.Name": parameter70_name, - "Parameter70.Value": parameter70_value, - "Parameter71.Name": parameter71_name, - "Parameter71.Value": parameter71_value, - "Parameter72.Name": parameter72_name, - "Parameter72.Value": parameter72_value, - "Parameter73.Name": parameter73_name, - "Parameter73.Value": parameter73_value, - "Parameter74.Name": parameter74_name, - "Parameter74.Value": parameter74_value, - "Parameter75.Name": parameter75_name, - "Parameter75.Value": parameter75_value, - "Parameter76.Name": parameter76_name, - "Parameter76.Value": parameter76_value, - "Parameter77.Name": parameter77_name, - "Parameter77.Value": parameter77_value, - "Parameter78.Name": parameter78_name, - "Parameter78.Value": parameter78_value, - "Parameter79.Name": parameter79_name, - "Parameter79.Value": parameter79_value, - "Parameter80.Name": parameter80_name, - "Parameter80.Value": parameter80_value, - "Parameter81.Name": parameter81_name, - "Parameter81.Value": parameter81_value, - "Parameter82.Name": parameter82_name, - "Parameter82.Value": parameter82_value, - "Parameter83.Name": parameter83_name, - "Parameter83.Value": parameter83_value, - "Parameter84.Name": parameter84_name, - "Parameter84.Value": parameter84_value, - "Parameter85.Name": parameter85_name, - "Parameter85.Value": parameter85_value, - "Parameter86.Name": parameter86_name, - "Parameter86.Value": parameter86_value, - "Parameter87.Name": parameter87_name, - "Parameter87.Value": parameter87_value, - "Parameter88.Name": parameter88_name, - "Parameter88.Value": parameter88_value, - "Parameter89.Name": parameter89_name, - "Parameter89.Value": parameter89_value, - "Parameter90.Name": parameter90_name, - "Parameter90.Value": parameter90_value, - "Parameter91.Name": parameter91_name, - "Parameter91.Value": parameter91_value, - "Parameter92.Name": parameter92_name, - "Parameter92.Value": parameter92_value, - "Parameter93.Name": parameter93_name, - "Parameter93.Value": parameter93_value, - "Parameter94.Name": parameter94_name, - "Parameter94.Value": parameter94_value, - "Parameter95.Name": parameter95_name, - "Parameter95.Value": parameter95_value, - "Parameter96.Name": parameter96_name, - "Parameter96.Value": parameter96_value, - "Parameter97.Name": parameter97_name, - "Parameter97.Value": parameter97_value, - "Parameter98.Name": parameter98_name, - "Parameter98.Value": parameter98_value, - "Parameter99.Name": parameter99_name, - "Parameter99.Value": parameter99_value, } ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -923,204 +329,6 @@ async def create_async( speech_model: Union[str, object] = values.unset, hints: Union[str, object] = values.unset, enable_automatic_punctuation: Union[bool, object] = values.unset, - parameter1_name: Union[str, object] = values.unset, - parameter1_value: Union[str, object] = values.unset, - parameter2_name: Union[str, object] = values.unset, - parameter2_value: Union[str, object] = values.unset, - parameter3_name: Union[str, object] = values.unset, - parameter3_value: Union[str, object] = values.unset, - parameter4_name: Union[str, object] = values.unset, - parameter4_value: Union[str, object] = values.unset, - parameter5_name: Union[str, object] = values.unset, - parameter5_value: Union[str, object] = values.unset, - parameter6_name: Union[str, object] = values.unset, - parameter6_value: Union[str, object] = values.unset, - parameter7_name: Union[str, object] = values.unset, - parameter7_value: Union[str, object] = values.unset, - parameter8_name: Union[str, object] = values.unset, - parameter8_value: Union[str, object] = values.unset, - parameter9_name: Union[str, object] = values.unset, - parameter9_value: Union[str, object] = values.unset, - parameter10_name: Union[str, object] = values.unset, - parameter10_value: Union[str, object] = values.unset, - parameter11_name: Union[str, object] = values.unset, - parameter11_value: Union[str, object] = values.unset, - parameter12_name: Union[str, object] = values.unset, - parameter12_value: Union[str, object] = values.unset, - parameter13_name: Union[str, object] = values.unset, - parameter13_value: Union[str, object] = values.unset, - parameter14_name: Union[str, object] = values.unset, - parameter14_value: Union[str, object] = values.unset, - parameter15_name: Union[str, object] = values.unset, - parameter15_value: Union[str, object] = values.unset, - parameter16_name: Union[str, object] = values.unset, - parameter16_value: Union[str, object] = values.unset, - parameter17_name: Union[str, object] = values.unset, - parameter17_value: Union[str, object] = values.unset, - parameter18_name: Union[str, object] = values.unset, - parameter18_value: Union[str, object] = values.unset, - parameter19_name: Union[str, object] = values.unset, - parameter19_value: Union[str, object] = values.unset, - parameter20_name: Union[str, object] = values.unset, - parameter20_value: Union[str, object] = values.unset, - parameter21_name: Union[str, object] = values.unset, - parameter21_value: Union[str, object] = values.unset, - parameter22_name: Union[str, object] = values.unset, - parameter22_value: Union[str, object] = values.unset, - parameter23_name: Union[str, object] = values.unset, - parameter23_value: Union[str, object] = values.unset, - parameter24_name: Union[str, object] = values.unset, - parameter24_value: Union[str, object] = values.unset, - parameter25_name: Union[str, object] = values.unset, - parameter25_value: Union[str, object] = values.unset, - parameter26_name: Union[str, object] = values.unset, - parameter26_value: Union[str, object] = values.unset, - parameter27_name: Union[str, object] = values.unset, - parameter27_value: Union[str, object] = values.unset, - parameter28_name: Union[str, object] = values.unset, - parameter28_value: Union[str, object] = values.unset, - parameter29_name: Union[str, object] = values.unset, - parameter29_value: Union[str, object] = values.unset, - parameter30_name: Union[str, object] = values.unset, - parameter30_value: Union[str, object] = values.unset, - parameter31_name: Union[str, object] = values.unset, - parameter31_value: Union[str, object] = values.unset, - parameter32_name: Union[str, object] = values.unset, - parameter32_value: Union[str, object] = values.unset, - parameter33_name: Union[str, object] = values.unset, - parameter33_value: Union[str, object] = values.unset, - parameter34_name: Union[str, object] = values.unset, - parameter34_value: Union[str, object] = values.unset, - parameter35_name: Union[str, object] = values.unset, - parameter35_value: Union[str, object] = values.unset, - parameter36_name: Union[str, object] = values.unset, - parameter36_value: Union[str, object] = values.unset, - parameter37_name: Union[str, object] = values.unset, - parameter37_value: Union[str, object] = values.unset, - parameter38_name: Union[str, object] = values.unset, - parameter38_value: Union[str, object] = values.unset, - parameter39_name: Union[str, object] = values.unset, - parameter39_value: Union[str, object] = values.unset, - parameter40_name: Union[str, object] = values.unset, - parameter40_value: Union[str, object] = values.unset, - parameter41_name: Union[str, object] = values.unset, - parameter41_value: Union[str, object] = values.unset, - parameter42_name: Union[str, object] = values.unset, - parameter42_value: Union[str, object] = values.unset, - parameter43_name: Union[str, object] = values.unset, - parameter43_value: Union[str, object] = values.unset, - parameter44_name: Union[str, object] = values.unset, - parameter44_value: Union[str, object] = values.unset, - parameter45_name: Union[str, object] = values.unset, - parameter45_value: Union[str, object] = values.unset, - parameter46_name: Union[str, object] = values.unset, - parameter46_value: Union[str, object] = values.unset, - parameter47_name: Union[str, object] = values.unset, - parameter47_value: Union[str, object] = values.unset, - parameter48_name: Union[str, object] = values.unset, - parameter48_value: Union[str, object] = values.unset, - parameter49_name: Union[str, object] = values.unset, - parameter49_value: Union[str, object] = values.unset, - parameter50_name: Union[str, object] = values.unset, - parameter50_value: Union[str, object] = values.unset, - parameter51_name: Union[str, object] = values.unset, - parameter51_value: Union[str, object] = values.unset, - parameter52_name: Union[str, object] = values.unset, - parameter52_value: Union[str, object] = values.unset, - parameter53_name: Union[str, object] = values.unset, - parameter53_value: Union[str, object] = values.unset, - parameter54_name: Union[str, object] = values.unset, - parameter54_value: Union[str, object] = values.unset, - parameter55_name: Union[str, object] = values.unset, - parameter55_value: Union[str, object] = values.unset, - parameter56_name: Union[str, object] = values.unset, - parameter56_value: Union[str, object] = values.unset, - parameter57_name: Union[str, object] = values.unset, - parameter57_value: Union[str, object] = values.unset, - parameter58_name: Union[str, object] = values.unset, - parameter58_value: Union[str, object] = values.unset, - parameter59_name: Union[str, object] = values.unset, - parameter59_value: Union[str, object] = values.unset, - parameter60_name: Union[str, object] = values.unset, - parameter60_value: Union[str, object] = values.unset, - parameter61_name: Union[str, object] = values.unset, - parameter61_value: Union[str, object] = values.unset, - parameter62_name: Union[str, object] = values.unset, - parameter62_value: Union[str, object] = values.unset, - parameter63_name: Union[str, object] = values.unset, - parameter63_value: Union[str, object] = values.unset, - parameter64_name: Union[str, object] = values.unset, - parameter64_value: Union[str, object] = values.unset, - parameter65_name: Union[str, object] = values.unset, - parameter65_value: Union[str, object] = values.unset, - parameter66_name: Union[str, object] = values.unset, - parameter66_value: Union[str, object] = values.unset, - parameter67_name: Union[str, object] = values.unset, - parameter67_value: Union[str, object] = values.unset, - parameter68_name: Union[str, object] = values.unset, - parameter68_value: Union[str, object] = values.unset, - parameter69_name: Union[str, object] = values.unset, - parameter69_value: Union[str, object] = values.unset, - parameter70_name: Union[str, object] = values.unset, - parameter70_value: Union[str, object] = values.unset, - parameter71_name: Union[str, object] = values.unset, - parameter71_value: Union[str, object] = values.unset, - parameter72_name: Union[str, object] = values.unset, - parameter72_value: Union[str, object] = values.unset, - parameter73_name: Union[str, object] = values.unset, - parameter73_value: Union[str, object] = values.unset, - parameter74_name: Union[str, object] = values.unset, - parameter74_value: Union[str, object] = values.unset, - parameter75_name: Union[str, object] = values.unset, - parameter75_value: Union[str, object] = values.unset, - parameter76_name: Union[str, object] = values.unset, - parameter76_value: Union[str, object] = values.unset, - parameter77_name: Union[str, object] = values.unset, - parameter77_value: Union[str, object] = values.unset, - parameter78_name: Union[str, object] = values.unset, - parameter78_value: Union[str, object] = values.unset, - parameter79_name: Union[str, object] = values.unset, - parameter79_value: Union[str, object] = values.unset, - parameter80_name: Union[str, object] = values.unset, - parameter80_value: Union[str, object] = values.unset, - parameter81_name: Union[str, object] = values.unset, - parameter81_value: Union[str, object] = values.unset, - parameter82_name: Union[str, object] = values.unset, - parameter82_value: Union[str, object] = values.unset, - parameter83_name: Union[str, object] = values.unset, - parameter83_value: Union[str, object] = values.unset, - parameter84_name: Union[str, object] = values.unset, - parameter84_value: Union[str, object] = values.unset, - parameter85_name: Union[str, object] = values.unset, - parameter85_value: Union[str, object] = values.unset, - parameter86_name: Union[str, object] = values.unset, - parameter86_value: Union[str, object] = values.unset, - parameter87_name: Union[str, object] = values.unset, - parameter87_value: Union[str, object] = values.unset, - parameter88_name: Union[str, object] = values.unset, - parameter88_value: Union[str, object] = values.unset, - parameter89_name: Union[str, object] = values.unset, - parameter89_value: Union[str, object] = values.unset, - parameter90_name: Union[str, object] = values.unset, - parameter90_value: Union[str, object] = values.unset, - parameter91_name: Union[str, object] = values.unset, - parameter91_value: Union[str, object] = values.unset, - parameter92_name: Union[str, object] = values.unset, - parameter92_value: Union[str, object] = values.unset, - parameter93_name: Union[str, object] = values.unset, - parameter93_value: Union[str, object] = values.unset, - parameter94_name: Union[str, object] = values.unset, - parameter94_value: Union[str, object] = values.unset, - parameter95_name: Union[str, object] = values.unset, - parameter95_value: Union[str, object] = values.unset, - parameter96_name: Union[str, object] = values.unset, - parameter96_value: Union[str, object] = values.unset, - parameter97_name: Union[str, object] = values.unset, - parameter97_value: Union[str, object] = values.unset, - parameter98_name: Union[str, object] = values.unset, - parameter98_value: Union[str, object] = values.unset, - parameter99_name: Union[str, object] = values.unset, - parameter99_value: Union[str, object] = values.unset, ) -> TranscriptionInstance: """ Asynchronously create the TranscriptionInstance @@ -1131,211 +339,13 @@ async def create_async( :param status_callback_method: The http method for the status_callback (one of GET, POST). :param inbound_track_label: Friendly name given to the Inbound Track :param outbound_track_label: Friendly name given to the Outbound Track - :param partial_results: Indicates if partial results are going to be send to the customer + :param partial_results: Indicates if partial results are going to be sent to the customer :param language_code: Language code used by the transcription engine, specified in [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) format - :param transcription_engine: Definition of the transcription engine to be used, between those supported by Twilio + :param transcription_engine: Definition of the transcription engine to be used, among those supported by Twilio :param profanity_filter: indicates if the server will attempt to filter out profanities, replacing all but the initial character in each filtered word with asterisks - :param speech_model: Recognition model used by the transcription engine, between those supported by the provider + :param speech_model: Recognition model used by the transcription engine, among those supported by the provider :param hints: A Phrase contains words and phrase \\\"hints\\\" so that the speech recognition engine is more likely to recognize them. - :param enable_automatic_punctuation: The provider will adds punctuation to recognition result hypotheses - :param parameter1_name: Parameter name - :param parameter1_value: Parameter value - :param parameter2_name: Parameter name - :param parameter2_value: Parameter value - :param parameter3_name: Parameter name - :param parameter3_value: Parameter value - :param parameter4_name: Parameter name - :param parameter4_value: Parameter value - :param parameter5_name: Parameter name - :param parameter5_value: Parameter value - :param parameter6_name: Parameter name - :param parameter6_value: Parameter value - :param parameter7_name: Parameter name - :param parameter7_value: Parameter value - :param parameter8_name: Parameter name - :param parameter8_value: Parameter value - :param parameter9_name: Parameter name - :param parameter9_value: Parameter value - :param parameter10_name: Parameter name - :param parameter10_value: Parameter value - :param parameter11_name: Parameter name - :param parameter11_value: Parameter value - :param parameter12_name: Parameter name - :param parameter12_value: Parameter value - :param parameter13_name: Parameter name - :param parameter13_value: Parameter value - :param parameter14_name: Parameter name - :param parameter14_value: Parameter value - :param parameter15_name: Parameter name - :param parameter15_value: Parameter value - :param parameter16_name: Parameter name - :param parameter16_value: Parameter value - :param parameter17_name: Parameter name - :param parameter17_value: Parameter value - :param parameter18_name: Parameter name - :param parameter18_value: Parameter value - :param parameter19_name: Parameter name - :param parameter19_value: Parameter value - :param parameter20_name: Parameter name - :param parameter20_value: Parameter value - :param parameter21_name: Parameter name - :param parameter21_value: Parameter value - :param parameter22_name: Parameter name - :param parameter22_value: Parameter value - :param parameter23_name: Parameter name - :param parameter23_value: Parameter value - :param parameter24_name: Parameter name - :param parameter24_value: Parameter value - :param parameter25_name: Parameter name - :param parameter25_value: Parameter value - :param parameter26_name: Parameter name - :param parameter26_value: Parameter value - :param parameter27_name: Parameter name - :param parameter27_value: Parameter value - :param parameter28_name: Parameter name - :param parameter28_value: Parameter value - :param parameter29_name: Parameter name - :param parameter29_value: Parameter value - :param parameter30_name: Parameter name - :param parameter30_value: Parameter value - :param parameter31_name: Parameter name - :param parameter31_value: Parameter value - :param parameter32_name: Parameter name - :param parameter32_value: Parameter value - :param parameter33_name: Parameter name - :param parameter33_value: Parameter value - :param parameter34_name: Parameter name - :param parameter34_value: Parameter value - :param parameter35_name: Parameter name - :param parameter35_value: Parameter value - :param parameter36_name: Parameter name - :param parameter36_value: Parameter value - :param parameter37_name: Parameter name - :param parameter37_value: Parameter value - :param parameter38_name: Parameter name - :param parameter38_value: Parameter value - :param parameter39_name: Parameter name - :param parameter39_value: Parameter value - :param parameter40_name: Parameter name - :param parameter40_value: Parameter value - :param parameter41_name: Parameter name - :param parameter41_value: Parameter value - :param parameter42_name: Parameter name - :param parameter42_value: Parameter value - :param parameter43_name: Parameter name - :param parameter43_value: Parameter value - :param parameter44_name: Parameter name - :param parameter44_value: Parameter value - :param parameter45_name: Parameter name - :param parameter45_value: Parameter value - :param parameter46_name: Parameter name - :param parameter46_value: Parameter value - :param parameter47_name: Parameter name - :param parameter47_value: Parameter value - :param parameter48_name: Parameter name - :param parameter48_value: Parameter value - :param parameter49_name: Parameter name - :param parameter49_value: Parameter value - :param parameter50_name: Parameter name - :param parameter50_value: Parameter value - :param parameter51_name: Parameter name - :param parameter51_value: Parameter value - :param parameter52_name: Parameter name - :param parameter52_value: Parameter value - :param parameter53_name: Parameter name - :param parameter53_value: Parameter value - :param parameter54_name: Parameter name - :param parameter54_value: Parameter value - :param parameter55_name: Parameter name - :param parameter55_value: Parameter value - :param parameter56_name: Parameter name - :param parameter56_value: Parameter value - :param parameter57_name: Parameter name - :param parameter57_value: Parameter value - :param parameter58_name: Parameter name - :param parameter58_value: Parameter value - :param parameter59_name: Parameter name - :param parameter59_value: Parameter value - :param parameter60_name: Parameter name - :param parameter60_value: Parameter value - :param parameter61_name: Parameter name - :param parameter61_value: Parameter value - :param parameter62_name: Parameter name - :param parameter62_value: Parameter value - :param parameter63_name: Parameter name - :param parameter63_value: Parameter value - :param parameter64_name: Parameter name - :param parameter64_value: Parameter value - :param parameter65_name: Parameter name - :param parameter65_value: Parameter value - :param parameter66_name: Parameter name - :param parameter66_value: Parameter value - :param parameter67_name: Parameter name - :param parameter67_value: Parameter value - :param parameter68_name: Parameter name - :param parameter68_value: Parameter value - :param parameter69_name: Parameter name - :param parameter69_value: Parameter value - :param parameter70_name: Parameter name - :param parameter70_value: Parameter value - :param parameter71_name: Parameter name - :param parameter71_value: Parameter value - :param parameter72_name: Parameter name - :param parameter72_value: Parameter value - :param parameter73_name: Parameter name - :param parameter73_value: Parameter value - :param parameter74_name: Parameter name - :param parameter74_value: Parameter value - :param parameter75_name: Parameter name - :param parameter75_value: Parameter value - :param parameter76_name: Parameter name - :param parameter76_value: Parameter value - :param parameter77_name: Parameter name - :param parameter77_value: Parameter value - :param parameter78_name: Parameter name - :param parameter78_value: Parameter value - :param parameter79_name: Parameter name - :param parameter79_value: Parameter value - :param parameter80_name: Parameter name - :param parameter80_value: Parameter value - :param parameter81_name: Parameter name - :param parameter81_value: Parameter value - :param parameter82_name: Parameter name - :param parameter82_value: Parameter value - :param parameter83_name: Parameter name - :param parameter83_value: Parameter value - :param parameter84_name: Parameter name - :param parameter84_value: Parameter value - :param parameter85_name: Parameter name - :param parameter85_value: Parameter value - :param parameter86_name: Parameter name - :param parameter86_value: Parameter value - :param parameter87_name: Parameter name - :param parameter87_value: Parameter value - :param parameter88_name: Parameter name - :param parameter88_value: Parameter value - :param parameter89_name: Parameter name - :param parameter89_value: Parameter value - :param parameter90_name: Parameter name - :param parameter90_value: Parameter value - :param parameter91_name: Parameter name - :param parameter91_value: Parameter value - :param parameter92_name: Parameter name - :param parameter92_value: Parameter value - :param parameter93_name: Parameter name - :param parameter93_value: Parameter value - :param parameter94_name: Parameter name - :param parameter94_value: Parameter value - :param parameter95_name: Parameter name - :param parameter95_value: Parameter value - :param parameter96_name: Parameter name - :param parameter96_value: Parameter value - :param parameter97_name: Parameter name - :param parameter97_value: Parameter value - :param parameter98_name: Parameter name - :param parameter98_value: Parameter value - :param parameter99_name: Parameter name - :param parameter99_value: Parameter value + :param enable_automatic_punctuation: The provider will add punctuation to recognition result :returns: The created TranscriptionInstance """ @@ -1357,204 +367,6 @@ async def create_async( "EnableAutomaticPunctuation": serialize.boolean_to_string( enable_automatic_punctuation ), - "Parameter1.Name": parameter1_name, - "Parameter1.Value": parameter1_value, - "Parameter2.Name": parameter2_name, - "Parameter2.Value": parameter2_value, - "Parameter3.Name": parameter3_name, - "Parameter3.Value": parameter3_value, - "Parameter4.Name": parameter4_name, - "Parameter4.Value": parameter4_value, - "Parameter5.Name": parameter5_name, - "Parameter5.Value": parameter5_value, - "Parameter6.Name": parameter6_name, - "Parameter6.Value": parameter6_value, - "Parameter7.Name": parameter7_name, - "Parameter7.Value": parameter7_value, - "Parameter8.Name": parameter8_name, - "Parameter8.Value": parameter8_value, - "Parameter9.Name": parameter9_name, - "Parameter9.Value": parameter9_value, - "Parameter10.Name": parameter10_name, - "Parameter10.Value": parameter10_value, - "Parameter11.Name": parameter11_name, - "Parameter11.Value": parameter11_value, - "Parameter12.Name": parameter12_name, - "Parameter12.Value": parameter12_value, - "Parameter13.Name": parameter13_name, - "Parameter13.Value": parameter13_value, - "Parameter14.Name": parameter14_name, - "Parameter14.Value": parameter14_value, - "Parameter15.Name": parameter15_name, - "Parameter15.Value": parameter15_value, - "Parameter16.Name": parameter16_name, - "Parameter16.Value": parameter16_value, - "Parameter17.Name": parameter17_name, - "Parameter17.Value": parameter17_value, - "Parameter18.Name": parameter18_name, - "Parameter18.Value": parameter18_value, - "Parameter19.Name": parameter19_name, - "Parameter19.Value": parameter19_value, - "Parameter20.Name": parameter20_name, - "Parameter20.Value": parameter20_value, - "Parameter21.Name": parameter21_name, - "Parameter21.Value": parameter21_value, - "Parameter22.Name": parameter22_name, - "Parameter22.Value": parameter22_value, - "Parameter23.Name": parameter23_name, - "Parameter23.Value": parameter23_value, - "Parameter24.Name": parameter24_name, - "Parameter24.Value": parameter24_value, - "Parameter25.Name": parameter25_name, - "Parameter25.Value": parameter25_value, - "Parameter26.Name": parameter26_name, - "Parameter26.Value": parameter26_value, - "Parameter27.Name": parameter27_name, - "Parameter27.Value": parameter27_value, - "Parameter28.Name": parameter28_name, - "Parameter28.Value": parameter28_value, - "Parameter29.Name": parameter29_name, - "Parameter29.Value": parameter29_value, - "Parameter30.Name": parameter30_name, - "Parameter30.Value": parameter30_value, - "Parameter31.Name": parameter31_name, - "Parameter31.Value": parameter31_value, - "Parameter32.Name": parameter32_name, - "Parameter32.Value": parameter32_value, - "Parameter33.Name": parameter33_name, - "Parameter33.Value": parameter33_value, - "Parameter34.Name": parameter34_name, - "Parameter34.Value": parameter34_value, - "Parameter35.Name": parameter35_name, - "Parameter35.Value": parameter35_value, - "Parameter36.Name": parameter36_name, - "Parameter36.Value": parameter36_value, - "Parameter37.Name": parameter37_name, - "Parameter37.Value": parameter37_value, - "Parameter38.Name": parameter38_name, - "Parameter38.Value": parameter38_value, - "Parameter39.Name": parameter39_name, - "Parameter39.Value": parameter39_value, - "Parameter40.Name": parameter40_name, - "Parameter40.Value": parameter40_value, - "Parameter41.Name": parameter41_name, - "Parameter41.Value": parameter41_value, - "Parameter42.Name": parameter42_name, - "Parameter42.Value": parameter42_value, - "Parameter43.Name": parameter43_name, - "Parameter43.Value": parameter43_value, - "Parameter44.Name": parameter44_name, - "Parameter44.Value": parameter44_value, - "Parameter45.Name": parameter45_name, - "Parameter45.Value": parameter45_value, - "Parameter46.Name": parameter46_name, - "Parameter46.Value": parameter46_value, - "Parameter47.Name": parameter47_name, - "Parameter47.Value": parameter47_value, - "Parameter48.Name": parameter48_name, - "Parameter48.Value": parameter48_value, - "Parameter49.Name": parameter49_name, - "Parameter49.Value": parameter49_value, - "Parameter50.Name": parameter50_name, - "Parameter50.Value": parameter50_value, - "Parameter51.Name": parameter51_name, - "Parameter51.Value": parameter51_value, - "Parameter52.Name": parameter52_name, - "Parameter52.Value": parameter52_value, - "Parameter53.Name": parameter53_name, - "Parameter53.Value": parameter53_value, - "Parameter54.Name": parameter54_name, - "Parameter54.Value": parameter54_value, - "Parameter55.Name": parameter55_name, - "Parameter55.Value": parameter55_value, - "Parameter56.Name": parameter56_name, - "Parameter56.Value": parameter56_value, - "Parameter57.Name": parameter57_name, - "Parameter57.Value": parameter57_value, - "Parameter58.Name": parameter58_name, - "Parameter58.Value": parameter58_value, - "Parameter59.Name": parameter59_name, - "Parameter59.Value": parameter59_value, - "Parameter60.Name": parameter60_name, - "Parameter60.Value": parameter60_value, - "Parameter61.Name": parameter61_name, - "Parameter61.Value": parameter61_value, - "Parameter62.Name": parameter62_name, - "Parameter62.Value": parameter62_value, - "Parameter63.Name": parameter63_name, - "Parameter63.Value": parameter63_value, - "Parameter64.Name": parameter64_name, - "Parameter64.Value": parameter64_value, - "Parameter65.Name": parameter65_name, - "Parameter65.Value": parameter65_value, - "Parameter66.Name": parameter66_name, - "Parameter66.Value": parameter66_value, - "Parameter67.Name": parameter67_name, - "Parameter67.Value": parameter67_value, - "Parameter68.Name": parameter68_name, - "Parameter68.Value": parameter68_value, - "Parameter69.Name": parameter69_name, - "Parameter69.Value": parameter69_value, - "Parameter70.Name": parameter70_name, - "Parameter70.Value": parameter70_value, - "Parameter71.Name": parameter71_name, - "Parameter71.Value": parameter71_value, - "Parameter72.Name": parameter72_name, - "Parameter72.Value": parameter72_value, - "Parameter73.Name": parameter73_name, - "Parameter73.Value": parameter73_value, - "Parameter74.Name": parameter74_name, - "Parameter74.Value": parameter74_value, - "Parameter75.Name": parameter75_name, - "Parameter75.Value": parameter75_value, - "Parameter76.Name": parameter76_name, - "Parameter76.Value": parameter76_value, - "Parameter77.Name": parameter77_name, - "Parameter77.Value": parameter77_value, - "Parameter78.Name": parameter78_name, - "Parameter78.Value": parameter78_value, - "Parameter79.Name": parameter79_name, - "Parameter79.Value": parameter79_value, - "Parameter80.Name": parameter80_name, - "Parameter80.Value": parameter80_value, - "Parameter81.Name": parameter81_name, - "Parameter81.Value": parameter81_value, - "Parameter82.Name": parameter82_name, - "Parameter82.Value": parameter82_value, - "Parameter83.Name": parameter83_name, - "Parameter83.Value": parameter83_value, - "Parameter84.Name": parameter84_name, - "Parameter84.Value": parameter84_value, - "Parameter85.Name": parameter85_name, - "Parameter85.Value": parameter85_value, - "Parameter86.Name": parameter86_name, - "Parameter86.Value": parameter86_value, - "Parameter87.Name": parameter87_name, - "Parameter87.Value": parameter87_value, - "Parameter88.Name": parameter88_name, - "Parameter88.Value": parameter88_value, - "Parameter89.Name": parameter89_name, - "Parameter89.Value": parameter89_value, - "Parameter90.Name": parameter90_name, - "Parameter90.Value": parameter90_value, - "Parameter91.Name": parameter91_name, - "Parameter91.Value": parameter91_value, - "Parameter92.Name": parameter92_name, - "Parameter92.Value": parameter92_value, - "Parameter93.Name": parameter93_name, - "Parameter93.Value": parameter93_value, - "Parameter94.Name": parameter94_name, - "Parameter94.Value": parameter94_value, - "Parameter95.Name": parameter95_name, - "Parameter95.Value": parameter95_value, - "Parameter96.Name": parameter96_name, - "Parameter96.Value": parameter96_value, - "Parameter97.Name": parameter97_name, - "Parameter97.Value": parameter97_value, - "Parameter98.Name": parameter98_name, - "Parameter98.Value": parameter98_value, - "Parameter99.Name": parameter99_name, - "Parameter99.Value": parameter99_value, } ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) diff --git a/twilio/rest/api/v2010/account/message/__init__.py b/twilio/rest/api/v2010/account/message/__init__.py index 7eb11d3889..1b6d3aea81 100644 --- a/twilio/rest/api/v2010/account/message/__init__.py +++ b/twilio/rest/api/v2010/account/message/__init__.py @@ -73,7 +73,7 @@ class UpdateStatus(object): :ivar to: The recipient's phone number (in [E.164](https://en.wikipedia.org/wiki/E.164) format) or [channel address](https://www.twilio.com/docs/messaging/channels) (e.g. `whatsapp:+15552229999`) :ivar date_updated: The [RFC 2822](https://datatracker.ietf.org/doc/html/rfc2822#section-3.3) timestamp (in GMT) of when the Message resource was last updated :ivar price: The amount billed for the message in the currency specified by `price_unit`. The `price` is populated after the message has been sent/received, and may not be immediately availalble. View the [Pricing page](https://www.twilio.com/en-us/pricing) for more details. - :ivar error_message: The description of the `error_code` if the Message `status` is `failed` or `undelivered`. If no error was encountered, the value is `null`. + :ivar error_message: The description of the `error_code` if the Message `status` is `failed` or `undelivered`. If no error was encountered, the value is `null`. The value returned in this field for a specific error cause is subject to change as Twilio improves errors. Users should not use the `error_code` and `error_message` fields programmatically. :ivar uri: The URI of the Message resource, relative to `https://api.twilio.com`. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) associated with the Message resource :ivar num_media: The number of media files associated with the Message resource. @@ -82,7 +82,7 @@ class UpdateStatus(object): :ivar sid: The unique, Twilio-provided string that identifies the Message resource. :ivar date_sent: The [RFC 2822](https://datatracker.ietf.org/doc/html/rfc2822#section-3.3) timestamp (in GMT) of when the Message was sent. For an outgoing message, this is when Twilio sent the message. For an incoming message, this is when Twilio sent the HTTP request to your incoming message webhook URL. :ivar date_created: The [RFC 2822](https://datatracker.ietf.org/doc/html/rfc2822#section-3.3) timestamp (in GMT) of when the Message resource was created - :ivar error_code: The [error code](https://www.twilio.com/docs/api/errors) returned if the Message `status` is `failed` or `undelivered`. If no error was encountered, the value is `null`. + :ivar error_code: The [error code](https://www.twilio.com/docs/api/errors) returned if the Message `status` is `failed` or `undelivered`. If no error was encountered, the value is `null`. The value returned in this field for a specific error cause is subject to change as Twilio improves errors. Users should not use the `error_code` and `error_message` fields programmatically. :ivar price_unit: The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). :ivar api_version: The API version used to process the Message :ivar subresource_uris: A list of related resources identified by their URIs relative to `https://api.twilio.com` diff --git a/twilio/rest/api/v2010/account/recording/add_on_result/payload.py b/twilio/rest/api/v2010/account/recording/add_on_result/payload/__init__.py similarity index 96% rename from twilio/rest/api/v2010/account/recording/add_on_result/payload.py rename to twilio/rest/api/v2010/account/recording/add_on_result/payload/__init__.py index 1dc26e1d7b..9008f6a688 100644 --- a/twilio/rest/api/v2010/account/recording/add_on_result/payload.py +++ b/twilio/rest/api/v2010/account/recording/add_on_result/payload/__init__.py @@ -20,6 +20,7 @@ from twilio.base.list_resource import ListResource from twilio.base.version import Version from twilio.base.page import Page +from twilio.rest.api.v2010.account.recording.add_on_result.payload.data import DataList class PayloadInstance(InstanceResource): @@ -130,6 +131,13 @@ async def fetch_async(self) -> "PayloadInstance": """ return await self._proxy.fetch_async() + @property + def data(self) -> DataList: + """ + Access the data + """ + return self._proxy.data + def __repr__(self) -> str: """ Provide a friendly representation @@ -172,6 +180,8 @@ def __init__( **self._solution ) + self._data: Optional[DataList] = None + def delete(self) -> bool: """ Deletes the PayloadInstance @@ -240,6 +250,21 @@ async def fetch_async(self) -> PayloadInstance: sid=self._solution["sid"], ) + @property + def data(self) -> DataList: + """ + Access the data + """ + if self._data is None: + self._data = DataList( + self._version, + self._solution["account_sid"], + self._solution["reference_sid"], + self._solution["add_on_result_sid"], + self._solution["sid"], + ) + return self._data + def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/api/v2010/account/recording/add_on_result/payload/data.py b/twilio/rest/api/v2010/account/recording/add_on_result/payload/data.py new file mode 100644 index 0000000000..1cc931a693 --- /dev/null +++ b/twilio/rest/api/v2010/account/recording/add_on_result/payload/data.py @@ -0,0 +1,242 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + 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_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class DataInstance(InstanceResource): + """ + :ivar redirect_to: The URL to redirect to to get the data returned by the AddOn that was previously stored. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + account_sid: str, + reference_sid: str, + add_on_result_sid: str, + payload_sid: str, + ): + super().__init__(version) + + self.redirect_to: Optional[str] = payload.get("redirect_to") + + self._solution = { + "account_sid": account_sid, + "reference_sid": reference_sid, + "add_on_result_sid": add_on_result_sid, + "payload_sid": payload_sid, + } + self._context: Optional[DataContext] = None + + @property + def _proxy(self) -> "DataContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: DataContext for this DataInstance + """ + if self._context is None: + self._context = DataContext( + self._version, + account_sid=self._solution["account_sid"], + reference_sid=self._solution["reference_sid"], + add_on_result_sid=self._solution["add_on_result_sid"], + payload_sid=self._solution["payload_sid"], + ) + return self._context + + def fetch(self) -> "DataInstance": + """ + Fetch the DataInstance + + + :returns: The fetched DataInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "DataInstance": + """ + Asynchronous coroutine to fetch the DataInstance + + + :returns: The fetched DataInstance + """ + return await self._proxy.fetch_async() + + 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 DataContext(InstanceContext): + + def __init__( + self, + version: Version, + account_sid: str, + reference_sid: str, + add_on_result_sid: str, + payload_sid: str, + ): + """ + Initialize the DataContext + + :param version: Version that contains the resource + :param account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording AddOnResult Payload resource to fetch. + :param reference_sid: The SID of the recording to which the AddOnResult resource that contains the payload to fetch belongs. + :param add_on_result_sid: The SID of the AddOnResult to which the payload to fetch belongs. + :param payload_sid: The Twilio-provided string that uniquely identifies the Recording AddOnResult Payload resource to fetch. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "account_sid": account_sid, + "reference_sid": reference_sid, + "add_on_result_sid": add_on_result_sid, + "payload_sid": payload_sid, + } + self._uri = "/Accounts/{account_sid}/Recordings/{reference_sid}/AddOnResults/{add_on_result_sid}/Payloads/{payload_sid}/Data.json".format( + **self._solution + ) + + def fetch(self) -> DataInstance: + """ + Fetch the DataInstance + + + :returns: The fetched DataInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return DataInstance( + self._version, + payload, + account_sid=self._solution["account_sid"], + reference_sid=self._solution["reference_sid"], + add_on_result_sid=self._solution["add_on_result_sid"], + payload_sid=self._solution["payload_sid"], + ) + + async def fetch_async(self) -> DataInstance: + """ + Asynchronous coroutine to fetch the DataInstance + + + :returns: The fetched DataInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return DataInstance( + self._version, + payload, + account_sid=self._solution["account_sid"], + reference_sid=self._solution["reference_sid"], + add_on_result_sid=self._solution["add_on_result_sid"], + payload_sid=self._solution["payload_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 DataList(ListResource): + + def __init__( + self, + version: Version, + account_sid: str, + reference_sid: str, + add_on_result_sid: str, + payload_sid: str, + ): + """ + Initialize the DataList + + :param version: Version that contains the resource + :param account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording AddOnResult Payload resource to fetch. + :param reference_sid: The SID of the recording to which the AddOnResult resource that contains the payload to fetch belongs. + :param add_on_result_sid: The SID of the AddOnResult to which the payload to fetch belongs. + :param payload_sid: The Twilio-provided string that uniquely identifies the Recording AddOnResult Payload resource to fetch. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "account_sid": account_sid, + "reference_sid": reference_sid, + "add_on_result_sid": add_on_result_sid, + "payload_sid": payload_sid, + } + + def get(self) -> DataContext: + """ + Constructs a DataContext + + """ + return DataContext( + self._version, + account_sid=self._solution["account_sid"], + reference_sid=self._solution["reference_sid"], + add_on_result_sid=self._solution["add_on_result_sid"], + payload_sid=self._solution["payload_sid"], + ) + + def __call__(self) -> DataContext: + """ + Constructs a DataContext + + """ + return DataContext( + self._version, + account_sid=self._solution["account_sid"], + reference_sid=self._solution["reference_sid"], + add_on_result_sid=self._solution["add_on_result_sid"], + payload_sid=self._solution["payload_sid"], + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/content/v1/content/__init__.py b/twilio/rest/content/v1/content/__init__.py index 0fcbd1c19e..f2dec12761 100644 --- a/twilio/rest/content/v1/content/__init__.py +++ b/twilio/rest/content/v1/content/__init__.py @@ -38,6 +38,11 @@ class CardActionType(object): PHONE_NUMBER = "PHONE_NUMBER" QUICK_REPLY = "QUICK_REPLY" + class CarouselActionType(object): + URL = "URL" + PHONE_NUMBER = "PHONE_NUMBER" + QUICK_REPLY = "QUICK_REPLY" + class QuickReplyActionType(object): QUICK_REPLY = "QUICK_REPLY" @@ -297,7 +302,7 @@ class AuthenticationAction(object): :ivar copy_code_text: """ - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + def __init__(self, payload: Dict[str, Any]): self.type: Optional["ContentInstance.AuthenticationActionType"] = ( payload.get("type") @@ -319,7 +324,7 @@ class CallToActionAction(object): :ivar id: """ - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + def __init__(self, payload: Dict[str, Any]): self.type: Optional["ContentInstance.CallToActionActionType"] = payload.get( "type" @@ -347,7 +352,7 @@ class CardAction(object): :ivar id: """ - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + def __init__(self, payload: Dict[str, Any]): self.type: Optional["ContentInstance.CardActionType"] = payload.get("type") self.title: Optional[str] = payload.get("title") @@ -364,6 +369,59 @@ def to_dict(self): "id": self.id, } + class CarouselAction(object): + """ + :ivar type: + :ivar title: + :ivar url: + :ivar phone: + :ivar id: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.type: Optional["ContentInstance.CarouselActionType"] = payload.get( + "type" + ) + self.title: Optional[str] = payload.get("title") + self.url: Optional[str] = payload.get("url") + self.phone: Optional[str] = payload.get("phone") + self.id: Optional[str] = payload.get("id") + + def to_dict(self): + return { + "type": self.type, + "title": self.title, + "url": self.url, + "phone": self.phone, + "id": self.id, + } + + class CarouselCard(object): + """ + :ivar title: + :ivar body: + :ivar media: + :ivar actions: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.title: Optional[str] = payload.get("title") + self.body: Optional[str] = payload.get("body") + self.media: Optional[str] = payload.get("media") + self.actions: Optional[List[ContentList.CarouselAction]] = payload.get( + "actions" + ) + + def to_dict(self): + return { + "title": self.title, + "body": self.body, + "media": self.media, + "actions": [actions.to_dict() for actions in self.actions], + } + class CatalogItem(object): """ :ivar id: @@ -374,7 +432,7 @@ class CatalogItem(object): :ivar description: """ - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + def __init__(self, payload: Dict[str, Any]): self.id: Optional[str] = payload.get("id") self.section_title: Optional[str] = payload.get("section_title") @@ -401,7 +459,7 @@ class ContentCreateRequest(object): :ivar types: """ - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + def __init__(self, payload: Dict[str, Any]): self.friendly_name: Optional[str] = payload.get("friendly_name") self.variables: Optional[dict[str, str]] = payload.get("variables") @@ -423,7 +481,7 @@ class ListItem(object): :ivar description: """ - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + def __init__(self, payload: Dict[str, Any]): self.id: Optional[str] = payload.get("id") self.item: Optional[str] = payload.get("item") @@ -443,7 +501,7 @@ class QuickReplyAction(object): :ivar id: """ - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + def __init__(self, payload: Dict[str, Any]): self.type: Optional["ContentInstance.QuickReplyActionType"] = payload.get( "type" @@ -464,7 +522,7 @@ class TwilioCallToAction(object): :ivar actions: """ - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + def __init__(self, payload: Dict[str, Any]): self.body: Optional[str] = payload.get("body") self.actions: Optional[List[ContentList.CallToActionAction]] = payload.get( @@ -485,7 +543,7 @@ class TwilioCard(object): :ivar actions: """ - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + def __init__(self, payload: Dict[str, Any]): self.title: Optional[str] = payload.get("title") self.subtitle: Optional[str] = payload.get("subtitle") @@ -502,6 +560,23 @@ def to_dict(self): "actions": [actions.to_dict() for actions in self.actions], } + class TwilioCarousel(object): + """ + :ivar body: + :ivar cards: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.body: Optional[str] = payload.get("body") + self.cards: Optional[List[ContentList.CarouselCard]] = payload.get("cards") + + def to_dict(self): + return { + "body": self.body, + "cards": [cards.to_dict() for cards in self.cards], + } + class TwilioCatalog(object): """ :ivar title: @@ -512,7 +587,7 @@ class TwilioCatalog(object): :ivar dynamic_items: """ - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + def __init__(self, payload: Dict[str, Any]): self.title: Optional[str] = payload.get("title") self.body: Optional[str] = payload.get("body") @@ -538,7 +613,7 @@ class TwilioListPicker(object): :ivar items: """ - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + def __init__(self, payload: Dict[str, Any]): self.body: Optional[str] = payload.get("body") self.button: Optional[str] = payload.get("button") @@ -558,7 +633,7 @@ class TwilioLocation(object): :ivar label: """ - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + def __init__(self, payload: Dict[str, Any]): self.latitude: Optional[float] = payload.get("latitude") self.longitude: Optional[float] = payload.get("longitude") @@ -577,7 +652,7 @@ class TwilioMedia(object): :ivar media: """ - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + def __init__(self, payload: Dict[str, Any]): self.body: Optional[str] = payload.get("body") self.media: Optional[List[str]] = payload.get("media") @@ -594,7 +669,7 @@ class TwilioQuickReply(object): :ivar actions: """ - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + def __init__(self, payload: Dict[str, Any]): self.body: Optional[str] = payload.get("body") self.actions: Optional[List[ContentList.QuickReplyAction]] = payload.get( @@ -612,7 +687,7 @@ class TwilioText(object): :ivar body: """ - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + def __init__(self, payload: Dict[str, Any]): self.body: Optional[str] = payload.get("body") @@ -631,11 +706,12 @@ class Types(object): :ivar twilio_quick_reply: :ivar twilio_card: :ivar twilio_catalog: + :ivar twilio_carousel: :ivar whatsapp_card: :ivar whatsapp_authentication: """ - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + def __init__(self, payload: Dict[str, Any]): self.twilio_text: Optional[ContentList.TwilioText] = payload.get( "twilio_text" @@ -661,6 +737,9 @@ def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): self.twilio_catalog: Optional[ContentList.TwilioCatalog] = payload.get( "twilio_catalog" ) + self.twilio_carousel: Optional[ContentList.TwilioCarousel] = payload.get( + "twilio_carousel" + ) self.whatsapp_card: Optional[ContentList.WhatsappCard] = payload.get( "whatsapp_card" ) @@ -678,6 +757,7 @@ def to_dict(self): "twilio_quick_reply": self.twilio_quick_reply.to_dict(), "twilio_card": self.twilio_card.to_dict(), "twilio_catalog": self.twilio_catalog.to_dict(), + "twilio_carousel": self.twilio_carousel.to_dict(), "whatsapp_card": self.whatsapp_card.to_dict(), "whatsapp_authentication": self.whatsapp_authentication.to_dict(), } @@ -689,7 +769,7 @@ class WhatsappAuthentication(object): :ivar actions: """ - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + def __init__(self, payload: Dict[str, Any]): self.add_security_recommendation: Optional[bool] = payload.get( "add_security_recommendation" @@ -717,7 +797,7 @@ class WhatsappCard(object): :ivar actions: """ - def __init__(self, payload: Dict[str, Any], sid: Optional[str] = None): + def __init__(self, payload: Dict[str, Any]): self.body: Optional[str] = payload.get("body") self.footer: Optional[str] = payload.get("footer") diff --git a/twilio/rest/content/v1/content/approval_create.py b/twilio/rest/content/v1/content/approval_create.py index 6e28052e0d..4f22f2df14 100644 --- a/twilio/rest/content/v1/content/approval_create.py +++ b/twilio/rest/content/v1/content/approval_create.py @@ -64,7 +64,7 @@ class ContentApprovalRequest(object): :ivar category: A WhatsApp recognized template category. """ - def __init__(self, payload: Dict[str, Any], content_sid: str): + def __init__(self, payload: Dict[str, Any]): self.name: Optional[str] = payload.get("name") self.category: Optional[str] = payload.get("category") diff --git a/twilio/rest/flex_api/v2/flex_user.py b/twilio/rest/flex_api/v2/flex_user.py index 1acc75a8a8..0f5b1571f2 100644 --- a/twilio/rest/flex_api/v2/flex_user.py +++ b/twilio/rest/flex_api/v2/flex_user.py @@ -13,8 +13,8 @@ """ from datetime import datetime -from typing import Any, Dict, Optional -from twilio.base import deserialize +from typing import Any, Dict, List, Optional, Union +from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -35,6 +35,8 @@ class FlexUserInstance(InstanceResource): :ivar username: Username of the User. :ivar email: Email of the User. :ivar friendly_name: Friendly name of the User. + :ivar locale: The locale preference of the user. + :ivar roles: The roles of the user. :ivar created_date: The date that this user was created, given in ISO 8601 format. :ivar updated_date: The date that this user was updated, given in ISO 8601 format. :ivar version: The current version of the user. @@ -62,6 +64,8 @@ def __init__( self.username: Optional[str] = payload.get("username") self.email: Optional[str] = payload.get("email") self.friendly_name: Optional[str] = payload.get("friendly_name") + self.locale: Optional[str] = payload.get("locale") + self.roles: Optional[List[str]] = payload.get("roles") self.created_date: Optional[datetime] = deserialize.iso8601_datetime( payload.get("created_date") ) @@ -111,6 +115,66 @@ async def fetch_async(self) -> "FlexUserInstance": """ return await self._proxy.fetch_async() + def update( + self, + first_name: Union[str, object] = values.unset, + last_name: Union[str, object] = values.unset, + email: Union[str, object] = values.unset, + friendly_name: Union[str, object] = values.unset, + user_sid: Union[str, object] = values.unset, + locale: Union[str, object] = values.unset, + ) -> "FlexUserInstance": + """ + Update the FlexUserInstance + + :param first_name: First name of the User. + :param last_name: Last name of the User. + :param email: Email of the User. + :param friendly_name: Friendly name of the User. + :param user_sid: The unique SID identifier of the Twilio Unified User. + :param locale: The locale preference of the user. + + :returns: The updated FlexUserInstance + """ + return self._proxy.update( + first_name=first_name, + last_name=last_name, + email=email, + friendly_name=friendly_name, + user_sid=user_sid, + locale=locale, + ) + + async def update_async( + self, + first_name: Union[str, object] = values.unset, + last_name: Union[str, object] = values.unset, + email: Union[str, object] = values.unset, + friendly_name: Union[str, object] = values.unset, + user_sid: Union[str, object] = values.unset, + locale: Union[str, object] = values.unset, + ) -> "FlexUserInstance": + """ + Asynchronous coroutine to update the FlexUserInstance + + :param first_name: First name of the User. + :param last_name: Last name of the User. + :param email: Email of the User. + :param friendly_name: Friendly name of the User. + :param user_sid: The unique SID identifier of the Twilio Unified User. + :param locale: The locale preference of the user. + + :returns: The updated FlexUserInstance + """ + return await self._proxy.update_async( + first_name=first_name, + last_name=last_name, + email=email, + friendly_name=friendly_name, + user_sid=user_sid, + locale=locale, + ) + def __repr__(self) -> str: """ Provide a friendly representation @@ -129,7 +193,7 @@ def __init__(self, version: Version, instance_sid: str, flex_user_sid: str): :param version: Version that contains the resource :param instance_sid: The unique ID created by Twilio to identify a Flex instance. - :param flex_user_sid: The unique id for the flex user to be retrieved. + :param flex_user_sid: The unique id for the flex user. """ super().__init__(version) @@ -182,6 +246,96 @@ async def fetch_async(self) -> FlexUserInstance: flex_user_sid=self._solution["flex_user_sid"], ) + def update( + self, + first_name: Union[str, object] = values.unset, + last_name: Union[str, object] = values.unset, + email: Union[str, object] = values.unset, + friendly_name: Union[str, object] = values.unset, + user_sid: Union[str, object] = values.unset, + locale: Union[str, object] = values.unset, + ) -> FlexUserInstance: + """ + Update the FlexUserInstance + + :param first_name: First name of the User. + :param last_name: Last name of the User. + :param email: Email of the User. + :param friendly_name: Friendly name of the User. + :param user_sid: The unique SID identifier of the Twilio Unified User. + :param locale: The locale preference of the user. + + :returns: The updated FlexUserInstance + """ + data = values.of( + { + "FirstName": first_name, + "LastName": last_name, + "Email": email, + "FriendlyName": friendly_name, + "UserSid": user_sid, + "Locale": locale, + } + ) + + payload = self._version.update( + method="POST", + uri=self._uri, + data=data, + ) + + return FlexUserInstance( + self._version, + payload, + instance_sid=self._solution["instance_sid"], + flex_user_sid=self._solution["flex_user_sid"], + ) + + async def update_async( + self, + first_name: Union[str, object] = values.unset, + last_name: Union[str, object] = values.unset, + email: Union[str, object] = values.unset, + friendly_name: Union[str, object] = values.unset, + user_sid: Union[str, object] = values.unset, + locale: Union[str, object] = values.unset, + ) -> FlexUserInstance: + """ + Asynchronous coroutine to update the FlexUserInstance + + :param first_name: First name of the User. + :param last_name: Last name of the User. + :param email: Email of the User. + :param friendly_name: Friendly name of the User. + :param user_sid: The unique SID identifier of the Twilio Unified User. + :param locale: The locale preference of the user. + + :returns: The updated FlexUserInstance + """ + data = values.of( + { + "FirstName": first_name, + "LastName": last_name, + "Email": email, + "FriendlyName": friendly_name, + "UserSid": user_sid, + "Locale": locale, + } + ) + + payload = await self._version.update_async( + method="POST", + uri=self._uri, + data=data, + ) + + return FlexUserInstance( + self._version, + payload, + instance_sid=self._solution["instance_sid"], + flex_user_sid=self._solution["flex_user_sid"], + ) + def __repr__(self) -> str: """ Provide a friendly representation @@ -208,7 +362,7 @@ def get(self, instance_sid: str, flex_user_sid: str) -> FlexUserContext: Constructs a FlexUserContext :param instance_sid: The unique ID created by Twilio to identify a Flex instance. - :param flex_user_sid: The unique id for the flex user to be retrieved. + :param flex_user_sid: The unique id for the flex user. """ return FlexUserContext( self._version, instance_sid=instance_sid, flex_user_sid=flex_user_sid @@ -219,7 +373,7 @@ def __call__(self, instance_sid: str, flex_user_sid: str) -> FlexUserContext: Constructs a FlexUserContext :param instance_sid: The unique ID created by Twilio to identify a Flex instance. - :param flex_user_sid: The unique id for the flex user to be retrieved. + :param flex_user_sid: The unique id for the flex user. """ return FlexUserContext( self._version, instance_sid=instance_sid, flex_user_sid=flex_user_sid diff --git a/twilio/rest/insights/v1/call_summaries.py b/twilio/rest/insights/v1/call_summaries.py index f68744eefc..35cf41aa49 100644 --- a/twilio/rest/insights/v1/call_summaries.py +++ b/twilio/rest/insights/v1/call_summaries.py @@ -182,7 +182,6 @@ def stream( to_carrier: Union[str, object] = values.unset, from_country_code: Union[str, object] = values.unset, to_country_code: Union[str, object] = values.unset, - branded: Union[bool, object] = values.unset, verified_caller: Union[bool, object] = values.unset, has_tag: Union[bool, object] = values.unset, start_time: Union[str, object] = values.unset, @@ -202,6 +201,15 @@ def stream( quality_issue_annotation: Union[str, object] = values.unset, spam_annotation: Union[bool, object] = values.unset, call_score_annotation: Union[str, object] = values.unset, + branded_enabled: Union[bool, object] = values.unset, + voice_integrity_enabled: Union[bool, object] = values.unset, + branded_bundle_sid: Union[str, object] = values.unset, + voice_integrity_bundle_sid: Union[str, object] = values.unset, + voice_integrity_use_case: Union[str, object] = values.unset, + business_profile_identity: Union[str, object] = values.unset, + business_profile_industry: Union[str, object] = values.unset, + business_profile_bundle_sid: Union[str, object] = values.unset, + business_profile_type: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> Iterator[CallSummariesInstance]: @@ -217,8 +225,7 @@ def stream( :param str to_carrier: A destination carrier. :param str from_country_code: A source country code based on phone number in From. :param str to_country_code: A destination country code. Based on phone number in To. - :param bool branded: A boolean flag indicating whether or not the calls were branded using Twilio Branded Calls. - :param bool verified_caller: A boolean flag indicating whether or not the caller was verified using SHAKEN/STIR. + :param bool verified_caller: A boolean flag indicating whether or not the caller was verified using SHAKEN/STIR.One of 'true' or 'false'. :param bool has_tag: A boolean flag indicating the presence of one or more [Voice Insights Call Tags](https://www.twilio.com/docs/voice/voice-insights/api/call/details-call-tags). :param str start_time: A Start time of the calls. xm (x minutes), xh (x hours), xd (x days), 1w, 30m, 3d, 4w or datetime-ISO. Defaults to 4h. :param str end_time: An End Time of the calls. xm (x minutes), xh (x hours), xd (x days), 1w, 30m, 3d, 4w or datetime-ISO. Defaults to 0m. @@ -235,6 +242,15 @@ def stream( :param str quality_issue_annotation: A subjective Quality Issue with the calls. One of `no_quality_issue`, `low_volume`, `choppy_robotic`, `echo`, `dtmf`, `latency`, `owa`, `static_noise`. :param bool spam_annotation: A boolean flag indicating spam calls. :param str call_score_annotation: A Call Score of the calls. Use a range of 1-5 to indicate the call experience score, with the following mapping as a reference for the rated call [5: Excellent, 4: Good, 3 : Fair, 2 : Poor, 1: Bad]. + :param bool branded_enabled: A boolean flag indicating whether or not the calls were branded using Twilio Branded Calls. One of 'true' or 'false' + :param bool voice_integrity_enabled: A boolean flag indicating whether or not the phone number had voice integrity enabled.One of 'true' or 'false' + :param str branded_bundle_sid: A unique SID identifier of the Branded Call. + :param str voice_integrity_bundle_sid: A unique SID identifier of the Voice Integrity Profile. + :param str voice_integrity_use_case: A Voice Integrity Use Case . Is of type enum. One of 'abandoned_cart', 'appointment_reminders', 'appointment_scheduling', 'asset_management', 'automated_support', 'call_tracking', 'click_to_call', 'contact_tracing', 'contactless_delivery', 'customer_support', 'dating/social', 'delivery_notifications', 'distance_learning', 'emergency_notifications', 'employee_notifications', 'exam_proctoring', 'field_notifications', 'first_responder', 'fraud_alerts', 'group_messaging', 'identify_&_verification', 'intelligent_routing', 'lead_alerts', 'lead_distribution', 'lead_generation', 'lead_management', 'lead_nurturing', 'marketing_events', 'mass_alerts', 'meetings/collaboration', 'order_notifications', 'outbound_dialer', 'pharmacy', 'phone_system', 'purchase_confirmation', 'remote_appointments', 'rewards_program', 'self-service', 'service_alerts', 'shift_management', 'survey/research', 'telehealth', 'telemarketing', 'therapy_(individual+group)'. + :param str business_profile_identity: A Business Identity of the calls. Is of type enum. One of 'direct_customer', 'isv_reseller_or_partner'. + :param str business_profile_industry: A Business Industry of the calls. Is of type enum. One of 'automotive', 'agriculture', 'banking', 'consumer', 'construction', 'education', 'engineering', 'energy', 'oil_and_gas', 'fast_moving_consumer_goods', 'financial', 'fintech', 'food_and_beverage', 'government', 'healthcare', 'hospitality', 'insurance', 'legal', 'manufacturing', 'media', 'online', 'professional_services', 'raw_materials', 'real_estate', 'religion', 'retail', 'jewelry', 'technology', 'telecommunications', 'transportation', 'travel', 'electronics', 'not_for_profit' + :param str business_profile_bundle_sid: A unique SID identifier of the Business Profile. + :param str business_profile_type: A Business Profile Type of the calls. Is of type enum. One of 'primary', 'secondary'. :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 @@ -252,7 +268,6 @@ def stream( to_carrier=to_carrier, from_country_code=from_country_code, to_country_code=to_country_code, - branded=branded, verified_caller=verified_caller, has_tag=has_tag, start_time=start_time, @@ -270,6 +285,15 @@ def stream( quality_issue_annotation=quality_issue_annotation, spam_annotation=spam_annotation, call_score_annotation=call_score_annotation, + branded_enabled=branded_enabled, + voice_integrity_enabled=voice_integrity_enabled, + branded_bundle_sid=branded_bundle_sid, + voice_integrity_bundle_sid=voice_integrity_bundle_sid, + voice_integrity_use_case=voice_integrity_use_case, + business_profile_identity=business_profile_identity, + business_profile_industry=business_profile_industry, + business_profile_bundle_sid=business_profile_bundle_sid, + business_profile_type=business_profile_type, page_size=limits["page_size"], ) @@ -283,7 +307,6 @@ async def stream_async( to_carrier: Union[str, object] = values.unset, from_country_code: Union[str, object] = values.unset, to_country_code: Union[str, object] = values.unset, - branded: Union[bool, object] = values.unset, verified_caller: Union[bool, object] = values.unset, has_tag: Union[bool, object] = values.unset, start_time: Union[str, object] = values.unset, @@ -303,6 +326,15 @@ async def stream_async( quality_issue_annotation: Union[str, object] = values.unset, spam_annotation: Union[bool, object] = values.unset, call_score_annotation: Union[str, object] = values.unset, + branded_enabled: Union[bool, object] = values.unset, + voice_integrity_enabled: Union[bool, object] = values.unset, + branded_bundle_sid: Union[str, object] = values.unset, + voice_integrity_bundle_sid: Union[str, object] = values.unset, + voice_integrity_use_case: Union[str, object] = values.unset, + business_profile_identity: Union[str, object] = values.unset, + business_profile_industry: Union[str, object] = values.unset, + business_profile_bundle_sid: Union[str, object] = values.unset, + business_profile_type: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> AsyncIterator[CallSummariesInstance]: @@ -318,8 +350,7 @@ async def stream_async( :param str to_carrier: A destination carrier. :param str from_country_code: A source country code based on phone number in From. :param str to_country_code: A destination country code. Based on phone number in To. - :param bool branded: A boolean flag indicating whether or not the calls were branded using Twilio Branded Calls. - :param bool verified_caller: A boolean flag indicating whether or not the caller was verified using SHAKEN/STIR. + :param bool verified_caller: A boolean flag indicating whether or not the caller was verified using SHAKEN/STIR.One of 'true' or 'false'. :param bool has_tag: A boolean flag indicating the presence of one or more [Voice Insights Call Tags](https://www.twilio.com/docs/voice/voice-insights/api/call/details-call-tags). :param str start_time: A Start time of the calls. xm (x minutes), xh (x hours), xd (x days), 1w, 30m, 3d, 4w or datetime-ISO. Defaults to 4h. :param str end_time: An End Time of the calls. xm (x minutes), xh (x hours), xd (x days), 1w, 30m, 3d, 4w or datetime-ISO. Defaults to 0m. @@ -336,6 +367,15 @@ async def stream_async( :param str quality_issue_annotation: A subjective Quality Issue with the calls. One of `no_quality_issue`, `low_volume`, `choppy_robotic`, `echo`, `dtmf`, `latency`, `owa`, `static_noise`. :param bool spam_annotation: A boolean flag indicating spam calls. :param str call_score_annotation: A Call Score of the calls. Use a range of 1-5 to indicate the call experience score, with the following mapping as a reference for the rated call [5: Excellent, 4: Good, 3 : Fair, 2 : Poor, 1: Bad]. + :param bool branded_enabled: A boolean flag indicating whether or not the calls were branded using Twilio Branded Calls. One of 'true' or 'false' + :param bool voice_integrity_enabled: A boolean flag indicating whether or not the phone number had voice integrity enabled.One of 'true' or 'false' + :param str branded_bundle_sid: A unique SID identifier of the Branded Call. + :param str voice_integrity_bundle_sid: A unique SID identifier of the Voice Integrity Profile. + :param str voice_integrity_use_case: A Voice Integrity Use Case . Is of type enum. One of 'abandoned_cart', 'appointment_reminders', 'appointment_scheduling', 'asset_management', 'automated_support', 'call_tracking', 'click_to_call', 'contact_tracing', 'contactless_delivery', 'customer_support', 'dating/social', 'delivery_notifications', 'distance_learning', 'emergency_notifications', 'employee_notifications', 'exam_proctoring', 'field_notifications', 'first_responder', 'fraud_alerts', 'group_messaging', 'identify_&_verification', 'intelligent_routing', 'lead_alerts', 'lead_distribution', 'lead_generation', 'lead_management', 'lead_nurturing', 'marketing_events', 'mass_alerts', 'meetings/collaboration', 'order_notifications', 'outbound_dialer', 'pharmacy', 'phone_system', 'purchase_confirmation', 'remote_appointments', 'rewards_program', 'self-service', 'service_alerts', 'shift_management', 'survey/research', 'telehealth', 'telemarketing', 'therapy_(individual+group)'. + :param str business_profile_identity: A Business Identity of the calls. Is of type enum. One of 'direct_customer', 'isv_reseller_or_partner'. + :param str business_profile_industry: A Business Industry of the calls. Is of type enum. One of 'automotive', 'agriculture', 'banking', 'consumer', 'construction', 'education', 'engineering', 'energy', 'oil_and_gas', 'fast_moving_consumer_goods', 'financial', 'fintech', 'food_and_beverage', 'government', 'healthcare', 'hospitality', 'insurance', 'legal', 'manufacturing', 'media', 'online', 'professional_services', 'raw_materials', 'real_estate', 'religion', 'retail', 'jewelry', 'technology', 'telecommunications', 'transportation', 'travel', 'electronics', 'not_for_profit' + :param str business_profile_bundle_sid: A unique SID identifier of the Business Profile. + :param str business_profile_type: A Business Profile Type of the calls. Is of type enum. One of 'primary', 'secondary'. :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 @@ -353,7 +393,6 @@ async def stream_async( to_carrier=to_carrier, from_country_code=from_country_code, to_country_code=to_country_code, - branded=branded, verified_caller=verified_caller, has_tag=has_tag, start_time=start_time, @@ -371,6 +410,15 @@ async def stream_async( quality_issue_annotation=quality_issue_annotation, spam_annotation=spam_annotation, call_score_annotation=call_score_annotation, + branded_enabled=branded_enabled, + voice_integrity_enabled=voice_integrity_enabled, + branded_bundle_sid=branded_bundle_sid, + voice_integrity_bundle_sid=voice_integrity_bundle_sid, + voice_integrity_use_case=voice_integrity_use_case, + business_profile_identity=business_profile_identity, + business_profile_industry=business_profile_industry, + business_profile_bundle_sid=business_profile_bundle_sid, + business_profile_type=business_profile_type, page_size=limits["page_size"], ) @@ -384,7 +432,6 @@ def list( to_carrier: Union[str, object] = values.unset, from_country_code: Union[str, object] = values.unset, to_country_code: Union[str, object] = values.unset, - branded: Union[bool, object] = values.unset, verified_caller: Union[bool, object] = values.unset, has_tag: Union[bool, object] = values.unset, start_time: Union[str, object] = values.unset, @@ -404,6 +451,15 @@ def list( quality_issue_annotation: Union[str, object] = values.unset, spam_annotation: Union[bool, object] = values.unset, call_score_annotation: Union[str, object] = values.unset, + branded_enabled: Union[bool, object] = values.unset, + voice_integrity_enabled: Union[bool, object] = values.unset, + branded_bundle_sid: Union[str, object] = values.unset, + voice_integrity_bundle_sid: Union[str, object] = values.unset, + voice_integrity_use_case: Union[str, object] = values.unset, + business_profile_identity: Union[str, object] = values.unset, + business_profile_industry: Union[str, object] = values.unset, + business_profile_bundle_sid: Union[str, object] = values.unset, + business_profile_type: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> List[CallSummariesInstance]: @@ -418,8 +474,7 @@ def list( :param str to_carrier: A destination carrier. :param str from_country_code: A source country code based on phone number in From. :param str to_country_code: A destination country code. Based on phone number in To. - :param bool branded: A boolean flag indicating whether or not the calls were branded using Twilio Branded Calls. - :param bool verified_caller: A boolean flag indicating whether or not the caller was verified using SHAKEN/STIR. + :param bool verified_caller: A boolean flag indicating whether or not the caller was verified using SHAKEN/STIR.One of 'true' or 'false'. :param bool has_tag: A boolean flag indicating the presence of one or more [Voice Insights Call Tags](https://www.twilio.com/docs/voice/voice-insights/api/call/details-call-tags). :param str start_time: A Start time of the calls. xm (x minutes), xh (x hours), xd (x days), 1w, 30m, 3d, 4w or datetime-ISO. Defaults to 4h. :param str end_time: An End Time of the calls. xm (x minutes), xh (x hours), xd (x days), 1w, 30m, 3d, 4w or datetime-ISO. Defaults to 0m. @@ -436,6 +491,15 @@ def list( :param str quality_issue_annotation: A subjective Quality Issue with the calls. One of `no_quality_issue`, `low_volume`, `choppy_robotic`, `echo`, `dtmf`, `latency`, `owa`, `static_noise`. :param bool spam_annotation: A boolean flag indicating spam calls. :param str call_score_annotation: A Call Score of the calls. Use a range of 1-5 to indicate the call experience score, with the following mapping as a reference for the rated call [5: Excellent, 4: Good, 3 : Fair, 2 : Poor, 1: Bad]. + :param bool branded_enabled: A boolean flag indicating whether or not the calls were branded using Twilio Branded Calls. One of 'true' or 'false' + :param bool voice_integrity_enabled: A boolean flag indicating whether or not the phone number had voice integrity enabled.One of 'true' or 'false' + :param str branded_bundle_sid: A unique SID identifier of the Branded Call. + :param str voice_integrity_bundle_sid: A unique SID identifier of the Voice Integrity Profile. + :param str voice_integrity_use_case: A Voice Integrity Use Case . Is of type enum. One of 'abandoned_cart', 'appointment_reminders', 'appointment_scheduling', 'asset_management', 'automated_support', 'call_tracking', 'click_to_call', 'contact_tracing', 'contactless_delivery', 'customer_support', 'dating/social', 'delivery_notifications', 'distance_learning', 'emergency_notifications', 'employee_notifications', 'exam_proctoring', 'field_notifications', 'first_responder', 'fraud_alerts', 'group_messaging', 'identify_&_verification', 'intelligent_routing', 'lead_alerts', 'lead_distribution', 'lead_generation', 'lead_management', 'lead_nurturing', 'marketing_events', 'mass_alerts', 'meetings/collaboration', 'order_notifications', 'outbound_dialer', 'pharmacy', 'phone_system', 'purchase_confirmation', 'remote_appointments', 'rewards_program', 'self-service', 'service_alerts', 'shift_management', 'survey/research', 'telehealth', 'telemarketing', 'therapy_(individual+group)'. + :param str business_profile_identity: A Business Identity of the calls. Is of type enum. One of 'direct_customer', 'isv_reseller_or_partner'. + :param str business_profile_industry: A Business Industry of the calls. Is of type enum. One of 'automotive', 'agriculture', 'banking', 'consumer', 'construction', 'education', 'engineering', 'energy', 'oil_and_gas', 'fast_moving_consumer_goods', 'financial', 'fintech', 'food_and_beverage', 'government', 'healthcare', 'hospitality', 'insurance', 'legal', 'manufacturing', 'media', 'online', 'professional_services', 'raw_materials', 'real_estate', 'religion', 'retail', 'jewelry', 'technology', 'telecommunications', 'transportation', 'travel', 'electronics', 'not_for_profit' + :param str business_profile_bundle_sid: A unique SID identifier of the Business Profile. + :param str business_profile_type: A Business Profile Type of the calls. Is of type enum. One of 'primary', 'secondary'. :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 @@ -453,7 +517,6 @@ def list( to_carrier=to_carrier, from_country_code=from_country_code, to_country_code=to_country_code, - branded=branded, verified_caller=verified_caller, has_tag=has_tag, start_time=start_time, @@ -471,6 +534,15 @@ def list( quality_issue_annotation=quality_issue_annotation, spam_annotation=spam_annotation, call_score_annotation=call_score_annotation, + branded_enabled=branded_enabled, + voice_integrity_enabled=voice_integrity_enabled, + branded_bundle_sid=branded_bundle_sid, + voice_integrity_bundle_sid=voice_integrity_bundle_sid, + voice_integrity_use_case=voice_integrity_use_case, + business_profile_identity=business_profile_identity, + business_profile_industry=business_profile_industry, + business_profile_bundle_sid=business_profile_bundle_sid, + business_profile_type=business_profile_type, limit=limit, page_size=page_size, ) @@ -484,7 +556,6 @@ async def list_async( to_carrier: Union[str, object] = values.unset, from_country_code: Union[str, object] = values.unset, to_country_code: Union[str, object] = values.unset, - branded: Union[bool, object] = values.unset, verified_caller: Union[bool, object] = values.unset, has_tag: Union[bool, object] = values.unset, start_time: Union[str, object] = values.unset, @@ -504,6 +575,15 @@ async def list_async( quality_issue_annotation: Union[str, object] = values.unset, spam_annotation: Union[bool, object] = values.unset, call_score_annotation: Union[str, object] = values.unset, + branded_enabled: Union[bool, object] = values.unset, + voice_integrity_enabled: Union[bool, object] = values.unset, + branded_bundle_sid: Union[str, object] = values.unset, + voice_integrity_bundle_sid: Union[str, object] = values.unset, + voice_integrity_use_case: Union[str, object] = values.unset, + business_profile_identity: Union[str, object] = values.unset, + business_profile_industry: Union[str, object] = values.unset, + business_profile_bundle_sid: Union[str, object] = values.unset, + business_profile_type: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> List[CallSummariesInstance]: @@ -518,8 +598,7 @@ async def list_async( :param str to_carrier: A destination carrier. :param str from_country_code: A source country code based on phone number in From. :param str to_country_code: A destination country code. Based on phone number in To. - :param bool branded: A boolean flag indicating whether or not the calls were branded using Twilio Branded Calls. - :param bool verified_caller: A boolean flag indicating whether or not the caller was verified using SHAKEN/STIR. + :param bool verified_caller: A boolean flag indicating whether or not the caller was verified using SHAKEN/STIR.One of 'true' or 'false'. :param bool has_tag: A boolean flag indicating the presence of one or more [Voice Insights Call Tags](https://www.twilio.com/docs/voice/voice-insights/api/call/details-call-tags). :param str start_time: A Start time of the calls. xm (x minutes), xh (x hours), xd (x days), 1w, 30m, 3d, 4w or datetime-ISO. Defaults to 4h. :param str end_time: An End Time of the calls. xm (x minutes), xh (x hours), xd (x days), 1w, 30m, 3d, 4w or datetime-ISO. Defaults to 0m. @@ -536,6 +615,15 @@ async def list_async( :param str quality_issue_annotation: A subjective Quality Issue with the calls. One of `no_quality_issue`, `low_volume`, `choppy_robotic`, `echo`, `dtmf`, `latency`, `owa`, `static_noise`. :param bool spam_annotation: A boolean flag indicating spam calls. :param str call_score_annotation: A Call Score of the calls. Use a range of 1-5 to indicate the call experience score, with the following mapping as a reference for the rated call [5: Excellent, 4: Good, 3 : Fair, 2 : Poor, 1: Bad]. + :param bool branded_enabled: A boolean flag indicating whether or not the calls were branded using Twilio Branded Calls. One of 'true' or 'false' + :param bool voice_integrity_enabled: A boolean flag indicating whether or not the phone number had voice integrity enabled.One of 'true' or 'false' + :param str branded_bundle_sid: A unique SID identifier of the Branded Call. + :param str voice_integrity_bundle_sid: A unique SID identifier of the Voice Integrity Profile. + :param str voice_integrity_use_case: A Voice Integrity Use Case . Is of type enum. One of 'abandoned_cart', 'appointment_reminders', 'appointment_scheduling', 'asset_management', 'automated_support', 'call_tracking', 'click_to_call', 'contact_tracing', 'contactless_delivery', 'customer_support', 'dating/social', 'delivery_notifications', 'distance_learning', 'emergency_notifications', 'employee_notifications', 'exam_proctoring', 'field_notifications', 'first_responder', 'fraud_alerts', 'group_messaging', 'identify_&_verification', 'intelligent_routing', 'lead_alerts', 'lead_distribution', 'lead_generation', 'lead_management', 'lead_nurturing', 'marketing_events', 'mass_alerts', 'meetings/collaboration', 'order_notifications', 'outbound_dialer', 'pharmacy', 'phone_system', 'purchase_confirmation', 'remote_appointments', 'rewards_program', 'self-service', 'service_alerts', 'shift_management', 'survey/research', 'telehealth', 'telemarketing', 'therapy_(individual+group)'. + :param str business_profile_identity: A Business Identity of the calls. Is of type enum. One of 'direct_customer', 'isv_reseller_or_partner'. + :param str business_profile_industry: A Business Industry of the calls. Is of type enum. One of 'automotive', 'agriculture', 'banking', 'consumer', 'construction', 'education', 'engineering', 'energy', 'oil_and_gas', 'fast_moving_consumer_goods', 'financial', 'fintech', 'food_and_beverage', 'government', 'healthcare', 'hospitality', 'insurance', 'legal', 'manufacturing', 'media', 'online', 'professional_services', 'raw_materials', 'real_estate', 'religion', 'retail', 'jewelry', 'technology', 'telecommunications', 'transportation', 'travel', 'electronics', 'not_for_profit' + :param str business_profile_bundle_sid: A unique SID identifier of the Business Profile. + :param str business_profile_type: A Business Profile Type of the calls. Is of type enum. One of 'primary', 'secondary'. :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 @@ -554,7 +642,6 @@ async def list_async( to_carrier=to_carrier, from_country_code=from_country_code, to_country_code=to_country_code, - branded=branded, verified_caller=verified_caller, has_tag=has_tag, start_time=start_time, @@ -572,6 +659,15 @@ async def list_async( quality_issue_annotation=quality_issue_annotation, spam_annotation=spam_annotation, call_score_annotation=call_score_annotation, + branded_enabled=branded_enabled, + voice_integrity_enabled=voice_integrity_enabled, + branded_bundle_sid=branded_bundle_sid, + voice_integrity_bundle_sid=voice_integrity_bundle_sid, + voice_integrity_use_case=voice_integrity_use_case, + business_profile_identity=business_profile_identity, + business_profile_industry=business_profile_industry, + business_profile_bundle_sid=business_profile_bundle_sid, + business_profile_type=business_profile_type, limit=limit, page_size=page_size, ) @@ -585,7 +681,6 @@ def page( to_carrier: Union[str, object] = values.unset, from_country_code: Union[str, object] = values.unset, to_country_code: Union[str, object] = values.unset, - branded: Union[bool, object] = values.unset, verified_caller: Union[bool, object] = values.unset, has_tag: Union[bool, object] = values.unset, start_time: Union[str, object] = values.unset, @@ -605,6 +700,15 @@ def page( quality_issue_annotation: Union[str, object] = values.unset, spam_annotation: Union[bool, object] = values.unset, call_score_annotation: Union[str, object] = values.unset, + branded_enabled: Union[bool, object] = values.unset, + voice_integrity_enabled: Union[bool, object] = values.unset, + branded_bundle_sid: Union[str, object] = values.unset, + voice_integrity_bundle_sid: Union[str, object] = values.unset, + voice_integrity_use_case: Union[str, object] = values.unset, + business_profile_identity: Union[str, object] = values.unset, + business_profile_industry: Union[str, object] = values.unset, + business_profile_bundle_sid: Union[str, object] = values.unset, + business_profile_type: Union[str, object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, page_size: Union[int, object] = values.unset, @@ -619,8 +723,7 @@ def page( :param to_carrier: A destination carrier. :param from_country_code: A source country code based on phone number in From. :param to_country_code: A destination country code. Based on phone number in To. - :param branded: A boolean flag indicating whether or not the calls were branded using Twilio Branded Calls. - :param verified_caller: A boolean flag indicating whether or not the caller was verified using SHAKEN/STIR. + :param verified_caller: A boolean flag indicating whether or not the caller was verified using SHAKEN/STIR.One of 'true' or 'false'. :param has_tag: A boolean flag indicating the presence of one or more [Voice Insights Call Tags](https://www.twilio.com/docs/voice/voice-insights/api/call/details-call-tags). :param start_time: A Start time of the calls. xm (x minutes), xh (x hours), xd (x days), 1w, 30m, 3d, 4w or datetime-ISO. Defaults to 4h. :param end_time: An End Time of the calls. xm (x minutes), xh (x hours), xd (x days), 1w, 30m, 3d, 4w or datetime-ISO. Defaults to 0m. @@ -637,6 +740,15 @@ def page( :param quality_issue_annotation: A subjective Quality Issue with the calls. One of `no_quality_issue`, `low_volume`, `choppy_robotic`, `echo`, `dtmf`, `latency`, `owa`, `static_noise`. :param spam_annotation: A boolean flag indicating spam calls. :param call_score_annotation: A Call Score of the calls. Use a range of 1-5 to indicate the call experience score, with the following mapping as a reference for the rated call [5: Excellent, 4: Good, 3 : Fair, 2 : Poor, 1: Bad]. + :param branded_enabled: A boolean flag indicating whether or not the calls were branded using Twilio Branded Calls. One of 'true' or 'false' + :param voice_integrity_enabled: A boolean flag indicating whether or not the phone number had voice integrity enabled.One of 'true' or 'false' + :param branded_bundle_sid: A unique SID identifier of the Branded Call. + :param voice_integrity_bundle_sid: A unique SID identifier of the Voice Integrity Profile. + :param voice_integrity_use_case: A Voice Integrity Use Case . Is of type enum. One of 'abandoned_cart', 'appointment_reminders', 'appointment_scheduling', 'asset_management', 'automated_support', 'call_tracking', 'click_to_call', 'contact_tracing', 'contactless_delivery', 'customer_support', 'dating/social', 'delivery_notifications', 'distance_learning', 'emergency_notifications', 'employee_notifications', 'exam_proctoring', 'field_notifications', 'first_responder', 'fraud_alerts', 'group_messaging', 'identify_&_verification', 'intelligent_routing', 'lead_alerts', 'lead_distribution', 'lead_generation', 'lead_management', 'lead_nurturing', 'marketing_events', 'mass_alerts', 'meetings/collaboration', 'order_notifications', 'outbound_dialer', 'pharmacy', 'phone_system', 'purchase_confirmation', 'remote_appointments', 'rewards_program', 'self-service', 'service_alerts', 'shift_management', 'survey/research', 'telehealth', 'telemarketing', 'therapy_(individual+group)'. + :param business_profile_identity: A Business Identity of the calls. Is of type enum. One of 'direct_customer', 'isv_reseller_or_partner'. + :param business_profile_industry: A Business Industry of the calls. Is of type enum. One of 'automotive', 'agriculture', 'banking', 'consumer', 'construction', 'education', 'engineering', 'energy', 'oil_and_gas', 'fast_moving_consumer_goods', 'financial', 'fintech', 'food_and_beverage', 'government', 'healthcare', 'hospitality', 'insurance', 'legal', 'manufacturing', 'media', 'online', 'professional_services', 'raw_materials', 'real_estate', 'religion', 'retail', 'jewelry', 'technology', 'telecommunications', 'transportation', 'travel', 'electronics', 'not_for_profit' + :param business_profile_bundle_sid: A unique SID identifier of the Business Profile. + :param business_profile_type: A Business Profile Type of the calls. Is of type enum. One of 'primary', 'secondary'. :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 @@ -651,7 +763,6 @@ def page( "ToCarrier": to_carrier, "FromCountryCode": from_country_code, "ToCountryCode": to_country_code, - "Branded": serialize.boolean_to_string(branded), "VerifiedCaller": serialize.boolean_to_string(verified_caller), "HasTag": serialize.boolean_to_string(has_tag), "StartTime": start_time, @@ -669,6 +780,17 @@ def page( "QualityIssueAnnotation": quality_issue_annotation, "SpamAnnotation": serialize.boolean_to_string(spam_annotation), "CallScoreAnnotation": call_score_annotation, + "BrandedEnabled": serialize.boolean_to_string(branded_enabled), + "VoiceIntegrityEnabled": serialize.boolean_to_string( + voice_integrity_enabled + ), + "BrandedBundleSid": branded_bundle_sid, + "VoiceIntegrityBundleSid": voice_integrity_bundle_sid, + "VoiceIntegrityUseCase": voice_integrity_use_case, + "BusinessProfileIdentity": business_profile_identity, + "BusinessProfileIndustry": business_profile_industry, + "BusinessProfileBundleSid": business_profile_bundle_sid, + "BusinessProfileType": business_profile_type, "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -686,7 +808,6 @@ async def page_async( to_carrier: Union[str, object] = values.unset, from_country_code: Union[str, object] = values.unset, to_country_code: Union[str, object] = values.unset, - branded: Union[bool, object] = values.unset, verified_caller: Union[bool, object] = values.unset, has_tag: Union[bool, object] = values.unset, start_time: Union[str, object] = values.unset, @@ -706,6 +827,15 @@ async def page_async( quality_issue_annotation: Union[str, object] = values.unset, spam_annotation: Union[bool, object] = values.unset, call_score_annotation: Union[str, object] = values.unset, + branded_enabled: Union[bool, object] = values.unset, + voice_integrity_enabled: Union[bool, object] = values.unset, + branded_bundle_sid: Union[str, object] = values.unset, + voice_integrity_bundle_sid: Union[str, object] = values.unset, + voice_integrity_use_case: Union[str, object] = values.unset, + business_profile_identity: Union[str, object] = values.unset, + business_profile_industry: Union[str, object] = values.unset, + business_profile_bundle_sid: Union[str, object] = values.unset, + business_profile_type: Union[str, object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, page_size: Union[int, object] = values.unset, @@ -720,8 +850,7 @@ async def page_async( :param to_carrier: A destination carrier. :param from_country_code: A source country code based on phone number in From. :param to_country_code: A destination country code. Based on phone number in To. - :param branded: A boolean flag indicating whether or not the calls were branded using Twilio Branded Calls. - :param verified_caller: A boolean flag indicating whether or not the caller was verified using SHAKEN/STIR. + :param verified_caller: A boolean flag indicating whether or not the caller was verified using SHAKEN/STIR.One of 'true' or 'false'. :param has_tag: A boolean flag indicating the presence of one or more [Voice Insights Call Tags](https://www.twilio.com/docs/voice/voice-insights/api/call/details-call-tags). :param start_time: A Start time of the calls. xm (x minutes), xh (x hours), xd (x days), 1w, 30m, 3d, 4w or datetime-ISO. Defaults to 4h. :param end_time: An End Time of the calls. xm (x minutes), xh (x hours), xd (x days), 1w, 30m, 3d, 4w or datetime-ISO. Defaults to 0m. @@ -738,6 +867,15 @@ async def page_async( :param quality_issue_annotation: A subjective Quality Issue with the calls. One of `no_quality_issue`, `low_volume`, `choppy_robotic`, `echo`, `dtmf`, `latency`, `owa`, `static_noise`. :param spam_annotation: A boolean flag indicating spam calls. :param call_score_annotation: A Call Score of the calls. Use a range of 1-5 to indicate the call experience score, with the following mapping as a reference for the rated call [5: Excellent, 4: Good, 3 : Fair, 2 : Poor, 1: Bad]. + :param branded_enabled: A boolean flag indicating whether or not the calls were branded using Twilio Branded Calls. One of 'true' or 'false' + :param voice_integrity_enabled: A boolean flag indicating whether or not the phone number had voice integrity enabled.One of 'true' or 'false' + :param branded_bundle_sid: A unique SID identifier of the Branded Call. + :param voice_integrity_bundle_sid: A unique SID identifier of the Voice Integrity Profile. + :param voice_integrity_use_case: A Voice Integrity Use Case . Is of type enum. One of 'abandoned_cart', 'appointment_reminders', 'appointment_scheduling', 'asset_management', 'automated_support', 'call_tracking', 'click_to_call', 'contact_tracing', 'contactless_delivery', 'customer_support', 'dating/social', 'delivery_notifications', 'distance_learning', 'emergency_notifications', 'employee_notifications', 'exam_proctoring', 'field_notifications', 'first_responder', 'fraud_alerts', 'group_messaging', 'identify_&_verification', 'intelligent_routing', 'lead_alerts', 'lead_distribution', 'lead_generation', 'lead_management', 'lead_nurturing', 'marketing_events', 'mass_alerts', 'meetings/collaboration', 'order_notifications', 'outbound_dialer', 'pharmacy', 'phone_system', 'purchase_confirmation', 'remote_appointments', 'rewards_program', 'self-service', 'service_alerts', 'shift_management', 'survey/research', 'telehealth', 'telemarketing', 'therapy_(individual+group)'. + :param business_profile_identity: A Business Identity of the calls. Is of type enum. One of 'direct_customer', 'isv_reseller_or_partner'. + :param business_profile_industry: A Business Industry of the calls. Is of type enum. One of 'automotive', 'agriculture', 'banking', 'consumer', 'construction', 'education', 'engineering', 'energy', 'oil_and_gas', 'fast_moving_consumer_goods', 'financial', 'fintech', 'food_and_beverage', 'government', 'healthcare', 'hospitality', 'insurance', 'legal', 'manufacturing', 'media', 'online', 'professional_services', 'raw_materials', 'real_estate', 'religion', 'retail', 'jewelry', 'technology', 'telecommunications', 'transportation', 'travel', 'electronics', 'not_for_profit' + :param business_profile_bundle_sid: A unique SID identifier of the Business Profile. + :param business_profile_type: A Business Profile Type of the calls. Is of type enum. One of 'primary', 'secondary'. :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 @@ -752,7 +890,6 @@ async def page_async( "ToCarrier": to_carrier, "FromCountryCode": from_country_code, "ToCountryCode": to_country_code, - "Branded": serialize.boolean_to_string(branded), "VerifiedCaller": serialize.boolean_to_string(verified_caller), "HasTag": serialize.boolean_to_string(has_tag), "StartTime": start_time, @@ -770,6 +907,17 @@ async def page_async( "QualityIssueAnnotation": quality_issue_annotation, "SpamAnnotation": serialize.boolean_to_string(spam_annotation), "CallScoreAnnotation": call_score_annotation, + "BrandedEnabled": serialize.boolean_to_string(branded_enabled), + "VoiceIntegrityEnabled": serialize.boolean_to_string( + voice_integrity_enabled + ), + "BrandedBundleSid": branded_bundle_sid, + "VoiceIntegrityBundleSid": voice_integrity_bundle_sid, + "VoiceIntegrityUseCase": voice_integrity_use_case, + "BusinessProfileIdentity": business_profile_identity, + "BusinessProfileIndustry": business_profile_industry, + "BusinessProfileBundleSid": business_profile_bundle_sid, + "BusinessProfileType": business_profile_type, "PageToken": page_token, "Page": page_number, "PageSize": page_size, diff --git a/twilio/rest/intelligence/v2/operator_type.py b/twilio/rest/intelligence/v2/operator_type.py index 9884df0aee..ff2403b1cb 100644 --- a/twilio/rest/intelligence/v2/operator_type.py +++ b/twilio/rest/intelligence/v2/operator_type.py @@ -145,7 +145,7 @@ def __init__(self, version: Version, sid: str): Initialize the OperatorTypeContext :param version: Version that contains the resource - :param sid: A 34 character string that uniquely identifies this Operator Type. + :param sid: Either a 34 character string that uniquely identifies this Operator Type or the unique name that references an Operator Type. """ super().__init__(version) @@ -422,7 +422,7 @@ def get(self, sid: str) -> OperatorTypeContext: """ Constructs a OperatorTypeContext - :param sid: A 34 character string that uniquely identifies this Operator Type. + :param sid: Either a 34 character string that uniquely identifies this Operator Type or the unique name that references an Operator Type. """ return OperatorTypeContext(self._version, sid=sid) @@ -430,7 +430,7 @@ def __call__(self, sid: str) -> OperatorTypeContext: """ Constructs a OperatorTypeContext - :param sid: A 34 character string that uniquely identifies this Operator Type. + :param sid: Either a 34 character string that uniquely identifies this Operator Type or the unique name that references an Operator Type. """ return OperatorTypeContext(self._version, sid=sid) diff --git a/twilio/rest/intelligence/v2/transcript/sentence.py b/twilio/rest/intelligence/v2/transcript/sentence.py index 5bdd18b00f..4a2229b8a4 100644 --- a/twilio/rest/intelligence/v2/transcript/sentence.py +++ b/twilio/rest/intelligence/v2/transcript/sentence.py @@ -30,6 +30,7 @@ class SentenceInstance(InstanceResource): :ivar transcript: Transcript text. :ivar sid: A 34 character string that uniquely identifies this Sentence. :ivar confidence: + :ivar words: Detailed information for each of the words of the given Sentence. """ def __init__(self, version: Version, payload: Dict[str, Any], transcript_sid: str): @@ -50,6 +51,7 @@ def __init__(self, version: Version, payload: Dict[str, Any], transcript_sid: st self.confidence: Optional[float] = deserialize.decimal( payload.get("confidence") ) + self.words: Optional[List[Dict[str, object]]] = payload.get("words") self._solution = { "transcript_sid": transcript_sid, @@ -107,6 +109,7 @@ def __init__(self, version: Version, transcript_sid: str): def stream( self, redacted: Union[bool, object] = values.unset, + word_timestamps: Union[bool, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> Iterator[SentenceInstance]: @@ -117,6 +120,7 @@ def stream( The results are returned as a generator, so this operation is memory efficient. :param bool redacted: Grant access to PII Redacted/Unredacted Sentences. If redaction is enabled, the default is `true` to access redacted sentences. + :param bool word_timestamps: Returns word level timestamps information, if word_timestamps is enabled. The default is `false`. :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 @@ -127,13 +131,18 @@ def stream( :returns: Generator that will yield up to limit results """ limits = self._version.read_limits(limit, page_size) - page = self.page(redacted=redacted, page_size=limits["page_size"]) + page = self.page( + redacted=redacted, + word_timestamps=word_timestamps, + page_size=limits["page_size"], + ) return self._version.stream(page, limits["limit"]) async def stream_async( self, redacted: Union[bool, object] = values.unset, + word_timestamps: Union[bool, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> AsyncIterator[SentenceInstance]: @@ -144,6 +153,7 @@ async def stream_async( The results are returned as a generator, so this operation is memory efficient. :param bool redacted: Grant access to PII Redacted/Unredacted Sentences. If redaction is enabled, the default is `true` to access redacted sentences. + :param bool word_timestamps: Returns word level timestamps information, if word_timestamps is enabled. The default is `false`. :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 @@ -154,13 +164,18 @@ async def stream_async( :returns: Generator that will yield up to limit results """ limits = self._version.read_limits(limit, page_size) - page = await self.page_async(redacted=redacted, page_size=limits["page_size"]) + page = await self.page_async( + redacted=redacted, + word_timestamps=word_timestamps, + page_size=limits["page_size"], + ) return self._version.stream_async(page, limits["limit"]) def list( self, redacted: Union[bool, object] = values.unset, + word_timestamps: Union[bool, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> List[SentenceInstance]: @@ -170,6 +185,7 @@ def list( memory before returning. :param bool redacted: Grant access to PII Redacted/Unredacted Sentences. If redaction is enabled, the default is `true` to access redacted sentences. + :param bool word_timestamps: Returns word level timestamps information, if word_timestamps is enabled. The default is `false`. :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 @@ -182,6 +198,7 @@ def list( return list( self.stream( redacted=redacted, + word_timestamps=word_timestamps, limit=limit, page_size=page_size, ) @@ -190,6 +207,7 @@ def list( async def list_async( self, redacted: Union[bool, object] = values.unset, + word_timestamps: Union[bool, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> List[SentenceInstance]: @@ -199,6 +217,7 @@ async def list_async( memory before returning. :param bool redacted: Grant access to PII Redacted/Unredacted Sentences. If redaction is enabled, the default is `true` to access redacted sentences. + :param bool word_timestamps: Returns word level timestamps information, if word_timestamps is enabled. The default is `false`. :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 @@ -212,6 +231,7 @@ async def list_async( record async for record in await self.stream_async( redacted=redacted, + word_timestamps=word_timestamps, limit=limit, page_size=page_size, ) @@ -220,6 +240,7 @@ async def list_async( def page( self, redacted: Union[bool, object] = values.unset, + word_timestamps: Union[bool, object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, page_size: Union[int, object] = values.unset, @@ -229,6 +250,7 @@ def page( Request is executed immediately :param redacted: Grant access to PII Redacted/Unredacted Sentences. If redaction is enabled, the default is `true` to access redacted sentences. + :param word_timestamps: Returns word level timestamps information, if word_timestamps is enabled. The default is `false`. :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 @@ -238,6 +260,7 @@ def page( data = values.of( { "Redacted": serialize.boolean_to_string(redacted), + "WordTimestamps": serialize.boolean_to_string(word_timestamps), "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -250,6 +273,7 @@ def page( async def page_async( self, redacted: Union[bool, object] = values.unset, + word_timestamps: Union[bool, object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, page_size: Union[int, object] = values.unset, @@ -259,6 +283,7 @@ async def page_async( Request is executed immediately :param redacted: Grant access to PII Redacted/Unredacted Sentences. If redaction is enabled, the default is `true` to access redacted sentences. + :param word_timestamps: Returns word level timestamps information, if word_timestamps is enabled. The default is `false`. :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 @@ -268,6 +293,7 @@ async def page_async( data = values.of( { "Redacted": serialize.boolean_to_string(redacted), + "WordTimestamps": serialize.boolean_to_string(word_timestamps), "PageToken": page_token, "Page": page_number, "PageSize": page_size, diff --git a/twilio/rest/marketplace/__init__.py b/twilio/rest/marketplace/__init__.py index 79b10ef6c4..f0276a8f84 100644 --- a/twilio/rest/marketplace/__init__.py +++ b/twilio/rest/marketplace/__init__.py @@ -7,4 +7,3 @@ def available_add_ons(self): def installed_add_ons(self): return self.v1.installed_add_ons - diff --git a/twilio/rest/marketplace/v1/__init__.py b/twilio/rest/marketplace/v1/__init__.py index 49fc490396..9a29e0b691 100644 --- a/twilio/rest/marketplace/v1/__init__.py +++ b/twilio/rest/marketplace/v1/__init__.py @@ -18,6 +18,7 @@ from twilio.rest.marketplace.v1.available_add_on import AvailableAddOnList from twilio.rest.marketplace.v1.installed_add_on import InstalledAddOnList from twilio.rest.marketplace.v1.module_data_management import ModuleDataManagementList +from twilio.rest.marketplace.v1.referral_conversion import ReferralConversionList class V1(Version): @@ -32,6 +33,7 @@ def __init__(self, domain: Domain): self._available_add_ons: Optional[AvailableAddOnList] = None self._installed_add_ons: Optional[InstalledAddOnList] = None self._module_data_management: Optional[ModuleDataManagementList] = None + self._referral_conversion: Optional[ReferralConversionList] = None @property def available_add_ons(self) -> AvailableAddOnList: @@ -51,6 +53,12 @@ def module_data_management(self) -> ModuleDataManagementList: self._module_data_management = ModuleDataManagementList(self) return self._module_data_management + @property + def referral_conversion(self) -> ReferralConversionList: + if self._referral_conversion is None: + self._referral_conversion = ReferralConversionList(self) + return self._referral_conversion + def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/marketplace/v1/installed_add_on/installed_add_on_usage.py b/twilio/rest/marketplace/v1/installed_add_on/installed_add_on_usage.py index 3f9415ed49..7e44ac4e0e 100644 --- a/twilio/rest/marketplace/v1/installed_add_on/installed_add_on_usage.py +++ b/twilio/rest/marketplace/v1/installed_add_on/installed_add_on_usage.py @@ -52,15 +52,17 @@ def __repr__(self) -> str: class InstalledAddOnUsageList(ListResource): - class CreateBillingUsageRequest(object): + class MarketplaceV1InstalledAddOnInstalledAddOnUsage(object): """ :ivar billable_items: """ - def __init__(self, payload: Dict[str, Any], installed_add_on_sid: str): + def __init__(self, payload: Dict[str, Any]): self.billable_items: Optional[ - List[InstalledAddOnUsageList.CreateBillingUsageRequestBillableItems] + List[ + InstalledAddOnUsageList.MarketplaceV1InstalledAddOnInstalledAddOnUsageBillableItems + ] ] = payload.get("billable_items") def to_dict(self): @@ -70,13 +72,13 @@ def to_dict(self): ], } - class CreateBillingUsageRequestBillableItems(object): + class MarketplaceV1InstalledAddOnInstalledAddOnUsageBillableItems(object): """ - :ivar quantity: - :ivar sid: + :ivar quantity: Any floating number greater than 0. + :ivar sid: BillingSid to use for billing. """ - def __init__(self, payload: Dict[str, Any], installed_add_on_sid: str): + def __init__(self, payload: Dict[str, Any]): self.quantity: Optional[float] = payload.get("quantity") self.sid: Optional[str] = payload.get("sid") @@ -106,16 +108,17 @@ def __init__(self, version: Version, installed_add_on_sid: str): ) def create( - self, create_billing_usage_request: CreateBillingUsageRequest + self, + marketplace_v1_installed_add_on_installed_add_on_usage: MarketplaceV1InstalledAddOnInstalledAddOnUsage, ) -> InstalledAddOnUsageInstance: """ Create the InstalledAddOnUsageInstance - :param create_billing_usage_request: + :param marketplace_v1_installed_add_on_installed_add_on_usage: :returns: The created InstalledAddOnUsageInstance """ - data = create_billing_usage_request.to_dict() + data = marketplace_v1_installed_add_on_installed_add_on_usage.to_dict() headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) headers["Content-Type"] = "application/json" @@ -131,16 +134,17 @@ def create( ) async def create_async( - self, create_billing_usage_request: CreateBillingUsageRequest + self, + marketplace_v1_installed_add_on_installed_add_on_usage: MarketplaceV1InstalledAddOnInstalledAddOnUsage, ) -> InstalledAddOnUsageInstance: """ Asynchronously create the InstalledAddOnUsageInstance - :param create_billing_usage_request: + :param marketplace_v1_installed_add_on_installed_add_on_usage: :returns: The created InstalledAddOnUsageInstance """ - data = create_billing_usage_request.to_dict() + data = marketplace_v1_installed_add_on_installed_add_on_usage.to_dict() headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) headers["Content-Type"] = "application/json" diff --git a/twilio/rest/marketplace/v1/module_data_management.py b/twilio/rest/marketplace/v1/module_data_management.py index 079a1a3343..837f5fc3f7 100644 --- a/twilio/rest/marketplace/v1/module_data_management.py +++ b/twilio/rest/marketplace/v1/module_data_management.py @@ -22,13 +22,14 @@ class ModuleDataManagementInstance(InstanceResource): """ - :ivar url: - :ivar sid: - :ivar description: - :ivar support: - :ivar policies: - :ivar module_info: - :ivar documentation: + :ivar url: URL to query the subresource. + :ivar sid: ModuleSid that identifies this Listing. + :ivar description: A JSON object describing the module and is displayed under the Description tab of the Module detail page. You can define the main body of the description, highlight key features or aspects of the module and if applicable, provide code samples for developers + :ivar support: A JSON object containing information on how customers can obtain support for the module. Use this parameter to provide details such as contact information and support description. + :ivar policies: A JSON object describing the module's privacy and legal policies and is displayed under the Policies tab of the Module detail page. The maximum file size for Policies is 5MB + :ivar module_info: A JSON object containing essential attributes that define a module. This information is presented on the Module detail page in the Twilio Marketplace Catalog. You can pass the following attributes in the JSON object + :ivar documentation: A JSON object for providing comprehensive information, instructions, and resources related to the module + :ivar configuration: A JSON object for providing listing specific configuration. Contains button setup, notification url, among others. """ def __init__( @@ -43,6 +44,7 @@ def __init__( self.policies: Optional[Dict[str, object]] = payload.get("policies") self.module_info: Optional[Dict[str, object]] = payload.get("module_info") self.documentation: Optional[Dict[str, object]] = payload.get("documentation") + self.configuration: Optional[Dict[str, object]] = payload.get("configuration") self._solution = { "sid": sid or self.sid, @@ -89,6 +91,7 @@ def update( documentation: Union[str, object] = values.unset, policies: Union[str, object] = values.unset, support: Union[str, object] = values.unset, + configuration: Union[str, object] = values.unset, ) -> "ModuleDataManagementInstance": """ Update the ModuleDataManagementInstance @@ -98,6 +101,7 @@ def update( :param documentation: :param policies: :param support: + :param configuration: :returns: The updated ModuleDataManagementInstance """ @@ -107,6 +111,7 @@ def update( documentation=documentation, policies=policies, support=support, + configuration=configuration, ) async def update_async( @@ -116,6 +121,7 @@ async def update_async( documentation: Union[str, object] = values.unset, policies: Union[str, object] = values.unset, support: Union[str, object] = values.unset, + configuration: Union[str, object] = values.unset, ) -> "ModuleDataManagementInstance": """ Asynchronous coroutine to update the ModuleDataManagementInstance @@ -125,6 +131,7 @@ async def update_async( :param documentation: :param policies: :param support: + :param configuration: :returns: The updated ModuleDataManagementInstance """ @@ -134,6 +141,7 @@ async def update_async( documentation=documentation, policies=policies, support=support, + configuration=configuration, ) def __repr__(self) -> str: @@ -208,6 +216,7 @@ def update( documentation: Union[str, object] = values.unset, policies: Union[str, object] = values.unset, support: Union[str, object] = values.unset, + configuration: Union[str, object] = values.unset, ) -> ModuleDataManagementInstance: """ Update the ModuleDataManagementInstance @@ -217,6 +226,7 @@ def update( :param documentation: :param policies: :param support: + :param configuration: :returns: The updated ModuleDataManagementInstance """ @@ -227,6 +237,7 @@ def update( "Documentation": documentation, "Policies": policies, "Support": support, + "Configuration": configuration, } ) @@ -247,6 +258,7 @@ async def update_async( documentation: Union[str, object] = values.unset, policies: Union[str, object] = values.unset, support: Union[str, object] = values.unset, + configuration: Union[str, object] = values.unset, ) -> ModuleDataManagementInstance: """ Asynchronous coroutine to update the ModuleDataManagementInstance @@ -256,6 +268,7 @@ async def update_async( :param documentation: :param policies: :param support: + :param configuration: :returns: The updated ModuleDataManagementInstance """ @@ -266,6 +279,7 @@ async def update_async( "Documentation": documentation, "Policies": policies, "Support": support, + "Configuration": configuration, } ) diff --git a/twilio/rest/marketplace/v1/referral_conversion.py b/twilio/rest/marketplace/v1/referral_conversion.py new file mode 100644 index 0000000000..62d6ad84fd --- /dev/null +++ b/twilio/rest/marketplace/v1/referral_conversion.py @@ -0,0 +1,198 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Marketplace + 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 import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class ReferralConversionInstance(InstanceResource): + """ + :ivar converted_account_sid: + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) + + self.converted_account_sid: Optional[str] = payload.get("converted_account_sid") + + self._context: Optional[ReferralConversionContext] = None + + @property + def _proxy(self) -> "ReferralConversionContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: ReferralConversionContext for this ReferralConversionInstance + """ + if self._context is None: + self._context = ReferralConversionContext( + self._version, + ) + return self._context + + def create( + self, create_referral_conversion_request: CreateReferralConversionRequest + ) -> "ReferralConversionInstance": + """ + Create the ReferralConversionInstance + + :param create_referral_conversion_request: + + :returns: The created ReferralConversionInstance + """ + return self._proxy.create( + create_referral_conversion_request, + ) + + async def create_async( + self, create_referral_conversion_request: CreateReferralConversionRequest + ) -> "ReferralConversionInstance": + """ + Asynchronous coroutine to create the ReferralConversionInstance + + :param create_referral_conversion_request: + + :returns: The created ReferralConversionInstance + """ + return await self._proxy.create_async( + create_referral_conversion_request, + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "" + + +class ReferralConversionContext(InstanceContext): + + def __init__(self, version: Version): + """ + Initialize the ReferralConversionContext + + :param version: Version that contains the resource + """ + super().__init__(version) + + self._uri = "/ReferralConversion" + + def create( + self, create_referral_conversion_request: CreateReferralConversionRequest + ) -> ReferralConversionInstance: + """ + Create the ReferralConversionInstance + + :param create_referral_conversion_request: + + :returns: The created ReferralConversionInstance + """ + data = values.of( + { + "CreateReferralConversionRequest": create_referral_conversion_request, + } + ) + + payload = self._version.create(method="POST", uri=self._uri, data=data) + + return ReferralConversionInstance(self._version, payload) + + async def create_async( + self, create_referral_conversion_request: CreateReferralConversionRequest + ) -> ReferralConversionInstance: + """ + Asynchronous coroutine to create the ReferralConversionInstance + + :param create_referral_conversion_request: + + :returns: The created ReferralConversionInstance + """ + data = values.of( + { + "CreateReferralConversionRequest": create_referral_conversion_request, + } + ) + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data + ) + + return ReferralConversionInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "" + + +class ReferralConversionList(ListResource): + + class CreateReferralConversionRequest(object): + """ + :ivar referral_account_sid: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.referral_account_sid: Optional[str] = payload.get( + "referral_account_sid" + ) + + def to_dict(self): + return { + "referral_account_sid": self.referral_account_sid, + } + + def __init__(self, version: Version): + """ + Initialize the ReferralConversionList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + def get(self) -> ReferralConversionContext: + """ + Constructs a ReferralConversionContext + + """ + return ReferralConversionContext(self._version) + + def __call__(self) -> ReferralConversionContext: + """ + Constructs a ReferralConversionContext + + """ + return ReferralConversionContext(self._version) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/messaging/v1/external_campaign.py b/twilio/rest/messaging/v1/external_campaign.py index 88262f978d..ebc115ee74 100644 --- a/twilio/rest/messaging/v1/external_campaign.py +++ b/twilio/rest/messaging/v1/external_campaign.py @@ -13,8 +13,8 @@ """ from datetime import datetime -from typing import Any, Dict, Optional -from twilio.base import deserialize, values +from typing import Any, Dict, Optional, Union +from twilio.base import deserialize, serialize, values from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -65,13 +65,17 @@ def __init__(self, version: Version): self._uri = "/Services/PreregisteredUsa2p" def create( - self, campaign_id: str, messaging_service_sid: str + self, + campaign_id: str, + messaging_service_sid: str, + cnp_migration: Union[bool, object] = values.unset, ) -> ExternalCampaignInstance: """ Create the ExternalCampaignInstance :param campaign_id: ID of the preregistered campaign. :param messaging_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) that the resource is associated with. + :param cnp_migration: Customers should use this flag during the ERC registration process to indicate to Twilio that the campaign being registered is undergoing CNP migration. It is important for the user to first trigger the CNP migration process for said campaign in their CSP portal and have Twilio accept the sharing request, before making this api call. :returns: The created ExternalCampaignInstance """ @@ -80,6 +84,7 @@ def create( { "CampaignId": campaign_id, "MessagingServiceSid": messaging_service_sid, + "CnpMigration": serialize.boolean_to_string(cnp_migration), } ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -91,13 +96,17 @@ def create( return ExternalCampaignInstance(self._version, payload) async def create_async( - self, campaign_id: str, messaging_service_sid: str + self, + campaign_id: str, + messaging_service_sid: str, + cnp_migration: Union[bool, object] = values.unset, ) -> ExternalCampaignInstance: """ Asynchronously create the ExternalCampaignInstance :param campaign_id: ID of the preregistered campaign. :param messaging_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) that the resource is associated with. + :param cnp_migration: Customers should use this flag during the ERC registration process to indicate to Twilio that the campaign being registered is undergoing CNP migration. It is important for the user to first trigger the CNP migration process for said campaign in their CSP portal and have Twilio accept the sharing request, before making this api call. :returns: The created ExternalCampaignInstance """ @@ -106,6 +115,7 @@ async def create_async( { "CampaignId": campaign_id, "MessagingServiceSid": messaging_service_sid, + "CnpMigration": serialize.boolean_to_string(cnp_migration), } ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) diff --git a/twilio/rest/messaging/v1/service/channel_sender.py b/twilio/rest/messaging/v1/service/channel_sender.py index a8de3d0cf6..0a0d5c98de 100644 --- a/twilio/rest/messaging/v1/service/channel_sender.py +++ b/twilio/rest/messaging/v1/service/channel_sender.py @@ -80,6 +80,24 @@ def _proxy(self) -> "ChannelSenderContext": ) return self._context + def delete(self) -> bool: + """ + Deletes the ChannelSenderInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the ChannelSenderInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + def fetch(self) -> "ChannelSenderInstance": """ Fetch the ChannelSenderInstance @@ -129,6 +147,30 @@ def __init__(self, version: Version, messaging_service_sid: str, sid: str): **self._solution ) + def delete(self) -> bool: + """ + Deletes the ChannelSenderInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._version.delete( + method="DELETE", + uri=self._uri, + ) + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the ChannelSenderInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._version.delete_async( + method="DELETE", + uri=self._uri, + ) + def fetch(self) -> ChannelSenderInstance: """ Fetch the ChannelSenderInstance @@ -222,6 +264,58 @@ def __init__(self, version: Version, messaging_service_sid: str): **self._solution ) + def create(self, sid: str) -> ChannelSenderInstance: + """ + Create the ChannelSenderInstance + + :param sid: The SID of the Channel Sender being added to the Service. + + :returns: The created ChannelSenderInstance + """ + + data = values.of( + { + "Sid": sid, + } + ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return ChannelSenderInstance( + self._version, + payload, + messaging_service_sid=self._solution["messaging_service_sid"], + ) + + async def create_async(self, sid: str) -> ChannelSenderInstance: + """ + Asynchronously create the ChannelSenderInstance + + :param sid: The SID of the Channel Sender being added to the Service. + + :returns: The created ChannelSenderInstance + """ + + data = values.of( + { + "Sid": sid, + } + ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return ChannelSenderInstance( + self._version, + payload, + messaging_service_sid=self._solution["messaging_service_sid"], + ) + def stream( self, limit: Optional[int] = None, diff --git a/twilio/rest/numbers/v1/__init__.py b/twilio/rest/numbers/v1/__init__.py index 68f078a88d..043364c3d5 100644 --- a/twilio/rest/numbers/v1/__init__.py +++ b/twilio/rest/numbers/v1/__init__.py @@ -28,10 +28,12 @@ from twilio.rest.numbers.v1.porting_webhook_configuration_delete import ( PortingWebhookConfigurationDeleteList, ) +from twilio.rest.numbers.v1.porting_webhook_configuration_fetch import ( + PortingWebhookConfigurationFetchList, +) from twilio.rest.numbers.v1.signing_request_configuration import ( SigningRequestConfigurationList, ) -from twilio.rest.numbers.v1.webhook import WebhookList class V1(Version): @@ -56,10 +58,12 @@ def __init__(self, domain: Domain): self._porting_webhook_configurations_delete: Optional[ PortingWebhookConfigurationDeleteList ] = None + self._porting_webhook_configuration_fetch: Optional[ + PortingWebhookConfigurationFetchList + ] = None self._signing_request_configurations: Optional[ SigningRequestConfigurationList ] = None - self._webhook: Optional[WebhookList] = None @property def bulk_eligibilities(self) -> BulkEligibilityList: @@ -107,18 +111,22 @@ def porting_webhook_configurations_delete( ) return self._porting_webhook_configurations_delete + @property + def porting_webhook_configuration_fetch( + self, + ) -> PortingWebhookConfigurationFetchList: + if self._porting_webhook_configuration_fetch is None: + self._porting_webhook_configuration_fetch = ( + PortingWebhookConfigurationFetchList(self) + ) + return self._porting_webhook_configuration_fetch + @property def signing_request_configurations(self) -> SigningRequestConfigurationList: if self._signing_request_configurations is None: self._signing_request_configurations = SigningRequestConfigurationList(self) return self._signing_request_configurations - @property - def webhook(self) -> WebhookList: - if self._webhook is None: - self._webhook = WebhookList(self) - return self._webhook - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/numbers/v1/porting_port_in.py b/twilio/rest/numbers/v1/porting_port_in.py index 50b3e328ec..9ce6b7b4cd 100644 --- a/twilio/rest/numbers/v1/porting_port_in.py +++ b/twilio/rest/numbers/v1/porting_port_in.py @@ -25,15 +25,15 @@ 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: The URL of this Port In request - :ivar account_sid: The Account SID that the numbers will be added to after they are ported into Twilio. - :ivar notification_emails: List of emails for getting notifications about the LOA signing process. Allowed Max 10 emails. - :ivar target_port_in_date: Minimum number of days in the future (at least 2 days) needs to be established with the Ops team for validation. - :ivar target_port_in_time_range_start: Minimum hour in the future needs to be established with the Ops team for validation. - :ivar target_port_in_time_range_end: Maximum hour in the future needs to be established with the Ops team for validation. + :ivar account_sid: Account Sid or subaccount where the phone number(s) will be Ported + :ivar notification_emails: Additional emails to send a copy of the signed LOA to. + :ivar target_port_in_date: Target date to port the number. We cannot guarantee that this date will be honored by the other carriers, please work with Ops to get a confirmation of the firm order commitment (FOC) date. Expected format is ISO Local Date, example: ‘2011-12-03`. This date must be at least 7 days in the future for US ports and 10 days in the future for Japanese ports. (This value is only available for custom porting customers.) + :ivar target_port_in_time_range_start: The earliest time that the port should occur on the target port in date. Expected format is ISO Offset Time, example: ‘10:15:00-08:00'. (This value is only available for custom porting customers.) + :ivar target_port_in_time_range_end: The latest time that the port should occur on the target port in date. Expected format is ISO Offset Time, example: ‘10:15:00-08:00'. (This value is only available for custom porting customers.) :ivar port_in_request_status: The status of the port in request. The possible values are: In progress, Completed, Expired, In review, Waiting for Signature, Action Required, and Canceled. - :ivar losing_carrier_information: The information for the losing carrier. - :ivar phone_numbers: The list of phone numbers to Port in. Phone numbers are in E.164 format (e.g. +16175551212). - :ivar documents: The list of documents SID referencing a utility bills + :ivar losing_carrier_information: Details regarding the customer’s information with the losing carrier. These values will be used to generate the letter of authorization and should match the losing carrier’s data as closely as possible to ensure the port is accepted. + :ivar phone_numbers: + :ivar documents: List of document SIDs for all phone numbers included in the port in request. At least one document SID referring to a document of the type Utility Bill is required. :ivar date_created: """ diff --git a/twilio/rest/numbers/v1/porting_port_in_phone_number.py b/twilio/rest/numbers/v1/porting_port_in_phone_number.py index f5d881a657..c494961ef6 100644 --- a/twilio/rest/numbers/v1/porting_port_in_phone_number.py +++ b/twilio/rest/numbers/v1/porting_port_in_phone_number.py @@ -23,23 +23,24 @@ class PortingPortInPhoneNumberInstance(InstanceResource): """ - :ivar port_in_request_sid: The SID of the Port In request. This is a unique identifier of the port in request. - :ivar phone_number_sid: The SID of the Port In request phone number. This is a unique identifier of the phone number. - :ivar url: - :ivar account_sid: The SID of the account that the phone number belongs to. - :ivar phone_number_type: The type of the phone number. - :ivar date_created: The date when the phone number was created. - :ivar country: The country of the phone number. - :ivar missing_required_fields: The phone number is missing required fields. - :ivar last_updated: The timestamp when the status was last updated. - :ivar phone_number: The phone number. - :ivar portable: The phone number is portable. - :ivar not_portability_reason: The reason why the phone number is not portable. - :ivar not_portability_reason_code: The code of the reason why the phone number is not portable. - :ivar port_in_phone_number_status: The status of the phone number in the port in request. - :ivar port_out_pin: The pin required for the losing carrier to port out the phone number. - :ivar rejection_reason: The rejection reason returned by the vendor. - :ivar rejection_reason_code: The rejection reason code returned by the vendor. + :ivar port_in_request_sid: The unique identifier for the port in request that this phone number is associated with. + :ivar phone_number_sid: The unique identifier for this phone number associated with this port in request. + :ivar url: URL reference for this resource. + :ivar account_sid: Account Sid or subaccount where the phone number(s) will be Ported. + :ivar phone_number_type: The number type of the phone number. This can be: toll-free, local, mobile or unknown. This field may be null if the number is not portable or if the portability for a number has not yet been evaluated. + :ivar date_created: The timestamp for when this port in phone number was created. + :ivar country: The ISO country code that this number is associated with. This field may be null if the number is not portable or if the portability for a number has not yet been evaluated. + :ivar missing_required_fields: Indicates if the phone number is missing required fields such as a PIN or account number. This field may be null if the number is not portable or if the portability for a number has not yet been evaluated. + :ivar last_updated: Timestamp indicating when the Port In Phone Number resource was last modified. + :ivar phone_number: Phone number to be ported. This will be in the E164 Format. + :ivar portable: If the number is portable by Twilio or not. This field may be null if the number portability has not yet been evaluated. If a number is not portable reference the `not_portability_reason_code` and `not_portability_reason` fields for more details + :ivar not_portability_reason: The not portability reason code description. This field may be null if the number is portable or if the portability for a number has not yet been evaluated. + :ivar not_portability_reason_code: The not portability reason code. This field may be null if the number is portable or if the portability for a number has not yet been evaluated. + :ivar port_in_phone_number_status: The status of the port in phone number. + :ivar port_out_pin: The pin required by the losing carrier to do the port out. + :ivar rejection_reason: The description of the rejection reason provided by the losing carrier. This field may be null if the number has not been rejected by the losing carrier. + :ivar rejection_reason_code: The code for the rejection reason provided by the losing carrier. This field may be null if the number has not been rejected by the losing carrier. + :ivar port_date: The timestamp the phone number will be ported. This will only be set once a port date has been confirmed. Not all carriers can guarantee a specific time on the port date. Twilio will try its best to get the port completed by this time on the port date. Please subscribe to webhooks for confirmation on when a port has actually been completed. """ def __init__( @@ -84,6 +85,9 @@ def __init__( self.rejection_reason_code: Optional[int] = deserialize.integer( payload.get("rejection_reason_code") ) + self.port_date: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("port_date") + ) self._solution = { "port_in_request_sid": port_in_request_sid or self.port_in_request_sid, diff --git a/twilio/rest/numbers/v1/porting_portability.py b/twilio/rest/numbers/v1/porting_portability.py index d4f92ba7d5..1f0fc210a4 100644 --- a/twilio/rest/numbers/v1/porting_portability.py +++ b/twilio/rest/numbers/v1/porting_portability.py @@ -30,11 +30,11 @@ class NumberType(object): """ :ivar phone_number: The phone number which portability is to be checked. Phone numbers are in E.164 format (e.g. +16175551212). - :ivar account_sid: The target account sid to which the number will be ported - :ivar portable: Boolean flag specifying if phone number is portable or not. - :ivar pin_and_account_number_required: Boolean flag specifying if PIN and account number is required for the phone number. + :ivar account_sid: Account Sid that the phone number belongs to in Twilio. This is only returned for phone numbers that already exist in Twilio’s inventory and belong to your account or sub account. + :ivar portable: Boolean flag indicates if the phone number can be ported into Twilio through the Porting API or not. + :ivar pin_and_account_number_required: Indicates if the port in process will require a personal identification number (PIN) and an account number for this phone number. If this is true you will be required to submit both a PIN and account number from the losing carrier for this number when opening a port in request. These fields will be required in order to complete the port in process to Twilio. :ivar not_portable_reason: Reason why the phone number cannot be ported into Twilio, `null` otherwise. - :ivar not_portable_reason_code: The Portability Reason Code for the phone number if it cannot be ported into Twilio, `null` otherwise. One of `22131`, `22132`, `22130`, `22133`, `22102` or `22135`. + :ivar not_portable_reason_code: The Portability Reason Code for the phone number if it cannot be ported into Twilio, `null` otherwise. :ivar number_type: :ivar country: Country the phone number belongs to. :ivar url: This is the url of the request that you're trying to reach out to locate the resource. @@ -90,7 +90,7 @@ def fetch( """ Fetch the PortingPortabilityInstance - :param target_account_sid: The SID of the account where the phone number(s) will be ported. + :param target_account_sid: Account Sid to which the number will be ported. This can be used to determine if a sub account already has the number in its inventory or a different sub account. If this is not provided, the authenticated account will be assumed to be the target account. :returns: The fetched PortingPortabilityInstance """ @@ -104,7 +104,7 @@ async def fetch_async( """ Asynchronous coroutine to fetch the PortingPortabilityInstance - :param target_account_sid: The SID of the account where the phone number(s) will be ported. + :param target_account_sid: Account Sid to which the number will be ported. This can be used to determine if a sub account already has the number in its inventory or a different sub account. If this is not provided, the authenticated account will be assumed to be the target account. :returns: The fetched PortingPortabilityInstance """ @@ -129,7 +129,7 @@ def __init__(self, version: Version, phone_number: str): Initialize the PortingPortabilityContext :param version: Version that contains the resource - :param phone_number: The phone number which portability is to be checked. Phone numbers are in E.164 format (e.g. +16175551212). + :param phone_number: Phone number to check portability in e164 format. """ super().__init__(version) @@ -147,7 +147,7 @@ def fetch( """ Fetch the PortingPortabilityInstance - :param target_account_sid: The SID of the account where the phone number(s) will be ported. + :param target_account_sid: Account Sid to which the number will be ported. This can be used to determine if a sub account already has the number in its inventory or a different sub account. If this is not provided, the authenticated account will be assumed to be the target account. :returns: The fetched PortingPortabilityInstance """ @@ -172,7 +172,7 @@ async def fetch_async( """ Asynchronous coroutine to fetch the PortingPortabilityInstance - :param target_account_sid: The SID of the account where the phone number(s) will be ported. + :param target_account_sid: Account Sid to which the number will be ported. This can be used to determine if a sub account already has the number in its inventory or a different sub account. If this is not provided, the authenticated account will be assumed to be the target account. :returns: The fetched PortingPortabilityInstance """ @@ -218,7 +218,7 @@ def get(self, phone_number: str) -> PortingPortabilityContext: """ Constructs a PortingPortabilityContext - :param phone_number: The phone number which portability is to be checked. Phone numbers are in E.164 format (e.g. +16175551212). + :param phone_number: Phone number to check portability in e164 format. """ return PortingPortabilityContext(self._version, phone_number=phone_number) @@ -226,7 +226,7 @@ def __call__(self, phone_number: str) -> PortingPortabilityContext: """ Constructs a PortingPortabilityContext - :param phone_number: The phone number which portability is to be checked. Phone numbers are in E.164 format (e.g. +16175551212). + :param phone_number: Phone number to check portability in e164 format. """ return PortingPortabilityContext(self._version, phone_number=phone_number) diff --git a/twilio/rest/numbers/v1/porting_webhook_configuration.py b/twilio/rest/numbers/v1/porting_webhook_configuration.py index ea6d9bd2eb..ec36777a61 100644 --- a/twilio/rest/numbers/v1/porting_webhook_configuration.py +++ b/twilio/rest/numbers/v1/porting_webhook_configuration.py @@ -23,9 +23,9 @@ class PortingWebhookConfigurationInstance(InstanceResource): """ :ivar url: The URL of the webhook configuration request - :ivar port_in_target_url: Webhook URL to send a request when a port in request or port in phone number event happens - :ivar port_out_target_url: Webhook URL to send a request when a port out phone number event happens - :ivar notifications_of: List of notification events to send a request to the webhook URL + :ivar port_in_target_url: The complete webhook url that will be called when a notification event for port in request or port in phone number happens + :ivar port_out_target_url: The complete webhook url that will be called when a notification event for a port out phone number happens. + :ivar notifications_of: A list to filter what notification events to receive for this account and its sub accounts. If it is an empty list, then it means that there are no filters for the notifications events to send in each webhook and all events will get sent. """ def __init__(self, version: Version, payload: Dict[str, Any]): diff --git a/twilio/rest/numbers/v1/porting_webhook_configuration_delete.py b/twilio/rest/numbers/v1/porting_webhook_configuration_delete.py index beb011128f..73d3477972 100644 --- a/twilio/rest/numbers/v1/porting_webhook_configuration_delete.py +++ b/twilio/rest/numbers/v1/porting_webhook_configuration_delete.py @@ -29,7 +29,7 @@ def __init__( Initialize the PortingWebhookConfigurationDeleteContext :param version: Version that contains the resource - :param webhook_type: The of the webhook type of the configuration to be deleted + :param webhook_type: The webhook type for the configuration to be delete. `PORT_IN`, `PORT_OUT` """ super().__init__(version) @@ -94,7 +94,7 @@ def get( """ Constructs a PortingWebhookConfigurationDeleteContext - :param webhook_type: The of the webhook type of the configuration to be deleted + :param webhook_type: The webhook type for the configuration to be delete. `PORT_IN`, `PORT_OUT` """ return PortingWebhookConfigurationDeleteContext( self._version, webhook_type=webhook_type @@ -106,7 +106,7 @@ def __call__( """ Constructs a PortingWebhookConfigurationDeleteContext - :param webhook_type: The of the webhook type of the configuration to be deleted + :param webhook_type: The webhook type for the configuration to be delete. `PORT_IN`, `PORT_OUT` """ return PortingWebhookConfigurationDeleteContext( self._version, webhook_type=webhook_type diff --git a/twilio/rest/numbers/v1/webhook.py b/twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py similarity index 64% rename from twilio/rest/numbers/v1/webhook.py rename to twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py index 0986db12f3..89b8064bdb 100644 --- a/twilio/rest/numbers/v1/webhook.py +++ b/twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py @@ -21,12 +21,12 @@ from twilio.base.version import Version -class WebhookInstance(InstanceResource): +class PortingWebhookConfigurationFetchInstance(InstanceResource): """ :ivar url: The URL of the webhook configuration request - :ivar port_in_target_url: Webhook URL to send a request when a port in request or port in phone number event happens - :ivar port_out_target_url: Webhook URL to send a request when a port out phone number event happens - :ivar notifications_of: List of notification events to send a request to the webhook URL + :ivar port_in_target_url: The complete webhook url that will be called when a notification event for port in request or port in phone number happens + :ivar port_out_target_url: The complete webhook url that will be called when a notification event for a port out phone number happens. + :ivar notifications_of: A list to filter what notification events to receive for this account and its sub accounts. If it is an empty list, then it means that there are no filters for the notifications events to send in each webhook and all events will get sent. :ivar port_in_target_date_created: Creation date for the port in webhook configuration :ivar port_out_target_date_created: Creation date for the port out webhook configuration """ @@ -52,14 +52,14 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" -class WebhookList(ListResource): +class PortingWebhookConfigurationFetchList(ListResource): def __init__(self, version: Version): """ - Initialize the WebhookList + Initialize the PortingWebhookConfigurationFetchList :param version: Version that contains the resource @@ -68,25 +68,25 @@ def __init__(self, version: Version): self._uri = "/Porting/Configuration/Webhook" - def fetch(self) -> WebhookInstance: + def fetch(self) -> PortingWebhookConfigurationFetchInstance: """ - Asynchronously fetch the WebhookInstance + Asynchronously fetch the PortingWebhookConfigurationFetchInstance - :returns: The fetched WebhookInstance + :returns: The fetched PortingWebhookConfigurationFetchInstance """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) - return WebhookInstance(self._version, payload) + return PortingWebhookConfigurationFetchInstance(self._version, payload) - async def fetch_async(self) -> WebhookInstance: + async def fetch_async(self) -> PortingWebhookConfigurationFetchInstance: """ - Asynchronously fetch the WebhookInstance + Asynchronously fetch the PortingWebhookConfigurationFetchInstance - :returns: The fetched WebhookInstance + :returns: The fetched PortingWebhookConfigurationFetchInstance """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -94,7 +94,7 @@ async def fetch_async(self) -> WebhookInstance: method="GET", uri=self._uri, headers=headers ) - return WebhookInstance(self._version, payload) + return PortingWebhookConfigurationFetchInstance(self._version, payload) def __repr__(self) -> str: """ @@ -102,4 +102,4 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" diff --git a/twilio/rest/numbers/v1/signing_request_configuration.py b/twilio/rest/numbers/v1/signing_request_configuration.py index 541062ec6d..a144a09fe6 100644 --- a/twilio/rest/numbers/v1/signing_request_configuration.py +++ b/twilio/rest/numbers/v1/signing_request_configuration.py @@ -12,12 +12,13 @@ Do not edit the class manually. """ -from typing import Any, Dict, Optional, Union +from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator from twilio.base import values from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource from twilio.base.version import Version +from twilio.base.page import Page class SigningRequestConfigurationInstance(InstanceResource): @@ -54,6 +55,27 @@ def __repr__(self) -> str: return "" +class SigningRequestConfigurationPage(Page): + + def get_instance( + self, payload: Dict[str, Any] + ) -> SigningRequestConfigurationInstance: + """ + Build an instance of SigningRequestConfigurationInstance + + :param payload: Payload response from the API + """ + return SigningRequestConfigurationInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + class SigningRequestConfigurationList(ListResource): def __init__(self, version: Version): @@ -109,6 +131,225 @@ async def create_async( return SigningRequestConfigurationInstance(self._version, payload) + def stream( + self, + country: Union[str, object] = values.unset, + product: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[SigningRequestConfigurationInstance]: + """ + Streams SigningRequestConfigurationInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param str country: The country ISO code to apply this configuration, this is an optional field, Example: US, MX + :param str product: The product or service for which is requesting the signature, this is an optional field, Example: Porting, Hosting + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = self.page( + country=country, product=product, page_size=limits["page_size"] + ) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + country: Union[str, object] = values.unset, + product: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[SigningRequestConfigurationInstance]: + """ + Asynchronously streams SigningRequestConfigurationInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param str country: The country ISO code to apply this configuration, this is an optional field, Example: US, MX + :param str product: The product or service for which is requesting the signature, this is an optional field, Example: Porting, Hosting + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = await self.page_async( + country=country, product=product, page_size=limits["page_size"] + ) + + return self._version.stream_async(page, limits["limit"]) + + def list( + self, + country: Union[str, object] = values.unset, + product: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[SigningRequestConfigurationInstance]: + """ + Lists SigningRequestConfigurationInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str country: The country ISO code to apply this configuration, this is an optional field, Example: US, MX + :param str product: The product or service for which is requesting the signature, this is an optional field, Example: Porting, Hosting + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return list( + self.stream( + country=country, + product=product, + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + country: Union[str, object] = values.unset, + product: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[SigningRequestConfigurationInstance]: + """ + Asynchronously lists SigningRequestConfigurationInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str country: The country ISO code to apply this configuration, this is an optional field, Example: US, MX + :param str product: The product or service for which is requesting the signature, this is an optional field, Example: Porting, Hosting + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return [ + record + async for record in await self.stream_async( + country=country, + product=product, + limit=limit, + page_size=page_size, + ) + ] + + def page( + self, + country: Union[str, object] = values.unset, + product: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> SigningRequestConfigurationPage: + """ + Retrieve a single page of SigningRequestConfigurationInstance records from the API. + Request is executed immediately + + :param country: The country ISO code to apply this configuration, this is an optional field, Example: US, MX + :param product: The product or service for which is requesting the signature, this is an optional field, Example: Porting, Hosting + :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 + + :returns: Page of SigningRequestConfigurationInstance + """ + data = values.of( + { + "Country": country, + "Product": product, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = self._version.page(method="GET", uri=self._uri, params=data) + return SigningRequestConfigurationPage(self._version, response) + + async def page_async( + self, + country: Union[str, object] = values.unset, + product: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> SigningRequestConfigurationPage: + """ + Asynchronously retrieve a single page of SigningRequestConfigurationInstance records from the API. + Request is executed immediately + + :param country: The country ISO code to apply this configuration, this is an optional field, Example: US, MX + :param product: The product or service for which is requesting the signature, this is an optional field, Example: Porting, Hosting + :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 + + :returns: Page of SigningRequestConfigurationInstance + """ + data = values.of( + { + "Country": country, + "Product": product, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = await self._version.page_async( + method="GET", uri=self._uri, params=data + ) + return SigningRequestConfigurationPage(self._version, response) + + def get_page(self, target_url: str) -> SigningRequestConfigurationPage: + """ + Retrieve a specific page of SigningRequestConfigurationInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of SigningRequestConfigurationInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return SigningRequestConfigurationPage(self._version, response) + + async def get_page_async(self, target_url: str) -> SigningRequestConfigurationPage: + """ + Asynchronously retrieve a specific page of SigningRequestConfigurationInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of SigningRequestConfigurationInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return SigningRequestConfigurationPage(self._version, response) + def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/numbers/v2/__init__.py b/twilio/rest/numbers/v2/__init__.py index 9b5b50154e..04b303486e 100644 --- a/twilio/rest/numbers/v2/__init__.py +++ b/twilio/rest/numbers/v2/__init__.py @@ -17,6 +17,7 @@ from twilio.base.domain import Domain from twilio.rest.numbers.v2.authorization_document import AuthorizationDocumentList from twilio.rest.numbers.v2.bulk_hosted_number_order import BulkHostedNumberOrderList +from twilio.rest.numbers.v2.bundle_clone import BundleCloneList from twilio.rest.numbers.v2.hosted_number_order import HostedNumberOrderList from twilio.rest.numbers.v2.regulatory_compliance import RegulatoryComplianceList @@ -32,6 +33,7 @@ def __init__(self, domain: Domain): super().__init__(domain, "v2") self._authorization_documents: Optional[AuthorizationDocumentList] = None self._bulk_hosted_number_orders: Optional[BulkHostedNumberOrderList] = None + self._bundle_clone: Optional[BundleCloneList] = None self._hosted_number_orders: Optional[HostedNumberOrderList] = None self._regulatory_compliance: Optional[RegulatoryComplianceList] = None @@ -47,6 +49,12 @@ def bulk_hosted_number_orders(self) -> BulkHostedNumberOrderList: self._bulk_hosted_number_orders = BulkHostedNumberOrderList(self) return self._bulk_hosted_number_orders + @property + def bundle_clone(self) -> BundleCloneList: + if self._bundle_clone is None: + self._bundle_clone = BundleCloneList(self) + return self._bundle_clone + @property def hosted_number_orders(self) -> HostedNumberOrderList: if self._hosted_number_orders is None: diff --git a/twilio/rest/numbers/v2/bundle_clone.py b/twilio/rest/numbers/v2/bundle_clone.py new file mode 100644 index 0000000000..ff24e29063 --- /dev/null +++ b/twilio/rest/numbers/v2/bundle_clone.py @@ -0,0 +1,268 @@ +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 datetime import datetime +from typing import Any, Dict, Optional, Union +from twilio.base import deserialize, serialize, values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class BundleCloneInstance(InstanceResource): + + class Status(object): + DRAFT = "draft" + PENDING_REVIEW = "pending-review" + IN_REVIEW = "in-review" + TWILIO_REJECTED = "twilio-rejected" + TWILIO_APPROVED = "twilio-approved" + PROVISIONALLY_APPROVED = "provisionally-approved" + + """ + :ivar bundle_sid: The unique string that we created to identify the Bundle resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Bundle resource. + :ivar regulation_sid: The unique string of a regulation that is associated to the Bundle resource. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar status: + :ivar valid_until: The date and time in GMT in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format when the resource will be valid until. + :ivar email: The email address that will receive updates when the Bundle resource changes status. + :ivar status_callback: The URL we call to inform your application of status changes. + :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar url: The URL of this resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + bundle_sid: Optional[str] = None, + ): + super().__init__(version) + + self.bundle_sid: Optional[str] = payload.get("bundle_sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.regulation_sid: Optional[str] = payload.get("regulation_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.status: Optional["BundleCloneInstance.Status"] = payload.get("status") + self.valid_until: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("valid_until") + ) + self.email: Optional[str] = payload.get("email") + self.status_callback: Optional[str] = payload.get("status_callback") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.url: Optional[str] = payload.get("url") + + self._solution = { + "bundle_sid": bundle_sid or self.bundle_sid, + } + self._context: Optional[BundleCloneContext] = None + + @property + def _proxy(self) -> "BundleCloneContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: BundleCloneContext for this BundleCloneInstance + """ + if self._context is None: + self._context = BundleCloneContext( + self._version, + bundle_sid=self._solution["bundle_sid"], + ) + return self._context + + def create( + self, + target_account_sid: str, + move_to_draft: Union[bool, object] = values.unset, + friendly_name: Union[str, object] = values.unset, + ) -> "BundleCloneInstance": + """ + Create the BundleCloneInstance + + :param target_account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) where the bundle needs to be cloned. + :param move_to_draft: This is to determine whether the cloned bundle needs to be in draft state or not. + :param friendly_name: The string that you assigned to describe the cloned bundle. + + :returns: The created BundleCloneInstance + """ + return self._proxy.create( + target_account_sid, + move_to_draft=move_to_draft, + friendly_name=friendly_name, + ) + + async def create_async( + self, + target_account_sid: str, + move_to_draft: Union[bool, object] = values.unset, + friendly_name: Union[str, object] = values.unset, + ) -> "BundleCloneInstance": + """ + Asynchronous coroutine to create the BundleCloneInstance + + :param target_account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) where the bundle needs to be cloned. + :param move_to_draft: This is to determine whether the cloned bundle needs to be in draft state or not. + :param friendly_name: The string that you assigned to describe the cloned bundle. + + :returns: The created BundleCloneInstance + """ + return await self._proxy.create_async( + target_account_sid, + move_to_draft=move_to_draft, + friendly_name=friendly_name, + ) + + 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 BundleCloneContext(InstanceContext): + + def __init__(self, version: Version, bundle_sid: str): + """ + Initialize the BundleCloneContext + + :param version: Version that contains the resource + :param bundle_sid: The unique string that identifies the Bundle to be cloned. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "bundle_sid": bundle_sid, + } + self._uri = "/RegulatoryCompliance/Bundles/{bundle_sid}/Clones".format( + **self._solution + ) + + def create( + self, + target_account_sid: str, + move_to_draft: Union[bool, object] = values.unset, + friendly_name: Union[str, object] = values.unset, + ) -> BundleCloneInstance: + """ + Create the BundleCloneInstance + + :param target_account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) where the bundle needs to be cloned. + :param move_to_draft: This is to determine whether the cloned bundle needs to be in draft state or not. + :param friendly_name: The string that you assigned to describe the cloned bundle. + + :returns: The created BundleCloneInstance + """ + data = values.of( + { + "TargetAccountSid": target_account_sid, + "MoveToDraft": serialize.boolean_to_string(move_to_draft), + "FriendlyName": friendly_name, + } + ) + + payload = self._version.create(method="POST", uri=self._uri, data=data) + + return BundleCloneInstance( + self._version, payload, bundle_sid=self._solution["bundle_sid"] + ) + + async def create_async( + self, + target_account_sid: str, + move_to_draft: Union[bool, object] = values.unset, + friendly_name: Union[str, object] = values.unset, + ) -> BundleCloneInstance: + """ + Asynchronous coroutine to create the BundleCloneInstance + + :param target_account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) where the bundle needs to be cloned. + :param move_to_draft: This is to determine whether the cloned bundle needs to be in draft state or not. + :param friendly_name: The string that you assigned to describe the cloned bundle. + + :returns: The created BundleCloneInstance + """ + data = values.of( + { + "TargetAccountSid": target_account_sid, + "MoveToDraft": serialize.boolean_to_string(move_to_draft), + "FriendlyName": friendly_name, + } + ) + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data + ) + + return BundleCloneInstance( + self._version, payload, bundle_sid=self._solution["bundle_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 BundleCloneList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the BundleCloneList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + def get(self, bundle_sid: str) -> BundleCloneContext: + """ + Constructs a BundleCloneContext + + :param bundle_sid: The unique string that identifies the Bundle to be cloned. + """ + return BundleCloneContext(self._version, bundle_sid=bundle_sid) + + def __call__(self, bundle_sid: str) -> BundleCloneContext: + """ + Constructs a BundleCloneContext + + :param bundle_sid: The unique string that identifies the Bundle to be cloned. + """ + return BundleCloneContext(self._version, bundle_sid=bundle_sid) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/numbers/v2/regulatory_compliance/bundle/__init__.py b/twilio/rest/numbers/v2/regulatory_compliance/bundle/__init__.py index ccdcbb3f38..5c8b48f11d 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/bundle/__init__.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/bundle/__init__.py @@ -488,6 +488,7 @@ def create( iso_country: Union[str, object] = values.unset, end_user_type: Union["BundleInstance.EndUserType", object] = values.unset, number_type: Union[str, object] = values.unset, + is_test: Union[bool, object] = values.unset, ) -> BundleInstance: """ Create the BundleInstance @@ -499,6 +500,7 @@ def create( :param iso_country: The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Bundle's phone number country ownership request. :param end_user_type: :param number_type: The type of phone number of the Bundle's ownership request. Can be `local`, `mobile`, `national`, or `toll free`. + :param is_test: Indicates that Bundle is a Test Bundle and will be Auto-Rejected :returns: The created BundleInstance """ @@ -512,6 +514,7 @@ def create( "IsoCountry": iso_country, "EndUserType": end_user_type, "NumberType": number_type, + "IsTest": serialize.boolean_to_string(is_test), } ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -531,6 +534,7 @@ async def create_async( iso_country: Union[str, object] = values.unset, end_user_type: Union["BundleInstance.EndUserType", object] = values.unset, number_type: Union[str, object] = values.unset, + is_test: Union[bool, object] = values.unset, ) -> BundleInstance: """ Asynchronously create the BundleInstance @@ -542,6 +546,7 @@ async def create_async( :param iso_country: The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Bundle's phone number country ownership request. :param end_user_type: :param number_type: The type of phone number of the Bundle's ownership request. Can be `local`, `mobile`, `national`, or `toll free`. + :param is_test: Indicates that Bundle is a Test Bundle and will be Auto-Rejected :returns: The created BundleInstance """ @@ -555,6 +560,7 @@ async def create_async( "IsoCountry": iso_country, "EndUserType": end_user_type, "NumberType": number_type, + "IsTest": serialize.boolean_to_string(is_test), } ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) diff --git a/twilio/rest/taskrouter/v1/workspace/task/__init__.py b/twilio/rest/taskrouter/v1/workspace/task/__init__.py index f71c4bd68f..631b8f8bdb 100644 --- a/twilio/rest/taskrouter/v1/workspace/task/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/task/__init__.py @@ -56,7 +56,7 @@ class Status(object): :ivar url: The absolute URL of the Task resource. :ivar links: The URLs of related resources. :ivar virtual_start_time: The date and time in GMT indicating the ordering for routing of the Task specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - :ivar ignore_capacity: A boolean indicating if a new task should respect a worker's capacity during assignment + :ivar ignore_capacity: A boolean that indicates if the Task should respect a Worker's capacity and availability during assignment. This field can only be used when the `RoutingTarget` field is set to a Worker SID. By setting `IgnoreCapacity` to a value of `true`, `1`, or `yes`, the Task will be routed to the Worker without respecting their capacity and availability. Any other value will enforce the Worker's capacity and availability. The default value of `IgnoreCapacity` is `true` when the `RoutingTarget` is set to a Worker SID. :ivar routing_target: A SID of a Worker, Queue, or Workflow to route a Task to """ @@ -536,7 +536,7 @@ def create( :param attributes: A URL-encoded JSON string with the attributes of the new task. This value is passed to the Workflow's `assignment_callback_url` when the Task is assigned to a Worker. For example: `{ \\\"task_type\\\": \\\"call\\\", \\\"twilio_call_sid\\\": \\\"CAxxx\\\", \\\"customer_ticket_number\\\": \\\"12345\\\" }`. :param virtual_start_time: The virtual start time to assign the new task and override the default. When supplied, the new task will have this virtual start time. When not supplied, the new task will have the virtual start time equal to `date_created`. Value can't be in the future. :param routing_target: A SID of a Worker, Queue, or Workflow to route a Task to - :param ignore_capacity: A boolean indicating if a new task should respect a worker's capacity during assignment + :param ignore_capacity: A boolean that indicates if the Task should respect a Worker's capacity and availability during assignment. This field can only be used when the `RoutingTarget` field is set to a Worker SID. By setting `IgnoreCapacity` to a value of `true`, `1`, or `yes`, the Task will be routed to the Worker without respecting their capacity and availability. Any other value will enforce the Worker's capacity and availability. The default value of `IgnoreCapacity` is `true` when the `RoutingTarget` is set to a Worker SID. :param task_queue_sid: The SID of the TaskQueue in which the Task belongs :returns: The created TaskInstance @@ -587,7 +587,7 @@ async def create_async( :param attributes: A URL-encoded JSON string with the attributes of the new task. This value is passed to the Workflow's `assignment_callback_url` when the Task is assigned to a Worker. For example: `{ \\\"task_type\\\": \\\"call\\\", \\\"twilio_call_sid\\\": \\\"CAxxx\\\", \\\"customer_ticket_number\\\": \\\"12345\\\" }`. :param virtual_start_time: The virtual start time to assign the new task and override the default. When supplied, the new task will have this virtual start time. When not supplied, the new task will have the virtual start time equal to `date_created`. Value can't be in the future. :param routing_target: A SID of a Worker, Queue, or Workflow to route a Task to - :param ignore_capacity: A boolean indicating if a new task should respect a worker's capacity during assignment + :param ignore_capacity: A boolean that indicates if the Task should respect a Worker's capacity and availability during assignment. This field can only be used when the `RoutingTarget` field is set to a Worker SID. By setting `IgnoreCapacity` to a value of `true`, `1`, or `yes`, the Task will be routed to the Worker without respecting their capacity and availability. Any other value will enforce the Worker's capacity and availability. The default value of `IgnoreCapacity` is `true` when the `RoutingTarget` is set to a Worker SID. :param task_queue_sid: The SID of the TaskQueue in which the Task belongs :returns: The created TaskInstance diff --git a/twilio/rest/trusthub/v1/compliance_inquiries.py b/twilio/rest/trusthub/v1/compliance_inquiries.py index 6fe6c297bd..fe83b8630a 100644 --- a/twilio/rest/trusthub/v1/compliance_inquiries.py +++ b/twilio/rest/trusthub/v1/compliance_inquiries.py @@ -61,30 +61,36 @@ def _proxy(self) -> "ComplianceInquiriesContext": ) return self._context - def update(self, primary_profile_sid: str) -> "ComplianceInquiriesInstance": + def update( + self, primary_profile_sid: str, theme_set_id: Union[str, object] = values.unset + ) -> "ComplianceInquiriesInstance": """ Update the ComplianceInquiriesInstance :param primary_profile_sid: The unique SID identifier of the Primary Customer Profile that should be used as a parent. Only necessary when creating a secondary Customer Profile. + :param theme_set_id: Theme id for styling the inquiry form. :returns: The updated ComplianceInquiriesInstance """ return self._proxy.update( primary_profile_sid=primary_profile_sid, + theme_set_id=theme_set_id, ) async def update_async( - self, primary_profile_sid: str + self, primary_profile_sid: str, theme_set_id: Union[str, object] = values.unset ) -> "ComplianceInquiriesInstance": """ Asynchronous coroutine to update the ComplianceInquiriesInstance :param primary_profile_sid: The unique SID identifier of the Primary Customer Profile that should be used as a parent. Only necessary when creating a secondary Customer Profile. + :param theme_set_id: Theme id for styling the inquiry form. :returns: The updated ComplianceInquiriesInstance """ return await self._proxy.update_async( primary_profile_sid=primary_profile_sid, + theme_set_id=theme_set_id, ) def __repr__(self) -> str: @@ -116,17 +122,21 @@ def __init__(self, version: Version, customer_id: str): **self._solution ) - def update(self, primary_profile_sid: str) -> ComplianceInquiriesInstance: + def update( + self, primary_profile_sid: str, theme_set_id: Union[str, object] = values.unset + ) -> ComplianceInquiriesInstance: """ Update the ComplianceInquiriesInstance :param primary_profile_sid: The unique SID identifier of the Primary Customer Profile that should be used as a parent. Only necessary when creating a secondary Customer Profile. + :param theme_set_id: Theme id for styling the inquiry form. :returns: The updated ComplianceInquiriesInstance """ data = values.of( { "PrimaryProfileSid": primary_profile_sid, + "ThemeSetId": theme_set_id, } ) @@ -141,18 +151,20 @@ def update(self, primary_profile_sid: str) -> ComplianceInquiriesInstance: ) async def update_async( - self, primary_profile_sid: str + self, primary_profile_sid: str, theme_set_id: Union[str, object] = values.unset ) -> ComplianceInquiriesInstance: """ Asynchronous coroutine to update the ComplianceInquiriesInstance :param primary_profile_sid: The unique SID identifier of the Primary Customer Profile that should be used as a parent. Only necessary when creating a secondary Customer Profile. + :param theme_set_id: Theme id for styling the inquiry form. :returns: The updated ComplianceInquiriesInstance """ data = values.of( { "PrimaryProfileSid": primary_profile_sid, + "ThemeSetId": theme_set_id, } ) @@ -193,12 +205,14 @@ def create( self, primary_profile_sid: str, notification_email: Union[str, object] = values.unset, + theme_set_id: Union[str, object] = values.unset, ) -> ComplianceInquiriesInstance: """ Create the ComplianceInquiriesInstance :param primary_profile_sid: The unique SID identifier of the Primary Customer Profile that should be used as a parent. Only necessary when creating a secondary Customer Profile. :param notification_email: The email address that approval status updates will be sent to. If not specified, the email address associated with your primary customer profile will be used. + :param theme_set_id: Theme id for styling the inquiry form. :returns: The created ComplianceInquiriesInstance """ @@ -207,6 +221,7 @@ def create( { "PrimaryProfileSid": primary_profile_sid, "NotificationEmail": notification_email, + "ThemeSetId": theme_set_id, } ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -221,12 +236,14 @@ async def create_async( self, primary_profile_sid: str, notification_email: Union[str, object] = values.unset, + theme_set_id: Union[str, object] = values.unset, ) -> ComplianceInquiriesInstance: """ Asynchronously create the ComplianceInquiriesInstance :param primary_profile_sid: The unique SID identifier of the Primary Customer Profile that should be used as a parent. Only necessary when creating a secondary Customer Profile. :param notification_email: The email address that approval status updates will be sent to. If not specified, the email address associated with your primary customer profile will be used. + :param theme_set_id: Theme id for styling the inquiry form. :returns: The created ComplianceInquiriesInstance """ @@ -235,6 +252,7 @@ async def create_async( { "PrimaryProfileSid": primary_profile_sid, "NotificationEmail": notification_email, + "ThemeSetId": theme_set_id, } ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) diff --git a/twilio/rest/verify/v2/service/__init__.py b/twilio/rest/verify/v2/service/__init__.py index 69a6cf853e..9b8b4b4da9 100644 --- a/twilio/rest/verify/v2/service/__init__.py +++ b/twilio/rest/verify/v2/service/__init__.py @@ -43,7 +43,7 @@ class ServiceInstance(InstanceResource): :ivar dtmf_input_required: Whether to ask the user to press a number before delivering the verify code in a phone call. :ivar tts_name: The name of an alternative text-to-speech service to use in phone calls. Applies only to TTS languages. :ivar do_not_share_warning_enabled: Whether to add a security warning at the end of an SMS verification body. Disabled by default and applies only to SMS. Example SMS body: `Your AppName verification code is: 1234. Don’t share this code with anyone; our employees will never ask for the code` - :ivar custom_code_enabled: Whether to allow sending verifications with a custom code instead of a randomly generated one. Not available for all customers. + :ivar custom_code_enabled: Whether to allow sending verifications with a custom code instead of a randomly generated one. :ivar push: Configurations for the Push factors (channel) created under this Service. :ivar totp: Configurations for the TOTP factors (channel) created under this Service. :ivar default_template_sid: @@ -183,7 +183,7 @@ def update( :param tts_name: The name of an alternative text-to-speech service to use in phone calls. Applies only to TTS languages. :param psd2_enabled: Whether to pass PSD2 transaction parameters when starting a verification. :param do_not_share_warning_enabled: Whether to add a privacy warning at the end of an SMS. **Disabled by default and applies only for SMS.** - :param custom_code_enabled: Whether to allow sending verifications with a custom code instead of a randomly generated one. Not available for all customers. + :param custom_code_enabled: Whether to allow sending verifications with a custom code instead of a randomly generated one. :param push_include_date: Optional configuration for the Push factors. If true, include the date in the Challenge's response. Otherwise, the date is omitted from the response. See [Challenge](https://www.twilio.com/docs/verify/api/challenge) resource’s details parameter for more info. Default: false. **Deprecated** do not use this parameter. :param push_apn_credential_sid: Optional configuration for the Push factors. Set the APN Credential for this service. This will allow to send push notifications to iOS devices. See [Credential Resource](https://www.twilio.com/docs/notify/api/credential-resource) :param push_fcm_credential_sid: Optional configuration for the Push factors. Set the FCM Credential for this service. This will allow to send push notifications to Android devices. See [Credential Resource](https://www.twilio.com/docs/notify/api/credential-resource) @@ -255,7 +255,7 @@ async def update_async( :param tts_name: The name of an alternative text-to-speech service to use in phone calls. Applies only to TTS languages. :param psd2_enabled: Whether to pass PSD2 transaction parameters when starting a verification. :param do_not_share_warning_enabled: Whether to add a privacy warning at the end of an SMS. **Disabled by default and applies only for SMS.** - :param custom_code_enabled: Whether to allow sending verifications with a custom code instead of a randomly generated one. Not available for all customers. + :param custom_code_enabled: Whether to allow sending verifications with a custom code instead of a randomly generated one. :param push_include_date: Optional configuration for the Push factors. If true, include the date in the Challenge's response. Otherwise, the date is omitted from the response. See [Challenge](https://www.twilio.com/docs/verify/api/challenge) resource’s details parameter for more info. Default: false. **Deprecated** do not use this parameter. :param push_apn_credential_sid: Optional configuration for the Push factors. Set the APN Credential for this service. This will allow to send push notifications to iOS devices. See [Credential Resource](https://www.twilio.com/docs/notify/api/credential-resource) :param push_fcm_credential_sid: Optional configuration for the Push factors. Set the FCM Credential for this service. This will allow to send push notifications to Android devices. See [Credential Resource](https://www.twilio.com/docs/notify/api/credential-resource) @@ -473,7 +473,7 @@ def update( :param tts_name: The name of an alternative text-to-speech service to use in phone calls. Applies only to TTS languages. :param psd2_enabled: Whether to pass PSD2 transaction parameters when starting a verification. :param do_not_share_warning_enabled: Whether to add a privacy warning at the end of an SMS. **Disabled by default and applies only for SMS.** - :param custom_code_enabled: Whether to allow sending verifications with a custom code instead of a randomly generated one. Not available for all customers. + :param custom_code_enabled: Whether to allow sending verifications with a custom code instead of a randomly generated one. :param push_include_date: Optional configuration for the Push factors. If true, include the date in the Challenge's response. Otherwise, the date is omitted from the response. See [Challenge](https://www.twilio.com/docs/verify/api/challenge) resource’s details parameter for more info. Default: false. **Deprecated** do not use this parameter. :param push_apn_credential_sid: Optional configuration for the Push factors. Set the APN Credential for this service. This will allow to send push notifications to iOS devices. See [Credential Resource](https://www.twilio.com/docs/notify/api/credential-resource) :param push_fcm_credential_sid: Optional configuration for the Push factors. Set the FCM Credential for this service. This will allow to send push notifications to Android devices. See [Credential Resource](https://www.twilio.com/docs/notify/api/credential-resource) @@ -561,7 +561,7 @@ async def update_async( :param tts_name: The name of an alternative text-to-speech service to use in phone calls. Applies only to TTS languages. :param psd2_enabled: Whether to pass PSD2 transaction parameters when starting a verification. :param do_not_share_warning_enabled: Whether to add a privacy warning at the end of an SMS. **Disabled by default and applies only for SMS.** - :param custom_code_enabled: Whether to allow sending verifications with a custom code instead of a randomly generated one. Not available for all customers. + :param custom_code_enabled: Whether to allow sending verifications with a custom code instead of a randomly generated one. :param push_include_date: Optional configuration for the Push factors. If true, include the date in the Challenge's response. Otherwise, the date is omitted from the response. See [Challenge](https://www.twilio.com/docs/verify/api/challenge) resource’s details parameter for more info. Default: false. **Deprecated** do not use this parameter. :param push_apn_credential_sid: Optional configuration for the Push factors. Set the APN Credential for this service. This will allow to send push notifications to iOS devices. See [Credential Resource](https://www.twilio.com/docs/notify/api/credential-resource) :param push_fcm_credential_sid: Optional configuration for the Push factors. Set the FCM Credential for this service. This will allow to send push notifications to Android devices. See [Credential Resource](https://www.twilio.com/docs/notify/api/credential-resource) @@ -775,7 +775,7 @@ def create( :param tts_name: The name of an alternative text-to-speech service to use in phone calls. Applies only to TTS languages. :param psd2_enabled: Whether to pass PSD2 transaction parameters when starting a verification. :param do_not_share_warning_enabled: Whether to add a security warning at the end of an SMS verification body. Disabled by default and applies only to SMS. Example SMS body: `Your AppName verification code is: 1234. Don’t share this code with anyone; our employees will never ask for the code` - :param custom_code_enabled: Whether to allow sending verifications with a custom code instead of a randomly generated one. Not available for all customers. + :param custom_code_enabled: Whether to allow sending verifications with a custom code instead of a randomly generated one. :param push_include_date: Optional configuration for the Push factors. If true, include the date in the Challenge's response. Otherwise, the date is omitted from the response. See [Challenge](https://www.twilio.com/docs/verify/api/challenge) resource’s details parameter for more info. Default: false. **Deprecated** do not use this parameter. This timestamp value is the same one as the one found in `date_created`, please use that one instead. :param push_apn_credential_sid: Optional configuration for the Push factors. Set the APN Credential for this service. This will allow to send push notifications to iOS devices. See [Credential Resource](https://www.twilio.com/docs/notify/api/credential-resource) :param push_fcm_credential_sid: Optional configuration for the Push factors. Set the FCM Credential for this service. This will allow to send push notifications to Android devices. See [Credential Resource](https://www.twilio.com/docs/notify/api/credential-resource) @@ -863,7 +863,7 @@ async def create_async( :param tts_name: The name of an alternative text-to-speech service to use in phone calls. Applies only to TTS languages. :param psd2_enabled: Whether to pass PSD2 transaction parameters when starting a verification. :param do_not_share_warning_enabled: Whether to add a security warning at the end of an SMS verification body. Disabled by default and applies only to SMS. Example SMS body: `Your AppName verification code is: 1234. Don’t share this code with anyone; our employees will never ask for the code` - :param custom_code_enabled: Whether to allow sending verifications with a custom code instead of a randomly generated one. Not available for all customers. + :param custom_code_enabled: Whether to allow sending verifications with a custom code instead of a randomly generated one. :param push_include_date: Optional configuration for the Push factors. If true, include the date in the Challenge's response. Otherwise, the date is omitted from the response. See [Challenge](https://www.twilio.com/docs/verify/api/challenge) resource’s details parameter for more info. Default: false. **Deprecated** do not use this parameter. This timestamp value is the same one as the one found in `date_created`, please use that one instead. :param push_apn_credential_sid: Optional configuration for the Push factors. Set the APN Credential for this service. This will allow to send push notifications to iOS devices. See [Credential Resource](https://www.twilio.com/docs/notify/api/credential-resource) :param push_fcm_credential_sid: Optional configuration for the Push factors. Set the FCM Credential for this service. This will allow to send push notifications to Android devices. See [Credential Resource](https://www.twilio.com/docs/notify/api/credential-resource) From e848451ed378cf12bba443051d8f04d19e9c0153 Mon Sep 17 00:00:00 2001 From: Twilio Date: Mon, 26 Aug 2024 11:23:30 +0000 Subject: [PATCH 28/87] Release 9.2.4 --- setup.py | 2 +- twilio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 8fee9aa182..c775b6c766 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name="twilio", - version="9.2.3", + version="9.2.4", description="Twilio API client and TwiML generator", author="Twilio", help_center="https://www.twilio.com/help/contact", diff --git a/twilio/__init__.py b/twilio/__init__.py index bb8cd36f5d..17b3d8825f 100644 --- a/twilio/__init__.py +++ b/twilio/__init__.py @@ -1,2 +1,2 @@ -__version_info__ = ("9", "2", "3") +__version_info__ = ("9", "2", "4") __version__ = ".".join(__version_info__) From ba7da14775a5271accbf8fa2841d008b356287ce Mon Sep 17 00:00:00 2001 From: Twilio Date: Thu, 5 Sep 2024 12:55:48 +0000 Subject: [PATCH 29/87] [Librarian] Regenerated @ 78bf2bbef74e4846ca8353fbdee038a6b8080c59 2250ef3ba08540233f688bf6aaa55e9c94febf3b --- CHANGES.md | 10 + twilio/rest/__init__.py | 15 + twilio/rest/content/v1/content/__init__.py | 117 ++++++- twilio/rest/iam/IamBase.py | 44 +++ twilio/rest/iam/v1/__init__.py | 59 ++++ twilio/rest/iam/v1/api_key.py | 328 ++++++++++++++++++ twilio/rest/iam/v1/get_api_keys.py | 294 ++++++++++++++++ twilio/rest/iam/v1/new_api_key.py | 149 ++++++++ twilio/rest/numbers/v1/porting_port_in.py | 4 +- .../supporting_document.py | 2 + .../task_queue_real_time_statistics.py | 2 +- 11 files changed, 1018 insertions(+), 6 deletions(-) create mode 100644 twilio/rest/iam/IamBase.py create mode 100644 twilio/rest/iam/v1/__init__.py create mode 100644 twilio/rest/iam/v1/api_key.py create mode 100644 twilio/rest/iam/v1/get_api_keys.py create mode 100644 twilio/rest/iam/v1/new_api_key.py diff --git a/CHANGES.md b/CHANGES.md index 2222dfc4d5..ad840949f1 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,16 @@ twilio-python Changelog Here you can see the full list of changes between each twilio-python release. +[2024-09-05] Version 9.3.0 +-------------------------- +**Iam** +- updated library_visibility public for new public apikeys + +**Numbers** +- Add new field in Error Codes for Regulatory Compliance. +- Change typing of Port In Request date_created field to date_time instead of date **(breaking change)** + + [2024-08-26] Version 9.2.4 -------------------------- **Library - Chore** diff --git a/twilio/rest/__init__.py b/twilio/rest/__init__.py index 2dc0a4930f..35c57385aa 100644 --- a/twilio/rest/__init__.py +++ b/twilio/rest/__init__.py @@ -23,6 +23,7 @@ from twilio.rest.events import Events from twilio.rest.flex_api import FlexApi from twilio.rest.frontline_api import FrontlineApi + from twilio.rest.iam import Iam from twilio.rest.insights import Insights from twilio.rest.intelligence import Intelligence from twilio.rest.ip_messaging import IpMessaging @@ -131,6 +132,7 @@ def __init__( self._events: Optional["Events"] = None self._flex_api: Optional["FlexApi"] = None self._frontline_api: Optional["FrontlineApi"] = None + self._iam: Optional["Iam"] = None self._insights: Optional["Insights"] = None self._intelligence: Optional["Intelligence"] = None self._ip_messaging: Optional["IpMessaging"] = None @@ -275,6 +277,19 @@ def frontline_api(self) -> "FrontlineApi": self._frontline_api = FrontlineApi(self) return self._frontline_api + @property + def iam(self) -> "Iam": + """ + Access the Iam Twilio Domain + + :returns: Iam Twilio Domain + """ + if self._iam is None: + from twilio.rest.iam import Iam + + self._iam = Iam(self) + return self._iam + @property def insights(self) -> "Insights": """ diff --git a/twilio/rest/content/v1/content/__init__.py b/twilio/rest/content/v1/content/__init__.py index f2dec12761..3ddc8b926e 100644 --- a/twilio/rest/content/v1/content/__init__.py +++ b/twilio/rest/content/v1/content/__init__.py @@ -32,11 +32,15 @@ class AuthenticationActionType(object): class CallToActionActionType(object): URL = "URL" PHONE_NUMBER = "PHONE_NUMBER" + COPY_CODE = "COPY_CODE" + VOICE_CALL = "VOICE_CALL" class CardActionType(object): URL = "URL" PHONE_NUMBER = "PHONE_NUMBER" QUICK_REPLY = "QUICK_REPLY" + COPY_CODE = "COPY_CODE" + VOICE_CALL = "VOICE_CALL" class CarouselActionType(object): URL = "URL" @@ -321,7 +325,7 @@ class CallToActionAction(object): :ivar title: :ivar url: :ivar phone: - :ivar id: + :ivar code: """ def __init__(self, payload: Dict[str, Any]): @@ -332,7 +336,7 @@ def __init__(self, payload: Dict[str, Any]): self.title: Optional[str] = payload.get("title") self.url: Optional[str] = payload.get("url") self.phone: Optional[str] = payload.get("phone") - self.id: Optional[str] = payload.get("id") + self.code: Optional[str] = payload.get("code") def to_dict(self): return { @@ -340,7 +344,7 @@ def to_dict(self): "title": self.title, "url": self.url, "phone": self.phone, - "id": self.id, + "code": self.code, } class CardAction(object): @@ -350,6 +354,7 @@ class CardAction(object): :ivar url: :ivar phone: :ivar id: + :ivar code: """ def __init__(self, payload: Dict[str, Any]): @@ -359,6 +364,7 @@ def __init__(self, payload: Dict[str, Any]): self.url: Optional[str] = payload.get("url") self.phone: Optional[str] = payload.get("phone") self.id: Optional[str] = payload.get("id") + self.code: Optional[str] = payload.get("code") def to_dict(self): return { @@ -367,6 +373,7 @@ def to_dict(self): "url": self.url, "phone": self.phone, "id": self.id, + "code": self.code, } class CarouselAction(object): @@ -474,6 +481,76 @@ def to_dict(self): "types": self.types.to_dict(), } + class FlowsPage(object): + """ + :ivar id: + :ivar next_page_id: + :ivar title: + :ivar subtitle: + :ivar layout: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.id: Optional[str] = payload.get("id") + self.next_page_id: Optional[str] = payload.get("next_page_id") + self.title: Optional[str] = payload.get("title") + self.subtitle: Optional[str] = payload.get("subtitle") + self.layout: Optional[List[ContentList.FlowsPageComponent]] = payload.get( + "layout" + ) + + def to_dict(self): + return { + "id": self.id, + "next_page_id": self.next_page_id, + "title": self.title, + "subtitle": self.subtitle, + "layout": [layout.to_dict() for layout in self.layout], + } + + class FlowsPageComponent(object): + """ + :ivar label: + :ivar type: + :ivar text: + :ivar options: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.label: Optional[str] = payload.get("label") + self.type: Optional[str] = payload.get("type") + self.text: Optional[str] = payload.get("text") + self.options: Optional[List[ContentList.FlowsPageComponentSelectItem]] = ( + payload.get("options") + ) + + def to_dict(self): + return { + "label": self.label, + "type": self.type, + "text": self.text, + "options": [options.to_dict() for options in self.options], + } + + class FlowsPageComponentSelectItem(object): + """ + :ivar id: + :ivar title: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.id: Optional[str] = payload.get("id") + self.title: Optional[str] = payload.get("title") + + def to_dict(self): + return { + "id": self.id, + "title": self.title, + } + class ListItem(object): """ :ivar id: @@ -606,6 +683,35 @@ def to_dict(self): "dynamic_items": self.dynamic_items, } + class TwilioFlows(object): + """ + :ivar body: + :ivar button_text: + :ivar subtitle: + :ivar media_url: + :ivar pages: + :ivar type: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.body: Optional[str] = payload.get("body") + self.button_text: Optional[str] = payload.get("button_text") + self.subtitle: Optional[str] = payload.get("subtitle") + self.media_url: Optional[str] = payload.get("media_url") + self.pages: Optional[List[ContentList.FlowsPage]] = payload.get("pages") + self.type: Optional[str] = payload.get("type") + + def to_dict(self): + return { + "body": self.body, + "button_text": self.button_text, + "subtitle": self.subtitle, + "media_url": self.media_url, + "pages": [pages.to_dict() for pages in self.pages], + "type": self.type, + } + class TwilioListPicker(object): """ :ivar body: @@ -707,6 +813,7 @@ class Types(object): :ivar twilio_card: :ivar twilio_catalog: :ivar twilio_carousel: + :ivar twilio_flows: :ivar whatsapp_card: :ivar whatsapp_authentication: """ @@ -740,6 +847,9 @@ def __init__(self, payload: Dict[str, Any]): self.twilio_carousel: Optional[ContentList.TwilioCarousel] = payload.get( "twilio_carousel" ) + self.twilio_flows: Optional[ContentList.TwilioFlows] = payload.get( + "twilio_flows" + ) self.whatsapp_card: Optional[ContentList.WhatsappCard] = payload.get( "whatsapp_card" ) @@ -758,6 +868,7 @@ def to_dict(self): "twilio_card": self.twilio_card.to_dict(), "twilio_catalog": self.twilio_catalog.to_dict(), "twilio_carousel": self.twilio_carousel.to_dict(), + "twilio_flows": self.twilio_flows.to_dict(), "whatsapp_card": self.whatsapp_card.to_dict(), "whatsapp_authentication": self.whatsapp_authentication.to_dict(), } diff --git a/twilio/rest/iam/IamBase.py b/twilio/rest/iam/IamBase.py new file mode 100644 index 0000000000..2882ec145b --- /dev/null +++ b/twilio/rest/iam/IamBase.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.iam.v1 import V1 + + +class IamBase(Domain): + + def __init__(self, twilio: Client): + """ + Initialize the Iam Domain + + :returns: Domain for Iam + """ + super().__init__(twilio, "https://iam.twilio.com") + self._v1: Optional[V1] = None + + @property + def v1(self) -> V1: + """ + :returns: Versions v1 of Iam + """ + 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/iam/v1/__init__.py b/twilio/rest/iam/v1/__init__.py new file mode 100644 index 0000000000..0c46947341 --- /dev/null +++ b/twilio/rest/iam/v1/__init__.py @@ -0,0 +1,59 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Iam + 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 Optional +from twilio.base.version import Version +from twilio.base.domain import Domain +from twilio.rest.iam.v1.api_key import ApiKeyList +from twilio.rest.iam.v1.get_api_keys import GetApiKeysList +from twilio.rest.iam.v1.new_api_key import NewApiKeyList + + +class V1(Version): + + def __init__(self, domain: Domain): + """ + Initialize the V1 version of Iam + + :param domain: The Twilio.iam domain + """ + super().__init__(domain, "v1") + self._api_key: Optional[ApiKeyList] = None + self._get_api_keys: Optional[GetApiKeysList] = None + self._new_api_key: Optional[NewApiKeyList] = None + + @property + def api_key(self) -> ApiKeyList: + if self._api_key is None: + self._api_key = ApiKeyList(self) + return self._api_key + + @property + def get_api_keys(self) -> GetApiKeysList: + if self._get_api_keys is None: + self._get_api_keys = GetApiKeysList(self) + return self._get_api_keys + + @property + def new_api_key(self) -> NewApiKeyList: + if self._new_api_key is None: + self._new_api_key = NewApiKeyList(self) + return self._new_api_key + + def __repr__(self) -> str: + """ + Provide a friendly representation + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/iam/v1/api_key.py b/twilio/rest/iam/v1/api_key.py new file mode 100644 index 0000000000..b94889fcca --- /dev/null +++ b/twilio/rest/iam/v1/api_key.py @@ -0,0 +1,328 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Iam + 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 datetime import datetime +from typing import Any, Dict, Optional, Union +from twilio.base import deserialize, serialize, values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class ApiKeyInstance(InstanceResource): + """ + :ivar sid: The unique string that we created to identify the Key resource. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar policy: The \\`Policy\\` object is a collection that specifies the allowed Twilio permissions for the restricted key. For more information on the permissions available with restricted API keys, refer to the [Twilio documentation](https://www.twilio.com/docs/iam/api-keys/restricted-api-keys#permissions-available-with-restricted-api-keys). + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): + super().__init__(version) + + self.sid: Optional[str] = payload.get("sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.policy: Optional[Dict[str, object]] = payload.get("policy") + + self._solution = { + "sid": sid or self.sid, + } + self._context: Optional[ApiKeyContext] = None + + @property + def _proxy(self) -> "ApiKeyContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: ApiKeyContext for this ApiKeyInstance + """ + if self._context is None: + self._context = ApiKeyContext( + self._version, + sid=self._solution["sid"], + ) + return self._context + + def delete(self) -> bool: + """ + Deletes the ApiKeyInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the ApiKeyInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def fetch(self) -> "ApiKeyInstance": + """ + Fetch the ApiKeyInstance + + + :returns: The fetched ApiKeyInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "ApiKeyInstance": + """ + Asynchronous coroutine to fetch the ApiKeyInstance + + + :returns: The fetched ApiKeyInstance + """ + return await self._proxy.fetch_async() + + def update( + self, + friendly_name: Union[str, object] = values.unset, + policy: Union[object, object] = values.unset, + ) -> "ApiKeyInstance": + """ + Update the ApiKeyInstance + + :param friendly_name: A descriptive string that you create to describe the resource. It can be up to 64 characters long. + :param policy: The \\\\`Policy\\\\` object is a collection that specifies the allowed Twilio permissions for the restricted key. For more information on the permissions available with restricted API keys, refer to the [Twilio documentation](https://www.twilio.com/docs/iam/api-keys/restricted-api-keys#permissions-available-with-restricted-api-keys). + + :returns: The updated ApiKeyInstance + """ + return self._proxy.update( + friendly_name=friendly_name, + policy=policy, + ) + + async def update_async( + self, + friendly_name: Union[str, object] = values.unset, + policy: Union[object, object] = values.unset, + ) -> "ApiKeyInstance": + """ + Asynchronous coroutine to update the ApiKeyInstance + + :param friendly_name: A descriptive string that you create to describe the resource. It can be up to 64 characters long. + :param policy: The \\\\`Policy\\\\` object is a collection that specifies the allowed Twilio permissions for the restricted key. For more information on the permissions available with restricted API keys, refer to the [Twilio documentation](https://www.twilio.com/docs/iam/api-keys/restricted-api-keys#permissions-available-with-restricted-api-keys). + + :returns: The updated ApiKeyInstance + """ + return await self._proxy.update_async( + friendly_name=friendly_name, + policy=policy, + ) + + 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 ApiKeyContext(InstanceContext): + + def __init__(self, version: Version, sid: str): + """ + Initialize the ApiKeyContext + + :param version: Version that contains the resource + :param sid: The Twilio-provided string that uniquely identifies the Key resource to update. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "sid": sid, + } + self._uri = "/Keys/{sid}".format(**self._solution) + + def delete(self) -> bool: + """ + Deletes the ApiKeyInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._version.delete( + method="DELETE", + uri=self._uri, + ) + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the ApiKeyInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._version.delete_async( + method="DELETE", + uri=self._uri, + ) + + def fetch(self) -> ApiKeyInstance: + """ + Fetch the ApiKeyInstance + + + :returns: The fetched ApiKeyInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return ApiKeyInstance( + self._version, + payload, + sid=self._solution["sid"], + ) + + async def fetch_async(self) -> ApiKeyInstance: + """ + Asynchronous coroutine to fetch the ApiKeyInstance + + + :returns: The fetched ApiKeyInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return ApiKeyInstance( + self._version, + payload, + sid=self._solution["sid"], + ) + + def update( + self, + friendly_name: Union[str, object] = values.unset, + policy: Union[object, object] = values.unset, + ) -> ApiKeyInstance: + """ + Update the ApiKeyInstance + + :param friendly_name: A descriptive string that you create to describe the resource. It can be up to 64 characters long. + :param policy: The \\\\`Policy\\\\` object is a collection that specifies the allowed Twilio permissions for the restricted key. For more information on the permissions available with restricted API keys, refer to the [Twilio documentation](https://www.twilio.com/docs/iam/api-keys/restricted-api-keys#permissions-available-with-restricted-api-keys). + + :returns: The updated ApiKeyInstance + """ + data = values.of( + { + "FriendlyName": friendly_name, + "Policy": serialize.object(policy), + } + ) + + payload = self._version.update( + method="POST", + uri=self._uri, + data=data, + ) + + return ApiKeyInstance(self._version, payload, sid=self._solution["sid"]) + + async def update_async( + self, + friendly_name: Union[str, object] = values.unset, + policy: Union[object, object] = values.unset, + ) -> ApiKeyInstance: + """ + Asynchronous coroutine to update the ApiKeyInstance + + :param friendly_name: A descriptive string that you create to describe the resource. It can be up to 64 characters long. + :param policy: The \\\\`Policy\\\\` object is a collection that specifies the allowed Twilio permissions for the restricted key. For more information on the permissions available with restricted API keys, refer to the [Twilio documentation](https://www.twilio.com/docs/iam/api-keys/restricted-api-keys#permissions-available-with-restricted-api-keys). + + :returns: The updated ApiKeyInstance + """ + data = values.of( + { + "FriendlyName": friendly_name, + "Policy": serialize.object(policy), + } + ) + + payload = await self._version.update_async( + method="POST", + uri=self._uri, + data=data, + ) + + return ApiKeyInstance(self._version, payload, sid=self._solution["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 ApiKeyList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the ApiKeyList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + def get(self, sid: str) -> ApiKeyContext: + """ + Constructs a ApiKeyContext + + :param sid: The Twilio-provided string that uniquely identifies the Key resource to update. + """ + return ApiKeyContext(self._version, sid=sid) + + def __call__(self, sid: str) -> ApiKeyContext: + """ + Constructs a ApiKeyContext + + :param sid: The Twilio-provided string that uniquely identifies the Key resource to update. + """ + return ApiKeyContext(self._version, sid=sid) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/iam/v1/get_api_keys.py b/twilio/rest/iam/v1/get_api_keys.py new file mode 100644 index 0000000000..3a3e9bda76 --- /dev/null +++ b/twilio/rest/iam/v1/get_api_keys.py @@ -0,0 +1,294 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Iam + 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 datetime import datetime +from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator +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 +from twilio.base.page import Page + + +class GetApiKeysInstance(InstanceResource): + """ + :ivar sid: The unique string that we created to identify the Key resource. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) + + self.sid: Optional[str] = payload.get("sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "" + + +class GetApiKeysPage(Page): + + def get_instance(self, payload: Dict[str, Any]) -> GetApiKeysInstance: + """ + Build an instance of GetApiKeysInstance + + :param payload: Payload response from the API + """ + return GetApiKeysInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class GetApiKeysList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the GetApiKeysList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/Keys" + + def stream( + self, + account_sid: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[GetApiKeysInstance]: + """ + Streams GetApiKeysInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param str account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Payments resource. + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = self.page(account_sid=account_sid, page_size=limits["page_size"]) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + account_sid: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[GetApiKeysInstance]: + """ + Asynchronously streams GetApiKeysInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param str account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Payments resource. + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = await self.page_async( + account_sid=account_sid, page_size=limits["page_size"] + ) + + return self._version.stream_async(page, limits["limit"]) + + def list( + self, + account_sid: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[GetApiKeysInstance]: + """ + Lists GetApiKeysInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Payments resource. + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return list( + self.stream( + account_sid=account_sid, + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + account_sid: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[GetApiKeysInstance]: + """ + Asynchronously lists GetApiKeysInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Payments resource. + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return [ + record + async for record in await self.stream_async( + account_sid=account_sid, + limit=limit, + page_size=page_size, + ) + ] + + def page( + self, + account_sid: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> GetApiKeysPage: + """ + Retrieve a single page of GetApiKeysInstance records from the API. + Request is executed immediately + + :param account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Payments resource. + :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 + + :returns: Page of GetApiKeysInstance + """ + data = values.of( + { + "AccountSid": account_sid, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = self._version.page(method="GET", uri=self._uri, params=data) + return GetApiKeysPage(self._version, response) + + async def page_async( + self, + account_sid: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> GetApiKeysPage: + """ + Asynchronously retrieve a single page of GetApiKeysInstance records from the API. + Request is executed immediately + + :param account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Payments resource. + :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 + + :returns: Page of GetApiKeysInstance + """ + data = values.of( + { + "AccountSid": account_sid, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = await self._version.page_async( + method="GET", uri=self._uri, params=data + ) + return GetApiKeysPage(self._version, response) + + def get_page(self, target_url: str) -> GetApiKeysPage: + """ + Retrieve a specific page of GetApiKeysInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of GetApiKeysInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return GetApiKeysPage(self._version, response) + + async def get_page_async(self, target_url: str) -> GetApiKeysPage: + """ + Asynchronously retrieve a specific page of GetApiKeysInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of GetApiKeysInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return GetApiKeysPage(self._version, response) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/iam/v1/new_api_key.py b/twilio/rest/iam/v1/new_api_key.py new file mode 100644 index 0000000000..e3f9fa05a6 --- /dev/null +++ b/twilio/rest/iam/v1/new_api_key.py @@ -0,0 +1,149 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Iam + 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 datetime import datetime +from typing import Any, Dict, Optional, Union +from twilio.base import deserialize, serialize, values + +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class NewApiKeyInstance(InstanceResource): + + class Keytype(object): + RESTRICTED = "restricted" + + """ + :ivar sid: The unique string that that we created to identify the NewKey resource. You will use this as the basic-auth `user` when authenticating to the API. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar date_created: The date and time in GMT that the API Key was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that the new API Key was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar secret: The secret your application uses to sign Access Tokens and to authenticate to the REST API (you will use this as the basic-auth `password`). **Note that for security reasons, this field is ONLY returned when the API Key is first created.** + :ivar policy: Collection of allow assertions. + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) + + self.sid: Optional[str] = payload.get("sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.secret: Optional[str] = payload.get("secret") + self.policy: Optional[Dict[str, object]] = payload.get("policy") + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "" + + +class NewApiKeyList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the NewApiKeyList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/Keys" + + def create( + self, + account_sid: str, + friendly_name: Union[str, object] = values.unset, + key_type: Union["NewApiKeyInstance.Keytype", object] = values.unset, + policy: Union[object, object] = values.unset, + ) -> NewApiKeyInstance: + """ + Create the NewApiKeyInstance + + :param account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Payments resource. + :param friendly_name: A descriptive string that you create to describe the resource. It can be up to 64 characters long. + :param key_type: + :param policy: The \\\\`Policy\\\\` object is a collection that specifies the allowed Twilio permissions for the restricted key. For more information on the permissions available with restricted API keys, refer to the [Twilio documentation](https://www.twilio.com/docs/iam/api-keys/restricted-api-keys#permissions-available-with-restricted-api-keys). + + :returns: The created NewApiKeyInstance + """ + + data = values.of( + { + "AccountSid": account_sid, + "FriendlyName": friendly_name, + "KeyType": key_type, + "Policy": serialize.object(policy), + } + ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return NewApiKeyInstance(self._version, payload) + + async def create_async( + self, + account_sid: str, + friendly_name: Union[str, object] = values.unset, + key_type: Union["NewApiKeyInstance.Keytype", object] = values.unset, + policy: Union[object, object] = values.unset, + ) -> NewApiKeyInstance: + """ + Asynchronously create the NewApiKeyInstance + + :param account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Payments resource. + :param friendly_name: A descriptive string that you create to describe the resource. It can be up to 64 characters long. + :param key_type: + :param policy: The \\\\`Policy\\\\` object is a collection that specifies the allowed Twilio permissions for the restricted key. For more information on the permissions available with restricted API keys, refer to the [Twilio documentation](https://www.twilio.com/docs/iam/api-keys/restricted-api-keys#permissions-available-with-restricted-api-keys). + + :returns: The created NewApiKeyInstance + """ + + data = values.of( + { + "AccountSid": account_sid, + "FriendlyName": friendly_name, + "KeyType": key_type, + "Policy": serialize.object(policy), + } + ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return NewApiKeyInstance(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 index 9ce6b7b4cd..02844a09b4 100644 --- a/twilio/rest/numbers/v1/porting_port_in.py +++ b/twilio/rest/numbers/v1/porting_port_in.py @@ -12,7 +12,7 @@ Do not edit the class manually. """ -from datetime import date +from datetime import date, datetime from typing import Any, Dict, List, Optional, Union from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext @@ -70,7 +70,7 @@ def __init__( "phone_numbers" ) self.documents: Optional[List[str]] = payload.get("documents") - self.date_created: Optional[date] = deserialize.iso8601_date( + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( payload.get("date_created") ) diff --git a/twilio/rest/numbers/v2/regulatory_compliance/supporting_document.py b/twilio/rest/numbers/v2/regulatory_compliance/supporting_document.py index afa6579a13..c343e91ed5 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/supporting_document.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/supporting_document.py @@ -39,6 +39,7 @@ class Status(object): :ivar mime_type: The image type uploaded in the Supporting Document container. :ivar status: :ivar failure_reason: The failure reason of the Supporting Document Resource. + :ivar errors: A list of errors that occurred during the registering RC Bundle :ivar type: The type of the Supporting Document. :ivar attributes: The set of parameters that are the attributes of the Supporting Documents resource which are listed in the Supporting Document Types. :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. @@ -59,6 +60,7 @@ def __init__( "status" ) self.failure_reason: Optional[str] = payload.get("failure_reason") + self.errors: Optional[List[Dict[str, object]]] = payload.get("errors") self.type: Optional[str] = payload.get("type") self.attributes: Optional[Dict[str, object]] = payload.get("attributes") self.date_created: Optional[datetime] = deserialize.iso8601_datetime( diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.py b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.py index faca804702..4d4198ac89 100644 --- a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.py @@ -31,7 +31,7 @@ class TaskQueueRealTimeStatisticsInstance(InstanceResource): :ivar task_queue_sid: The SID of the TaskQueue from which these statistics were calculated. :ivar tasks_by_priority: The number of Tasks by priority. For example: `{\"0\": \"10\", \"99\": \"5\"}` shows 10 Tasks at priority 0 and 5 at priority 99. :ivar tasks_by_status: The number of Tasks by their current status. For example: `{\"pending\": \"1\", \"reserved\": \"3\", \"assigned\": \"2\", \"completed\": \"5\"}`. - :ivar total_available_workers: The total number of Workers available for Tasks in the TaskQueue. + :ivar total_available_workers: The total number of Workers in the TaskQueue with an `available` status. Workers with an `available` status may already have active interactions or may have none. :ivar total_eligible_workers: The total number of Workers eligible for Tasks in the TaskQueue, independent of their Activity state. :ivar total_tasks: The total number of Tasks. :ivar workspace_sid: The SID of the Workspace that contains the TaskQueue. From 74b506ec8e7207ffbbeabd5c0e71b47ce41a70b4 Mon Sep 17 00:00:00 2001 From: Twilio Date: Thu, 5 Sep 2024 13:00:28 +0000 Subject: [PATCH 30/87] Release 9.3.0 --- setup.py | 2 +- twilio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index c775b6c766..6366ea68eb 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name="twilio", - version="9.2.4", + version="9.3.0", description="Twilio API client and TwiML generator", author="Twilio", help_center="https://www.twilio.com/help/contact", diff --git a/twilio/__init__.py b/twilio/__init__.py index 17b3d8825f..529960ecb5 100644 --- a/twilio/__init__.py +++ b/twilio/__init__.py @@ -1,2 +1,2 @@ -__version_info__ = ("9", "2", "4") +__version_info__ = ("9", "3", "0") __version__ = ".".join(__version_info__) From 3eacd66d8d93a0da044e2db21a71267539f49f6d Mon Sep 17 00:00:00 2001 From: Shubham Date: Wed, 18 Sep 2024 16:58:48 +0530 Subject: [PATCH 31/87] chore: add static init file to iam domain (#813) --- twilio/rest/iam/__init__.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 twilio/rest/iam/__init__.py diff --git a/twilio/rest/iam/__init__.py b/twilio/rest/iam/__init__.py new file mode 100644 index 0000000000..7a7819bcc2 --- /dev/null +++ b/twilio/rest/iam/__init__.py @@ -0,0 +1,35 @@ +from warnings import warn + +from twilio.rest.iam.IamBase import IamBase +from twilio.rest.iam.v1.api_key import ApiKeyList +from twilio.rest.iam.v1.get_api_keys import GetApiKeysList +from twilio.rest.iam.v1.new_api_key import NewApiKeyList + + +class Accounts(IamBase): + @property + def api_key(self) -> ApiKeyList: + warn( + "api_key is deprecated. Use v1.api_key instead.", + DeprecationWarning, + stacklevel=2, + ) + return self.v1.api_key + + @property + def get_api_keys(self) -> GetApiKeysList: + warn( + "get_api_keys is deprecated. Use v1.get_api_keys instead.", + DeprecationWarning, + stacklevel=2, + ) + return self.v1.get_api_keys + + @property + def new_api_key(self) -> NewApiKeyList: + warn( + "new_api_key is deprecated. Use v1.new_api_key instead.", + DeprecationWarning, + stacklevel=2, + ) + return self.v1.new_api_key From e595e2863574bd10caa29247693daab60963bad6 Mon Sep 17 00:00:00 2001 From: Twilio Date: Wed, 18 Sep 2024 13:18:47 +0000 Subject: [PATCH 32/87] [Librarian] Regenerated @ 1b6718f23da76f150eac392860c66a26de9af713 ceb130295f80bc623f22496076e3dd57e27da2fb --- CHANGES.md | 13 + twilio/rest/__init__.py | 15 + twilio/rest/assistants/AssistantsBase.py | 44 ++ twilio/rest/assistants/v1/__init__.py | 75 ++ .../rest/assistants/v1/assistant/__init__.py | 706 +++++++++++++++++ .../rest/assistants/v1/assistant/feedback.py | 364 +++++++++ .../rest/assistants/v1/knowledge/__init__.py | 712 ++++++++++++++++++ twilio/rest/assistants/v1/knowledge/chunk.py | 287 +++++++ twilio/rest/assistants/v1/policy.py | 322 ++++++++ twilio/rest/assistants/v1/session/__init__.py | 425 +++++++++++ twilio/rest/assistants/v1/session/message.py | 299 ++++++++ twilio/rest/assistants/v1/tool.py | 639 ++++++++++++++++ .../rest/content/v1/content/approval_fetch.py | 32 +- twilio/rest/intelligence/v2/operator_type.py | 3 +- .../installed_add_on_usage.py | 30 +- .../marketplace/v1/module_data_management.py | 68 +- twilio/rest/numbers/v2/bundle_clone.py | 8 +- .../regulatory_compliance/bundle/__init__.py | 16 +- 18 files changed, 3980 insertions(+), 78 deletions(-) create mode 100644 twilio/rest/assistants/AssistantsBase.py create mode 100644 twilio/rest/assistants/v1/__init__.py create mode 100644 twilio/rest/assistants/v1/assistant/__init__.py create mode 100644 twilio/rest/assistants/v1/assistant/feedback.py create mode 100644 twilio/rest/assistants/v1/knowledge/__init__.py create mode 100644 twilio/rest/assistants/v1/knowledge/chunk.py create mode 100644 twilio/rest/assistants/v1/policy.py create mode 100644 twilio/rest/assistants/v1/session/__init__.py create mode 100644 twilio/rest/assistants/v1/session/message.py create mode 100644 twilio/rest/assistants/v1/tool.py diff --git a/CHANGES.md b/CHANGES.md index ad840949f1..e8d6748656 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,19 @@ twilio-python Changelog Here you can see the full list of changes between each twilio-python release. +[2024-09-18] Version 9.3.1 +-------------------------- +**Library - Chore** +- [PR #813](https://github.com/twilio/twilio-python/pull/813): add static init file to iam domain. Thanks to [@tiwarishubham635](https://github.com/tiwarishubham635)! + +**Intelligence** +- Remove public from operator_type +- Update operator_type to include general-availablity and deprecated + +**Numbers** +- Remove beta flag for bundle clone API + + [2024-09-05] Version 9.3.0 -------------------------- **Iam** diff --git a/twilio/rest/__init__.py b/twilio/rest/__init__.py index 35c57385aa..5c8f3ebcfe 100644 --- a/twilio/rest/__init__.py +++ b/twilio/rest/__init__.py @@ -16,6 +16,7 @@ if TYPE_CHECKING: from twilio.rest.accounts import Accounts from twilio.rest.api import Api + from twilio.rest.assistants import Assistants from twilio.rest.bulkexports import Bulkexports from twilio.rest.chat import Chat from twilio.rest.content import Content @@ -125,6 +126,7 @@ def __init__( # Domains self._accounts: Optional["Accounts"] = None self._api: Optional["Api"] = None + self._assistants: Optional["Assistants"] = None self._bulkexports: Optional["Bulkexports"] = None self._chat: Optional["Chat"] = None self._content: Optional["Content"] = None @@ -186,6 +188,19 @@ def api(self) -> "Api": self._api = Api(self) return self._api + @property + def assistants(self) -> "Assistants": + """ + Access the Assistants Twilio Domain + + :returns: Assistants Twilio Domain + """ + if self._assistants is None: + from twilio.rest.assistants import Assistants + + self._assistants = Assistants(self) + return self._assistants + @property def bulkexports(self) -> "Bulkexports": """ diff --git a/twilio/rest/assistants/AssistantsBase.py b/twilio/rest/assistants/AssistantsBase.py new file mode 100644 index 0000000000..a9c9e9afcd --- /dev/null +++ b/twilio/rest/assistants/AssistantsBase.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.assistants.v1 import V1 + + +class AssistantsBase(Domain): + + def __init__(self, twilio: Client): + """ + Initialize the Assistants Domain + + :returns: Domain for Assistants + """ + super().__init__(twilio, "https://assistants.twilio.com") + self._v1: Optional[V1] = None + + @property + def v1(self) -> V1: + """ + :returns: Versions v1 of Assistants + """ + 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/assistants/v1/__init__.py b/twilio/rest/assistants/v1/__init__.py new file mode 100644 index 0000000000..546ad14554 --- /dev/null +++ b/twilio/rest/assistants/v1/__init__.py @@ -0,0 +1,75 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Assistants + 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 Optional +from twilio.base.version import Version +from twilio.base.domain import Domain +from twilio.rest.assistants.v1.assistant import AssistantList +from twilio.rest.assistants.v1.knowledge import KnowledgeList +from twilio.rest.assistants.v1.policy import PolicyList +from twilio.rest.assistants.v1.session import SessionList +from twilio.rest.assistants.v1.tool import ToolList + + +class V1(Version): + + def __init__(self, domain: Domain): + """ + Initialize the V1 version of Assistants + + :param domain: The Twilio.assistants domain + """ + super().__init__(domain, "v1") + self._assistants: Optional[AssistantList] = None + self._knowledge: Optional[KnowledgeList] = None + self._policies: Optional[PolicyList] = None + self._sessions: Optional[SessionList] = None + self._tools: Optional[ToolList] = None + + @property + def assistants(self) -> AssistantList: + if self._assistants is None: + self._assistants = AssistantList(self) + return self._assistants + + @property + def knowledge(self) -> KnowledgeList: + if self._knowledge is None: + self._knowledge = KnowledgeList(self) + return self._knowledge + + @property + def policies(self) -> PolicyList: + if self._policies is None: + self._policies = PolicyList(self) + return self._policies + + @property + def sessions(self) -> SessionList: + if self._sessions is None: + self._sessions = SessionList(self) + return self._sessions + + @property + def tools(self) -> ToolList: + if self._tools is None: + self._tools = ToolList(self) + return self._tools + + def __repr__(self) -> str: + """ + Provide a friendly representation + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/assistants/v1/assistant/__init__.py b/twilio/rest/assistants/v1/assistant/__init__.py new file mode 100644 index 0000000000..10e90c4743 --- /dev/null +++ b/twilio/rest/assistants/v1/assistant/__init__.py @@ -0,0 +1,706 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Assistants + 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 datetime import datetime +from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator +from twilio.base import deserialize, values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version +from twilio.base.page import Page +from twilio.rest.assistants.v1.assistant.feedback import FeedbackList + + +class AssistantInstance(InstanceResource): + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Assistant resource. + :ivar customer_ai: The Personalization and Perception Engine settings. + :ivar id: The Assistant ID. + :ivar model: The default model used by the assistant. + :ivar name: The name of the assistant. + :ivar owner: The owner/company of the assistant. + :ivar personality_prompt: The personality prompt to be used for assistant. + :ivar date_created: The date and time in GMT when the Assistant was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date and time in GMT when the Assistant was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar knowledge: The list of knowledge sources associated with the assistant. + :ivar tools: The list of tools associated with the assistant. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], id: Optional[str] = None + ): + super().__init__(version) + + self.account_sid: Optional[str] = payload.get("account_sid") + self.customer_ai: Optional[Dict[str, object]] = payload.get("customer_ai") + self.id: Optional[str] = payload.get("id") + self.model: Optional[str] = payload.get("model") + self.name: Optional[str] = payload.get("name") + self.owner: Optional[str] = payload.get("owner") + self.personality_prompt: Optional[str] = payload.get("personality_prompt") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.knowledge: Optional[List[str]] = payload.get("knowledge") + self.tools: Optional[List[str]] = payload.get("tools") + + self._solution = { + "id": id or self.id, + } + self._context: Optional[AssistantContext] = None + + @property + def _proxy(self) -> "AssistantContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: AssistantContext for this AssistantInstance + """ + if self._context is None: + self._context = AssistantContext( + self._version, + id=self._solution["id"], + ) + return self._context + + def delete(self) -> bool: + """ + Deletes the AssistantInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the AssistantInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def fetch(self) -> "AssistantInstance": + """ + Fetch the AssistantInstance + + + :returns: The fetched AssistantInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "AssistantInstance": + """ + Asynchronous coroutine to fetch the AssistantInstance + + + :returns: The fetched AssistantInstance + """ + return await self._proxy.fetch_async() + + def update( + self, + assistants_v1_service_update_assistant_request: Union[ + AssistantsV1ServiceUpdateAssistantRequest, object + ] = values.unset, + ) -> "AssistantInstance": + """ + Update the AssistantInstance + + :param assistants_v1_service_update_assistant_request: + + :returns: The updated AssistantInstance + """ + return self._proxy.update( + assistants_v1_service_update_assistant_request=assistants_v1_service_update_assistant_request, + ) + + async def update_async( + self, + assistants_v1_service_update_assistant_request: Union[ + AssistantsV1ServiceUpdateAssistantRequest, object + ] = values.unset, + ) -> "AssistantInstance": + """ + Asynchronous coroutine to update the AssistantInstance + + :param assistants_v1_service_update_assistant_request: + + :returns: The updated AssistantInstance + """ + return await self._proxy.update_async( + assistants_v1_service_update_assistant_request=assistants_v1_service_update_assistant_request, + ) + + @property + def feedbacks(self) -> FeedbackList: + """ + Access the feedbacks + """ + return self._proxy.feedbacks + + 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 AssistantContext(InstanceContext): + + def __init__(self, version: Version, id: str): + """ + Initialize the AssistantContext + + :param version: Version that contains the resource + :param id: + """ + super().__init__(version) + + # Path Solution + self._solution = { + "id": id, + } + self._uri = "/Assistants/{id}".format(**self._solution) + + self._feedbacks: Optional[FeedbackList] = None + + def delete(self) -> bool: + """ + Deletes the AssistantInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._version.delete( + method="DELETE", + uri=self._uri, + ) + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the AssistantInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._version.delete_async( + method="DELETE", + uri=self._uri, + ) + + def fetch(self) -> AssistantInstance: + """ + Fetch the AssistantInstance + + + :returns: The fetched AssistantInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return AssistantInstance( + self._version, + payload, + id=self._solution["id"], + ) + + async def fetch_async(self) -> AssistantInstance: + """ + Asynchronous coroutine to fetch the AssistantInstance + + + :returns: The fetched AssistantInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return AssistantInstance( + self._version, + payload, + id=self._solution["id"], + ) + + def update( + self, + assistants_v1_service_update_assistant_request: Union[ + AssistantsV1ServiceUpdateAssistantRequest, object + ] = values.unset, + ) -> AssistantInstance: + """ + Update the AssistantInstance + + :param assistants_v1_service_update_assistant_request: + + :returns: The updated AssistantInstance + """ + data = values.of({}) + headers = values.of( + { + "AssistantsV1ServiceUpdateAssistantRequest": assistants_v1_service_update_assistant_request, + } + ) + + payload = self._version.update( + method="PUT", uri=self._uri, data=data, headers=headers + ) + + return AssistantInstance(self._version, payload, id=self._solution["id"]) + + async def update_async( + self, + assistants_v1_service_update_assistant_request: Union[ + AssistantsV1ServiceUpdateAssistantRequest, object + ] = values.unset, + ) -> AssistantInstance: + """ + Asynchronous coroutine to update the AssistantInstance + + :param assistants_v1_service_update_assistant_request: + + :returns: The updated AssistantInstance + """ + data = values.of({}) + headers = values.of( + { + "AssistantsV1ServiceUpdateAssistantRequest": assistants_v1_service_update_assistant_request, + } + ) + + payload = await self._version.update_async( + method="PUT", uri=self._uri, data=data, headers=headers + ) + + return AssistantInstance(self._version, payload, id=self._solution["id"]) + + @property + def feedbacks(self) -> FeedbackList: + """ + Access the feedbacks + """ + if self._feedbacks is None: + self._feedbacks = FeedbackList( + self._version, + self._solution["id"], + ) + return self._feedbacks + + 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 AssistantPage(Page): + + def get_instance(self, payload: Dict[str, Any]) -> AssistantInstance: + """ + Build an instance of AssistantInstance + + :param payload: Payload response from the API + """ + return AssistantInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class AssistantList(ListResource): + + class AssistantsV1ServiceCreateAssistantRequest(object): + """ + :ivar customer_ai: + :ivar name: The name of the assistant. + :ivar owner: The owner/company of the assistant. + :ivar personality_prompt: The personality prompt to be used for assistant. + :ivar segment_credential: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.customer_ai: Optional[AssistantList.AssistantsV1ServiceCustomerAi] = ( + payload.get("customer_ai") + ) + self.name: Optional[str] = payload.get("name") + self.owner: Optional[str] = payload.get("owner") + self.personality_prompt: Optional[str] = payload.get("personality_prompt") + self.segment_credential: Optional[ + AssistantList.AssistantsV1ServiceSegmentCredential + ] = payload.get("segment_credential") + + def to_dict(self): + return { + "customer_ai": self.customer_ai.to_dict(), + "name": self.name, + "owner": self.owner, + "personality_prompt": self.personality_prompt, + "segment_credential": self.segment_credential.to_dict(), + } + + class AssistantsV1ServiceCustomerAi(object): + """ + :ivar perception_engine_enabled: True if the perception engine is enabled. + :ivar personalization_engine_enabled: True if the personalization engine is enabled. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.perception_engine_enabled: Optional[bool] = payload.get( + "perception_engine_enabled" + ) + self.personalization_engine_enabled: Optional[bool] = payload.get( + "personalization_engine_enabled" + ) + + def to_dict(self): + return { + "perception_engine_enabled": self.perception_engine_enabled, + "personalization_engine_enabled": self.personalization_engine_enabled, + } + + class AssistantsV1ServiceSegmentCredential(object): + """ + :ivar profile_api_key: The profile API key. + :ivar space_id: The space ID. + :ivar write_key: The write key. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.profile_api_key: Optional[str] = payload.get("profile_api_key") + self.space_id: Optional[str] = payload.get("space_id") + self.write_key: Optional[str] = payload.get("write_key") + + def to_dict(self): + return { + "profile_api_key": self.profile_api_key, + "space_id": self.space_id, + "write_key": self.write_key, + } + + class AssistantsV1ServiceUpdateAssistantRequest(object): + """ + :ivar customer_ai: + :ivar name: The name of the assistant. + :ivar owner: The owner/company of the assistant. + :ivar personality_prompt: The personality prompt to be used for assistant. + :ivar segment_credential: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.customer_ai: Optional[AssistantList.AssistantsV1ServiceCustomerAi] = ( + payload.get("customer_ai") + ) + self.name: Optional[str] = payload.get("name") + self.owner: Optional[str] = payload.get("owner") + self.personality_prompt: Optional[str] = payload.get("personality_prompt") + self.segment_credential: Optional[ + AssistantList.AssistantsV1ServiceSegmentCredential + ] = payload.get("segment_credential") + + def to_dict(self): + return { + "customer_ai": self.customer_ai.to_dict(), + "name": self.name, + "owner": self.owner, + "personality_prompt": self.personality_prompt, + "segment_credential": self.segment_credential.to_dict(), + } + + def __init__(self, version: Version): + """ + Initialize the AssistantList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/Assistants" + + def create( + self, + assistants_v1_service_create_assistant_request: AssistantsV1ServiceCreateAssistantRequest, + ) -> AssistantInstance: + """ + Create the AssistantInstance + + :param assistants_v1_service_create_assistant_request: + + :returns: The created AssistantInstance + """ + data = assistants_v1_service_create_assistant_request.to_dict() + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return AssistantInstance(self._version, payload) + + async def create_async( + self, + assistants_v1_service_create_assistant_request: AssistantsV1ServiceCreateAssistantRequest, + ) -> AssistantInstance: + """ + Asynchronously create the AssistantInstance + + :param assistants_v1_service_create_assistant_request: + + :returns: The created AssistantInstance + """ + data = assistants_v1_service_create_assistant_request.to_dict() + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return AssistantInstance(self._version, payload) + + def stream( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[AssistantInstance]: + """ + Streams AssistantInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = self.page(page_size=limits["page_size"]) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[AssistantInstance]: + """ + Asynchronously streams AssistantInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = await self.page_async(page_size=limits["page_size"]) + + return self._version.stream_async(page, limits["limit"]) + + def list( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[AssistantInstance]: + """ + Lists AssistantInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return list( + self.stream( + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[AssistantInstance]: + """ + Asynchronously lists AssistantInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return [ + record + async for record in await self.stream_async( + limit=limit, + page_size=page_size, + ) + ] + + def page( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> AssistantPage: + """ + Retrieve a single page of AssistantInstance records from the API. + Request is executed immediately + + :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 + + :returns: Page of AssistantInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = self._version.page(method="GET", uri=self._uri, params=data) + return AssistantPage(self._version, response) + + async def page_async( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> AssistantPage: + """ + Asynchronously retrieve a single page of AssistantInstance records from the API. + Request is executed immediately + + :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 + + :returns: Page of AssistantInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = await self._version.page_async( + method="GET", uri=self._uri, params=data + ) + return AssistantPage(self._version, response) + + def get_page(self, target_url: str) -> AssistantPage: + """ + Retrieve a specific page of AssistantInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of AssistantInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return AssistantPage(self._version, response) + + async def get_page_async(self, target_url: str) -> AssistantPage: + """ + Asynchronously retrieve a specific page of AssistantInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of AssistantInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return AssistantPage(self._version, response) + + def get(self, id: str) -> AssistantContext: + """ + Constructs a AssistantContext + + :param id: + """ + return AssistantContext(self._version, id=id) + + def __call__(self, id: str) -> AssistantContext: + """ + Constructs a AssistantContext + + :param id: + """ + return AssistantContext(self._version, id=id) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/assistants/v1/assistant/feedback.py b/twilio/rest/assistants/v1/assistant/feedback.py new file mode 100644 index 0000000000..63a6d3b6b2 --- /dev/null +++ b/twilio/rest/assistants/v1/assistant/feedback.py @@ -0,0 +1,364 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Assistants + 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 datetime import datetime +from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator +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 +from twilio.base.page import Page + + +class FeedbackInstance(InstanceResource): + """ + :ivar assistant_id: The Assistant ID. + :ivar id: The Feedback ID. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Feedback. + :ivar user_sid: The SID of the User created the Feedback. + :ivar message_id: The Message ID. + :ivar score: The Score to provide as Feedback (0-1) + :ivar session_id: The Session ID. + :ivar text: The text to be given as feedback. + :ivar date_created: The date and time in GMT when the Feedback was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date and time in GMT when the Feedback was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], id: str): + super().__init__(version) + + self.assistant_id: Optional[str] = payload.get("assistant_id") + self.id: Optional[str] = payload.get("id") + self.account_sid: Optional[str] = payload.get("account_sid") + self.user_sid: Optional[str] = payload.get("user_sid") + self.message_id: Optional[str] = payload.get("message_id") + self.score: Optional[float] = payload.get("score") + self.session_id: Optional[str] = payload.get("session_id") + self.text: Optional[str] = payload.get("text") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + + self._solution = { + "id": id, + } + + 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 FeedbackPage(Page): + + def get_instance(self, payload: Dict[str, Any]) -> FeedbackInstance: + """ + Build an instance of FeedbackInstance + + :param payload: Payload response from the API + """ + return FeedbackInstance(self._version, payload, id=self._solution["id"]) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class FeedbackList(ListResource): + + class AssistantsV1ServiceCreateFeedbackRequest(object): + """ + :ivar message_id: The message ID. + :ivar score: The score to be given(0-1). + :ivar session_id: The Session ID. + :ivar text: The text to be given as feedback. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.message_id: Optional[str] = payload.get("message_id") + self.score: Optional[float] = payload.get("score") + self.session_id: Optional[str] = payload.get("session_id") + self.text: Optional[str] = payload.get("text") + + def to_dict(self): + return { + "message_id": self.message_id, + "score": self.score, + "session_id": self.session_id, + "text": self.text, + } + + def __init__(self, version: Version, id: str): + """ + Initialize the FeedbackList + + :param version: Version that contains the resource + :param id: The assistant ID. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "id": id, + } + self._uri = "/Assistants/{id}/Feedbacks".format(**self._solution) + + def create( + self, + assistants_v1_service_create_feedback_request: AssistantsV1ServiceCreateFeedbackRequest, + ) -> FeedbackInstance: + """ + Create the FeedbackInstance + + :param assistants_v1_service_create_feedback_request: + + :returns: The created FeedbackInstance + """ + data = assistants_v1_service_create_feedback_request.to_dict() + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return FeedbackInstance(self._version, payload, id=self._solution["id"]) + + async def create_async( + self, + assistants_v1_service_create_feedback_request: AssistantsV1ServiceCreateFeedbackRequest, + ) -> FeedbackInstance: + """ + Asynchronously create the FeedbackInstance + + :param assistants_v1_service_create_feedback_request: + + :returns: The created FeedbackInstance + """ + data = assistants_v1_service_create_feedback_request.to_dict() + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return FeedbackInstance(self._version, payload, id=self._solution["id"]) + + def stream( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[FeedbackInstance]: + """ + Streams FeedbackInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = self.page(page_size=limits["page_size"]) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[FeedbackInstance]: + """ + Asynchronously streams FeedbackInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = await self.page_async(page_size=limits["page_size"]) + + return self._version.stream_async(page, limits["limit"]) + + def list( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[FeedbackInstance]: + """ + Lists FeedbackInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return list( + self.stream( + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[FeedbackInstance]: + """ + Asynchronously lists FeedbackInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return [ + record + async for record in await self.stream_async( + limit=limit, + page_size=page_size, + ) + ] + + def page( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> FeedbackPage: + """ + Retrieve a single page of FeedbackInstance records from the API. + Request is executed immediately + + :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 + + :returns: Page of FeedbackInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = self._version.page(method="GET", uri=self._uri, params=data) + return FeedbackPage(self._version, response, self._solution) + + async def page_async( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> FeedbackPage: + """ + Asynchronously retrieve a single page of FeedbackInstance records from the API. + Request is executed immediately + + :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 + + :returns: Page of FeedbackInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = await self._version.page_async( + method="GET", uri=self._uri, params=data + ) + return FeedbackPage(self._version, response, self._solution) + + def get_page(self, target_url: str) -> FeedbackPage: + """ + Retrieve a specific page of FeedbackInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of FeedbackInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return FeedbackPage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> FeedbackPage: + """ + Asynchronously retrieve a specific page of FeedbackInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of FeedbackInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return FeedbackPage(self._version, response, self._solution) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/assistants/v1/knowledge/__init__.py b/twilio/rest/assistants/v1/knowledge/__init__.py new file mode 100644 index 0000000000..32b17e2353 --- /dev/null +++ b/twilio/rest/assistants/v1/knowledge/__init__.py @@ -0,0 +1,712 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Assistants + 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 datetime import datetime +from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator +from twilio.base import deserialize, values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version +from twilio.base.page import Page +from twilio.rest.assistants.v1.knowledge.chunk import ChunkList + + +class KnowledgeInstance(InstanceResource): + """ + :ivar description: The type of knowledge source. + :ivar id: The description of knowledge. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Knowledge resource. + :ivar knowledge_source_details: The details of the knowledge source based on the type. + :ivar name: The name of the knowledge source. + :ivar status: The status of processing the knowledge source ('QUEUED', 'PROCESSING', 'COMPLETED', 'FAILED') + :ivar type: The type of knowledge source ('Web', 'Database', 'Text', 'File') + :ivar date_created: The date and time in GMT when the Knowledge was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date and time in GMT when the Knowledge was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], id: Optional[str] = None + ): + super().__init__(version) + + self.description: Optional[str] = payload.get("description") + self.id: Optional[str] = payload.get("id") + self.account_sid: Optional[str] = payload.get("account_sid") + self.knowledge_source_details: Optional[Dict[str, object]] = payload.get( + "knowledge_source_details" + ) + self.name: Optional[str] = payload.get("name") + self.status: Optional[str] = payload.get("status") + self.type: Optional[str] = payload.get("type") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + + self._solution = { + "id": id or self.id, + } + self._context: Optional[KnowledgeContext] = None + + @property + def _proxy(self) -> "KnowledgeContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: KnowledgeContext for this KnowledgeInstance + """ + if self._context is None: + self._context = KnowledgeContext( + self._version, + id=self._solution["id"], + ) + return self._context + + def delete(self) -> bool: + """ + Deletes the KnowledgeInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the KnowledgeInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def fetch(self) -> "KnowledgeInstance": + """ + Fetch the KnowledgeInstance + + + :returns: The fetched KnowledgeInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "KnowledgeInstance": + """ + Asynchronous coroutine to fetch the KnowledgeInstance + + + :returns: The fetched KnowledgeInstance + """ + return await self._proxy.fetch_async() + + def update( + self, + assistants_v1_service_update_knowledge_request: Union[ + AssistantsV1ServiceUpdateKnowledgeRequest, object + ] = values.unset, + ) -> "KnowledgeInstance": + """ + Update the KnowledgeInstance + + :param assistants_v1_service_update_knowledge_request: + + :returns: The updated KnowledgeInstance + """ + return self._proxy.update( + assistants_v1_service_update_knowledge_request=assistants_v1_service_update_knowledge_request, + ) + + async def update_async( + self, + assistants_v1_service_update_knowledge_request: Union[ + AssistantsV1ServiceUpdateKnowledgeRequest, object + ] = values.unset, + ) -> "KnowledgeInstance": + """ + Asynchronous coroutine to update the KnowledgeInstance + + :param assistants_v1_service_update_knowledge_request: + + :returns: The updated KnowledgeInstance + """ + return await self._proxy.update_async( + assistants_v1_service_update_knowledge_request=assistants_v1_service_update_knowledge_request, + ) + + @property + def chunks(self) -> ChunkList: + """ + Access the chunks + """ + return self._proxy.chunks + + 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 KnowledgeContext(InstanceContext): + + def __init__(self, version: Version, id: str): + """ + Initialize the KnowledgeContext + + :param version: Version that contains the resource + :param id: + """ + super().__init__(version) + + # Path Solution + self._solution = { + "id": id, + } + self._uri = "/Knowledge/{id}".format(**self._solution) + + self._chunks: Optional[ChunkList] = None + + def delete(self) -> bool: + """ + Deletes the KnowledgeInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._version.delete( + method="DELETE", + uri=self._uri, + ) + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the KnowledgeInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._version.delete_async( + method="DELETE", + uri=self._uri, + ) + + def fetch(self) -> KnowledgeInstance: + """ + Fetch the KnowledgeInstance + + + :returns: The fetched KnowledgeInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return KnowledgeInstance( + self._version, + payload, + id=self._solution["id"], + ) + + async def fetch_async(self) -> KnowledgeInstance: + """ + Asynchronous coroutine to fetch the KnowledgeInstance + + + :returns: The fetched KnowledgeInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return KnowledgeInstance( + self._version, + payload, + id=self._solution["id"], + ) + + def update( + self, + assistants_v1_service_update_knowledge_request: Union[ + AssistantsV1ServiceUpdateKnowledgeRequest, object + ] = values.unset, + ) -> KnowledgeInstance: + """ + Update the KnowledgeInstance + + :param assistants_v1_service_update_knowledge_request: + + :returns: The updated KnowledgeInstance + """ + data = values.of({}) + headers = values.of( + { + "AssistantsV1ServiceUpdateKnowledgeRequest": assistants_v1_service_update_knowledge_request, + } + ) + + payload = self._version.update( + method="PUT", uri=self._uri, data=data, headers=headers + ) + + return KnowledgeInstance(self._version, payload, id=self._solution["id"]) + + async def update_async( + self, + assistants_v1_service_update_knowledge_request: Union[ + AssistantsV1ServiceUpdateKnowledgeRequest, object + ] = values.unset, + ) -> KnowledgeInstance: + """ + Asynchronous coroutine to update the KnowledgeInstance + + :param assistants_v1_service_update_knowledge_request: + + :returns: The updated KnowledgeInstance + """ + data = values.of({}) + headers = values.of( + { + "AssistantsV1ServiceUpdateKnowledgeRequest": assistants_v1_service_update_knowledge_request, + } + ) + + payload = await self._version.update_async( + method="PUT", uri=self._uri, data=data, headers=headers + ) + + return KnowledgeInstance(self._version, payload, id=self._solution["id"]) + + @property + def chunks(self) -> ChunkList: + """ + Access the chunks + """ + if self._chunks is None: + self._chunks = ChunkList( + self._version, + self._solution["id"], + ) + return self._chunks + + 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 KnowledgePage(Page): + + def get_instance(self, payload: Dict[str, Any]) -> KnowledgeInstance: + """ + Build an instance of KnowledgeInstance + + :param payload: Payload response from the API + """ + return KnowledgeInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class KnowledgeList(ListResource): + + class AssistantsV1ServiceCreateKnowledgeRequest(object): + """ + :ivar assistant_id: The Assistant ID. + :ivar description: The description of the knowledge source. + :ivar knowledge_source_details: The details of the knowledge source based on the type. + :ivar name: The name of the tool. + :ivar policy: + :ivar type: The type of the knowledge source. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.assistant_id: Optional[str] = payload.get("assistant_id") + self.description: Optional[str] = payload.get("description") + self.knowledge_source_details: Optional[Dict[str, object]] = payload.get( + "knowledge_source_details" + ) + self.name: Optional[str] = payload.get("name") + self.policy: Optional[ + KnowledgeList.AssistantsV1ServiceCreatePolicyRequest + ] = payload.get("policy") + self.type: Optional[str] = payload.get("type") + + def to_dict(self): + return { + "assistant_id": self.assistant_id, + "description": self.description, + "knowledge_source_details": self.knowledge_source_details, + "name": self.name, + "policy": self.policy.to_dict(), + "type": self.type, + } + + class AssistantsV1ServiceCreatePolicyRequest(object): + """ + :ivar description: The description of the policy. + :ivar id: The Policy ID. + :ivar name: The name of the policy. + :ivar policy_details: + :ivar type: The description of the policy. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.description: Optional[str] = payload.get("description") + self.id: Optional[str] = payload.get("id") + self.name: Optional[str] = payload.get("name") + self.policy_details: Optional[Dict[str, object]] = payload.get( + "policy_details" + ) + self.type: Optional[str] = payload.get("type") + + def to_dict(self): + return { + "description": self.description, + "id": self.id, + "name": self.name, + "policy_details": self.policy_details, + "type": self.type, + } + + class AssistantsV1ServiceUpdateKnowledgeRequest(object): + """ + :ivar description: The description of the knowledge source. + :ivar knowledge_source_details: The details of the knowledge source based on the type. + :ivar name: The name of the knowledge source. + :ivar policy: + :ivar type: The description of the knowledge source. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.description: Optional[str] = payload.get("description") + self.knowledge_source_details: Optional[Dict[str, object]] = payload.get( + "knowledge_source_details" + ) + self.name: Optional[str] = payload.get("name") + self.policy: Optional[ + KnowledgeList.AssistantsV1ServiceCreatePolicyRequest + ] = payload.get("policy") + self.type: Optional[str] = payload.get("type") + + def to_dict(self): + return { + "description": self.description, + "knowledge_source_details": self.knowledge_source_details, + "name": self.name, + "policy": self.policy.to_dict(), + "type": self.type, + } + + def __init__(self, version: Version): + """ + Initialize the KnowledgeList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/Knowledge" + + def create( + self, + assistants_v1_service_create_knowledge_request: AssistantsV1ServiceCreateKnowledgeRequest, + ) -> KnowledgeInstance: + """ + Create the KnowledgeInstance + + :param assistants_v1_service_create_knowledge_request: + + :returns: The created KnowledgeInstance + """ + data = assistants_v1_service_create_knowledge_request.to_dict() + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return KnowledgeInstance(self._version, payload) + + async def create_async( + self, + assistants_v1_service_create_knowledge_request: AssistantsV1ServiceCreateKnowledgeRequest, + ) -> KnowledgeInstance: + """ + Asynchronously create the KnowledgeInstance + + :param assistants_v1_service_create_knowledge_request: + + :returns: The created KnowledgeInstance + """ + data = assistants_v1_service_create_knowledge_request.to_dict() + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return KnowledgeInstance(self._version, payload) + + def stream( + self, + assistant_id: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[KnowledgeInstance]: + """ + Streams KnowledgeInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param str assistant_id: + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = self.page(assistant_id=assistant_id, page_size=limits["page_size"]) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + assistant_id: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[KnowledgeInstance]: + """ + Asynchronously streams KnowledgeInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param str assistant_id: + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = await self.page_async( + assistant_id=assistant_id, page_size=limits["page_size"] + ) + + return self._version.stream_async(page, limits["limit"]) + + def list( + self, + assistant_id: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[KnowledgeInstance]: + """ + Lists KnowledgeInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str assistant_id: + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return list( + self.stream( + assistant_id=assistant_id, + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + assistant_id: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[KnowledgeInstance]: + """ + Asynchronously lists KnowledgeInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str assistant_id: + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return [ + record + async for record in await self.stream_async( + assistant_id=assistant_id, + limit=limit, + page_size=page_size, + ) + ] + + def page( + self, + assistant_id: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> KnowledgePage: + """ + Retrieve a single page of KnowledgeInstance records from the API. + Request is executed immediately + + :param assistant_id: + :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 + + :returns: Page of KnowledgeInstance + """ + data = values.of( + { + "AssistantId": assistant_id, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = self._version.page(method="GET", uri=self._uri, params=data) + return KnowledgePage(self._version, response) + + async def page_async( + self, + assistant_id: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> KnowledgePage: + """ + Asynchronously retrieve a single page of KnowledgeInstance records from the API. + Request is executed immediately + + :param assistant_id: + :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 + + :returns: Page of KnowledgeInstance + """ + data = values.of( + { + "AssistantId": assistant_id, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = await self._version.page_async( + method="GET", uri=self._uri, params=data + ) + return KnowledgePage(self._version, response) + + def get_page(self, target_url: str) -> KnowledgePage: + """ + Retrieve a specific page of KnowledgeInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of KnowledgeInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return KnowledgePage(self._version, response) + + async def get_page_async(self, target_url: str) -> KnowledgePage: + """ + Asynchronously retrieve a specific page of KnowledgeInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of KnowledgeInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return KnowledgePage(self._version, response) + + def get(self, id: str) -> KnowledgeContext: + """ + Constructs a KnowledgeContext + + :param id: + """ + return KnowledgeContext(self._version, id=id) + + def __call__(self, id: str) -> KnowledgeContext: + """ + Constructs a KnowledgeContext + + :param id: + """ + return KnowledgeContext(self._version, id=id) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/assistants/v1/knowledge/chunk.py b/twilio/rest/assistants/v1/knowledge/chunk.py new file mode 100644 index 0000000000..29e1a34945 --- /dev/null +++ b/twilio/rest/assistants/v1/knowledge/chunk.py @@ -0,0 +1,287 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Assistants + 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 datetime import datetime +from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator +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 +from twilio.base.page import Page + + +class ChunkInstance(InstanceResource): + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Knowledge resource. + :ivar content: The chunk content. + :ivar metadata: The metadata of the chunk. + :ivar date_created: The date and time in GMT when the Chunk was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date and time in GMT when the Chunk was updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], id: str): + super().__init__(version) + + self.account_sid: Optional[str] = payload.get("account_sid") + self.content: Optional[str] = payload.get("content") + self.metadata: Optional[Dict[str, object]] = payload.get("metadata") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + + self._solution = { + "id": id, + } + + 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 ChunkPage(Page): + + def get_instance(self, payload: Dict[str, Any]) -> ChunkInstance: + """ + Build an instance of ChunkInstance + + :param payload: Payload response from the API + """ + return ChunkInstance(self._version, payload, id=self._solution["id"]) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class ChunkList(ListResource): + + def __init__(self, version: Version, id: str): + """ + Initialize the ChunkList + + :param version: Version that contains the resource + :param id: The knowledge ID. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "id": id, + } + self._uri = "/Knowledge/{id}/Chunks".format(**self._solution) + + def stream( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[ChunkInstance]: + """ + Streams ChunkInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = self.page(page_size=limits["page_size"]) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[ChunkInstance]: + """ + Asynchronously streams ChunkInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = await self.page_async(page_size=limits["page_size"]) + + return self._version.stream_async(page, limits["limit"]) + + def list( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[ChunkInstance]: + """ + Lists ChunkInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return list( + self.stream( + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[ChunkInstance]: + """ + Asynchronously lists ChunkInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return [ + record + async for record in await self.stream_async( + limit=limit, + page_size=page_size, + ) + ] + + def page( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ChunkPage: + """ + Retrieve a single page of ChunkInstance records from the API. + Request is executed immediately + + :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 + + :returns: Page of ChunkInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = self._version.page(method="GET", uri=self._uri, params=data) + return ChunkPage(self._version, response, self._solution) + + async def page_async( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ChunkPage: + """ + Asynchronously retrieve a single page of ChunkInstance records from the API. + Request is executed immediately + + :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 + + :returns: Page of ChunkInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = await self._version.page_async( + method="GET", uri=self._uri, params=data + ) + return ChunkPage(self._version, response, self._solution) + + def get_page(self, target_url: str) -> ChunkPage: + """ + Retrieve a specific page of ChunkInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of ChunkInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return ChunkPage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> ChunkPage: + """ + Asynchronously retrieve a specific page of ChunkInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of ChunkInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return ChunkPage(self._version, response, self._solution) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/assistants/v1/policy.py b/twilio/rest/assistants/v1/policy.py new file mode 100644 index 0000000000..c63eee2e2f --- /dev/null +++ b/twilio/rest/assistants/v1/policy.py @@ -0,0 +1,322 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Assistants + 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 datetime import datetime +from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator +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 +from twilio.base.page import Page + + +class PolicyInstance(InstanceResource): + """ + :ivar id: The Policy ID. + :ivar name: The name of the policy. + :ivar description: The description of the policy. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Policy resource. + :ivar user_sid: The SID of the User that created the Policy resource. + :ivar type: The type of the policy. + :ivar policy_details: The details of the policy based on the type. + :ivar date_created: The date and time in GMT when the Policy was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date and time in GMT when the Policy was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) + + self.id: Optional[str] = payload.get("id") + self.name: Optional[str] = payload.get("name") + self.description: Optional[str] = payload.get("description") + self.account_sid: Optional[str] = payload.get("account_sid") + self.user_sid: Optional[str] = payload.get("user_sid") + self.type: Optional[str] = payload.get("type") + self.policy_details: Optional[Dict[str, object]] = payload.get("policy_details") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "" + + +class PolicyPage(Page): + + def get_instance(self, payload: Dict[str, Any]) -> PolicyInstance: + """ + Build an instance of PolicyInstance + + :param payload: Payload response from the API + """ + return PolicyInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class PolicyList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the PolicyList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/Policies" + + def stream( + self, + tool_id: Union[str, object] = values.unset, + knowledge_id: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[PolicyInstance]: + """ + Streams PolicyInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param str tool_id: The tool ID. + :param str knowledge_id: The knowledge ID. + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = self.page( + tool_id=tool_id, knowledge_id=knowledge_id, page_size=limits["page_size"] + ) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + tool_id: Union[str, object] = values.unset, + knowledge_id: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[PolicyInstance]: + """ + Asynchronously streams PolicyInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param str tool_id: The tool ID. + :param str knowledge_id: The knowledge ID. + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = await self.page_async( + tool_id=tool_id, knowledge_id=knowledge_id, page_size=limits["page_size"] + ) + + return self._version.stream_async(page, limits["limit"]) + + def list( + self, + tool_id: Union[str, object] = values.unset, + knowledge_id: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[PolicyInstance]: + """ + Lists PolicyInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str tool_id: The tool ID. + :param str knowledge_id: The knowledge ID. + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return list( + self.stream( + tool_id=tool_id, + knowledge_id=knowledge_id, + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + tool_id: Union[str, object] = values.unset, + knowledge_id: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[PolicyInstance]: + """ + Asynchronously lists PolicyInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str tool_id: The tool ID. + :param str knowledge_id: The knowledge ID. + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return [ + record + async for record in await self.stream_async( + tool_id=tool_id, + knowledge_id=knowledge_id, + limit=limit, + page_size=page_size, + ) + ] + + def page( + self, + tool_id: Union[str, object] = values.unset, + knowledge_id: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> PolicyPage: + """ + Retrieve a single page of PolicyInstance records from the API. + Request is executed immediately + + :param tool_id: The tool ID. + :param knowledge_id: The knowledge ID. + :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 + + :returns: Page of PolicyInstance + """ + data = values.of( + { + "ToolId": tool_id, + "KnowledgeId": knowledge_id, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = self._version.page(method="GET", uri=self._uri, params=data) + return PolicyPage(self._version, response) + + async def page_async( + self, + tool_id: Union[str, object] = values.unset, + knowledge_id: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> PolicyPage: + """ + Asynchronously retrieve a single page of PolicyInstance records from the API. + Request is executed immediately + + :param tool_id: The tool ID. + :param knowledge_id: The knowledge ID. + :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 + + :returns: Page of PolicyInstance + """ + data = values.of( + { + "ToolId": tool_id, + "KnowledgeId": knowledge_id, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = await self._version.page_async( + method="GET", uri=self._uri, params=data + ) + return PolicyPage(self._version, response) + + def get_page(self, target_url: str) -> PolicyPage: + """ + Retrieve a specific page of PolicyInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of PolicyInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return PolicyPage(self._version, response) + + async def get_page_async(self, target_url: str) -> PolicyPage: + """ + Asynchronously retrieve a specific page of PolicyInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of PolicyInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return PolicyPage(self._version, response) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/assistants/v1/session/__init__.py b/twilio/rest/assistants/v1/session/__init__.py new file mode 100644 index 0000000000..1faf9c9174 --- /dev/null +++ b/twilio/rest/assistants/v1/session/__init__.py @@ -0,0 +1,425 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Assistants + 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 datetime import datetime +from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator +from twilio.base import deserialize, values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version +from twilio.base.page import Page +from twilio.rest.assistants.v1.session.message import MessageList + + +class SessionInstance(InstanceResource): + """ + :ivar id: The Session ID. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Session resource. + :ivar assistant_id: The Assistant ID. + :ivar verified: True if the session is verified. + :ivar identity: The unique identity of user for the session. + :ivar date_created: The date and time in GMT when the Session was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date and time in GMT when the Session was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], id: Optional[str] = None + ): + super().__init__(version) + + self.id: Optional[str] = payload.get("id") + self.account_sid: Optional[str] = payload.get("account_sid") + self.assistant_id: Optional[str] = payload.get("assistant_id") + self.verified: Optional[bool] = payload.get("verified") + self.identity: Optional[str] = payload.get("identity") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + + self._solution = { + "id": id or self.id, + } + self._context: Optional[SessionContext] = None + + @property + def _proxy(self) -> "SessionContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: SessionContext for this SessionInstance + """ + if self._context is None: + self._context = SessionContext( + self._version, + id=self._solution["id"], + ) + return self._context + + def fetch(self) -> "SessionInstance": + """ + Fetch the SessionInstance + + + :returns: The fetched SessionInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "SessionInstance": + """ + Asynchronous coroutine to fetch the SessionInstance + + + :returns: The fetched SessionInstance + """ + return await self._proxy.fetch_async() + + @property + def messages(self) -> MessageList: + """ + Access the messages + """ + return self._proxy.messages + + 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 SessionContext(InstanceContext): + + def __init__(self, version: Version, id: str): + """ + Initialize the SessionContext + + :param version: Version that contains the resource + :param id: + """ + super().__init__(version) + + # Path Solution + self._solution = { + "id": id, + } + self._uri = "/Sessions/{id}".format(**self._solution) + + self._messages: Optional[MessageList] = None + + def fetch(self) -> SessionInstance: + """ + Fetch the SessionInstance + + + :returns: The fetched SessionInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return SessionInstance( + self._version, + payload, + id=self._solution["id"], + ) + + async def fetch_async(self) -> SessionInstance: + """ + Asynchronous coroutine to fetch the SessionInstance + + + :returns: The fetched SessionInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return SessionInstance( + self._version, + payload, + id=self._solution["id"], + ) + + @property + def messages(self) -> MessageList: + """ + Access the messages + """ + if self._messages is None: + self._messages = MessageList( + self._version, + self._solution["id"], + ) + return self._messages + + 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 SessionPage(Page): + + def get_instance(self, payload: Dict[str, Any]) -> SessionInstance: + """ + Build an instance of SessionInstance + + :param payload: Payload response from the API + """ + return SessionInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class SessionList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the SessionList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/Sessions" + + def stream( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[SessionInstance]: + """ + Streams SessionInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = self.page(page_size=limits["page_size"]) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[SessionInstance]: + """ + Asynchronously streams SessionInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = await self.page_async(page_size=limits["page_size"]) + + return self._version.stream_async(page, limits["limit"]) + + def list( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[SessionInstance]: + """ + Lists SessionInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return list( + self.stream( + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[SessionInstance]: + """ + Asynchronously lists SessionInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return [ + record + async for record in await self.stream_async( + limit=limit, + page_size=page_size, + ) + ] + + def page( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> SessionPage: + """ + Retrieve a single page of SessionInstance records from the API. + Request is executed immediately + + :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 + + :returns: Page of SessionInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = self._version.page(method="GET", uri=self._uri, params=data) + return SessionPage(self._version, response) + + async def page_async( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> SessionPage: + """ + Asynchronously retrieve a single page of SessionInstance records from the API. + Request is executed immediately + + :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 + + :returns: Page of SessionInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = await self._version.page_async( + method="GET", uri=self._uri, params=data + ) + return SessionPage(self._version, response) + + def get_page(self, target_url: str) -> SessionPage: + """ + Retrieve a specific page of SessionInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of SessionInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return SessionPage(self._version, response) + + async def get_page_async(self, target_url: str) -> SessionPage: + """ + Asynchronously retrieve a specific page of SessionInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of SessionInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return SessionPage(self._version, response) + + def get(self, id: str) -> SessionContext: + """ + Constructs a SessionContext + + :param id: + """ + return SessionContext(self._version, id=id) + + def __call__(self, id: str) -> SessionContext: + """ + Constructs a SessionContext + + :param id: + """ + return SessionContext(self._version, id=id) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/assistants/v1/session/message.py b/twilio/rest/assistants/v1/session/message.py new file mode 100644 index 0000000000..b2d2921dfb --- /dev/null +++ b/twilio/rest/assistants/v1/session/message.py @@ -0,0 +1,299 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Assistants + 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 datetime import datetime +from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator +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 +from twilio.base.page import Page + + +class MessageInstance(InstanceResource): + """ + :ivar id: The message ID. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Message resource. + :ivar assistant_id: The Assistant ID. + :ivar session_id: The Session ID. + :ivar identity: The identity of the user. + :ivar role: The role of the user associated with the message. + :ivar content: The content of the message. + :ivar meta: The metadata of the message. + :ivar date_created: The date and time in GMT when the Message was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date and time in GMT when the Message was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], session_id: str): + super().__init__(version) + + self.id: Optional[str] = payload.get("id") + self.account_sid: Optional[str] = payload.get("account_sid") + self.assistant_id: Optional[str] = payload.get("assistant_id") + self.session_id: Optional[str] = payload.get("session_id") + self.identity: Optional[str] = payload.get("identity") + self.role: Optional[str] = payload.get("role") + self.content: Optional[Dict[str, object]] = payload.get("content") + self.meta: Optional[Dict[str, object]] = payload.get("meta") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + + self._solution = { + "session_id": session_id, + } + + 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 MessagePage(Page): + + def get_instance(self, payload: Dict[str, Any]) -> MessageInstance: + """ + Build an instance of MessageInstance + + :param payload: Payload response from the API + """ + return MessageInstance( + self._version, payload, session_id=self._solution["session_id"] + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class MessageList(ListResource): + + def __init__(self, version: Version, session_id: str): + """ + Initialize the MessageList + + :param version: Version that contains the resource + :param session_id: Session id or name + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "session_id": session_id, + } + self._uri = "/Sessions/{session_id}/Messages".format(**self._solution) + + def stream( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[MessageInstance]: + """ + Streams MessageInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = self.page(page_size=limits["page_size"]) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[MessageInstance]: + """ + Asynchronously streams MessageInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = await self.page_async(page_size=limits["page_size"]) + + return self._version.stream_async(page, limits["limit"]) + + def list( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[MessageInstance]: + """ + Lists MessageInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return list( + self.stream( + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[MessageInstance]: + """ + Asynchronously lists MessageInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return [ + record + async for record in await self.stream_async( + limit=limit, + page_size=page_size, + ) + ] + + def page( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> MessagePage: + """ + Retrieve a single page of MessageInstance records from the API. + Request is executed immediately + + :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 + + :returns: Page of MessageInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = self._version.page(method="GET", uri=self._uri, params=data) + return MessagePage(self._version, response, self._solution) + + async def page_async( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> MessagePage: + """ + Asynchronously retrieve a single page of MessageInstance records from the API. + Request is executed immediately + + :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 + + :returns: Page of MessageInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = await self._version.page_async( + method="GET", uri=self._uri, params=data + ) + return MessagePage(self._version, response, self._solution) + + def get_page(self, target_url: str) -> MessagePage: + """ + Retrieve a specific page of MessageInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of MessageInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return MessagePage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> MessagePage: + """ + Asynchronously retrieve a specific page of MessageInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of MessageInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return MessagePage(self._version, response, self._solution) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/assistants/v1/tool.py b/twilio/rest/assistants/v1/tool.py new file mode 100644 index 0000000000..a66a818b5d --- /dev/null +++ b/twilio/rest/assistants/v1/tool.py @@ -0,0 +1,639 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Assistants + 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 datetime import datetime +from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator +from twilio.base import deserialize, values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version +from twilio.base.page import Page + + +class ToolInstance(InstanceResource): + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Tool resource. + :ivar description: The description of the tool. + :ivar enabled: True if the tool is enabled. + :ivar id: The tool ID. + :ivar meta: The metadata related to method, url, input_schema to used with the Tool. + :ivar name: The name of the tool. + :ivar requires_auth: The authentication requirement for the tool. + :ivar type: The type of the tool. ('WEBHOOK') + :ivar date_created: The date and time in GMT when the Tool was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date and time in GMT when the Tool was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], id: Optional[str] = None + ): + super().__init__(version) + + self.account_sid: Optional[str] = payload.get("account_sid") + self.description: Optional[str] = payload.get("description") + self.enabled: Optional[bool] = payload.get("enabled") + self.id: Optional[str] = payload.get("id") + self.meta: Optional[Dict[str, object]] = payload.get("meta") + self.name: Optional[str] = payload.get("name") + self.requires_auth: Optional[bool] = payload.get("requires_auth") + self.type: Optional[str] = payload.get("type") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + + self._solution = { + "id": id or self.id, + } + self._context: Optional[ToolContext] = None + + @property + def _proxy(self) -> "ToolContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: ToolContext for this ToolInstance + """ + if self._context is None: + self._context = ToolContext( + self._version, + id=self._solution["id"], + ) + return self._context + + def delete(self) -> bool: + """ + Deletes the ToolInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the ToolInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def update( + self, + assistants_v1_service_update_tool_request: Union[ + AssistantsV1ServiceUpdateToolRequest, object + ] = values.unset, + ) -> "ToolInstance": + """ + Update the ToolInstance + + :param assistants_v1_service_update_tool_request: + + :returns: The updated ToolInstance + """ + return self._proxy.update( + assistants_v1_service_update_tool_request=assistants_v1_service_update_tool_request, + ) + + async def update_async( + self, + assistants_v1_service_update_tool_request: Union[ + AssistantsV1ServiceUpdateToolRequest, object + ] = values.unset, + ) -> "ToolInstance": + """ + Asynchronous coroutine to update the ToolInstance + + :param assistants_v1_service_update_tool_request: + + :returns: The updated ToolInstance + """ + return await self._proxy.update_async( + assistants_v1_service_update_tool_request=assistants_v1_service_update_tool_request, + ) + + 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 ToolContext(InstanceContext): + + def __init__(self, version: Version, id: str): + """ + Initialize the ToolContext + + :param version: Version that contains the resource + :param id: + """ + super().__init__(version) + + # Path Solution + self._solution = { + "id": id, + } + self._uri = "/Tools/{id}".format(**self._solution) + + def delete(self) -> bool: + """ + Deletes the ToolInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._version.delete( + method="DELETE", + uri=self._uri, + ) + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the ToolInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._version.delete_async( + method="DELETE", + uri=self._uri, + ) + + def update( + self, + assistants_v1_service_update_tool_request: Union[ + AssistantsV1ServiceUpdateToolRequest, object + ] = values.unset, + ) -> ToolInstance: + """ + Update the ToolInstance + + :param assistants_v1_service_update_tool_request: + + :returns: The updated ToolInstance + """ + data = values.of({}) + headers = values.of( + { + "AssistantsV1ServiceUpdateToolRequest": assistants_v1_service_update_tool_request, + } + ) + + payload = self._version.update( + method="PUT", uri=self._uri, data=data, headers=headers + ) + + return ToolInstance(self._version, payload, id=self._solution["id"]) + + async def update_async( + self, + assistants_v1_service_update_tool_request: Union[ + AssistantsV1ServiceUpdateToolRequest, object + ] = values.unset, + ) -> ToolInstance: + """ + Asynchronous coroutine to update the ToolInstance + + :param assistants_v1_service_update_tool_request: + + :returns: The updated ToolInstance + """ + data = values.of({}) + headers = values.of( + { + "AssistantsV1ServiceUpdateToolRequest": assistants_v1_service_update_tool_request, + } + ) + + payload = await self._version.update_async( + method="PUT", uri=self._uri, data=data, headers=headers + ) + + return ToolInstance(self._version, payload, id=self._solution["id"]) + + 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 ToolPage(Page): + + def get_instance(self, payload: Dict[str, Any]) -> ToolInstance: + """ + Build an instance of ToolInstance + + :param payload: Payload response from the API + """ + return ToolInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class ToolList(ListResource): + + class AssistantsV1ServiceCreatePolicyRequest(object): + """ + :ivar description: The description of the policy. + :ivar id: The Policy ID. + :ivar name: The name of the policy. + :ivar policy_details: + :ivar type: The description of the policy. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.description: Optional[str] = payload.get("description") + self.id: Optional[str] = payload.get("id") + self.name: Optional[str] = payload.get("name") + self.policy_details: Optional[Dict[str, object]] = payload.get( + "policy_details" + ) + self.type: Optional[str] = payload.get("type") + + def to_dict(self): + return { + "description": self.description, + "id": self.id, + "name": self.name, + "policy_details": self.policy_details, + "type": self.type, + } + + class AssistantsV1ServiceCreateToolRequest(object): + """ + :ivar assistant_id: The Assistant ID. + :ivar description: The description of the tool. + :ivar enabled: True if the tool is enabled. + :ivar meta: The metadata related to method, url, input_schema to used with the Tool. + :ivar name: The name of the tool. + :ivar policy: + :ivar type: The description of the tool. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.assistant_id: Optional[str] = payload.get("assistant_id") + self.description: Optional[str] = payload.get("description") + self.enabled: Optional[bool] = payload.get("enabled") + self.meta: Optional[Dict[str, object]] = payload.get("meta") + self.name: Optional[str] = payload.get("name") + self.policy: Optional[ToolList.AssistantsV1ServiceCreatePolicyRequest] = ( + payload.get("policy") + ) + self.type: Optional[str] = payload.get("type") + + def to_dict(self): + return { + "assistant_id": self.assistant_id, + "description": self.description, + "enabled": self.enabled, + "meta": self.meta, + "name": self.name, + "policy": self.policy.to_dict(), + "type": self.type, + } + + class AssistantsV1ServiceUpdateToolRequest(object): + """ + :ivar assistant_id: The Assistant ID. + :ivar description: The description of the tool. + :ivar enabled: True if the tool is enabled. + :ivar meta: The metadata related to method, url, input_schema to used with the Tool. + :ivar name: The name of the tool. + :ivar policy: + :ivar type: The type of the tool. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.assistant_id: Optional[str] = payload.get("assistant_id") + self.description: Optional[str] = payload.get("description") + self.enabled: Optional[bool] = payload.get("enabled") + self.meta: Optional[Dict[str, object]] = payload.get("meta") + self.name: Optional[str] = payload.get("name") + self.policy: Optional[ToolList.AssistantsV1ServiceCreatePolicyRequest] = ( + payload.get("policy") + ) + self.type: Optional[str] = payload.get("type") + + def to_dict(self): + return { + "assistant_id": self.assistant_id, + "description": self.description, + "enabled": self.enabled, + "meta": self.meta, + "name": self.name, + "policy": self.policy.to_dict(), + "type": self.type, + } + + def __init__(self, version: Version): + """ + Initialize the ToolList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/Tools" + + def create( + self, + assistants_v1_service_create_tool_request: AssistantsV1ServiceCreateToolRequest, + ) -> ToolInstance: + """ + Create the ToolInstance + + :param assistants_v1_service_create_tool_request: + + :returns: The created ToolInstance + """ + data = assistants_v1_service_create_tool_request.to_dict() + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return ToolInstance(self._version, payload) + + async def create_async( + self, + assistants_v1_service_create_tool_request: AssistantsV1ServiceCreateToolRequest, + ) -> ToolInstance: + """ + Asynchronously create the ToolInstance + + :param assistants_v1_service_create_tool_request: + + :returns: The created ToolInstance + """ + data = assistants_v1_service_create_tool_request.to_dict() + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return ToolInstance(self._version, payload) + + def stream( + self, + assistant_id: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[ToolInstance]: + """ + Streams ToolInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param str assistant_id: + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = self.page(assistant_id=assistant_id, page_size=limits["page_size"]) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + assistant_id: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[ToolInstance]: + """ + Asynchronously streams ToolInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param str assistant_id: + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = await self.page_async( + assistant_id=assistant_id, page_size=limits["page_size"] + ) + + return self._version.stream_async(page, limits["limit"]) + + def list( + self, + assistant_id: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[ToolInstance]: + """ + Lists ToolInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str assistant_id: + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return list( + self.stream( + assistant_id=assistant_id, + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + assistant_id: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[ToolInstance]: + """ + Asynchronously lists ToolInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str assistant_id: + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return [ + record + async for record in await self.stream_async( + assistant_id=assistant_id, + limit=limit, + page_size=page_size, + ) + ] + + def page( + self, + assistant_id: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ToolPage: + """ + Retrieve a single page of ToolInstance records from the API. + Request is executed immediately + + :param assistant_id: + :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 + + :returns: Page of ToolInstance + """ + data = values.of( + { + "AssistantId": assistant_id, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = self._version.page(method="GET", uri=self._uri, params=data) + return ToolPage(self._version, response) + + async def page_async( + self, + assistant_id: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ToolPage: + """ + Asynchronously retrieve a single page of ToolInstance records from the API. + Request is executed immediately + + :param assistant_id: + :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 + + :returns: Page of ToolInstance + """ + data = values.of( + { + "AssistantId": assistant_id, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = await self._version.page_async( + method="GET", uri=self._uri, params=data + ) + return ToolPage(self._version, response) + + def get_page(self, target_url: str) -> ToolPage: + """ + Retrieve a specific page of ToolInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of ToolInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return ToolPage(self._version, response) + + async def get_page_async(self, target_url: str) -> ToolPage: + """ + Asynchronously retrieve a specific page of ToolInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of ToolInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return ToolPage(self._version, response) + + def get(self, id: str) -> ToolContext: + """ + Constructs a ToolContext + + :param id: + """ + return ToolContext(self._version, id=id) + + def __call__(self, id: str) -> ToolContext: + """ + Constructs a ToolContext + + :param id: + """ + return ToolContext(self._version, id=id) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/content/v1/content/approval_fetch.py b/twilio/rest/content/v1/content/approval_fetch.py index f679a920a1..f35ef6a48f 100644 --- a/twilio/rest/content/v1/content/approval_fetch.py +++ b/twilio/rest/content/v1/content/approval_fetch.py @@ -27,7 +27,7 @@ class ApprovalFetchInstance(InstanceResource): :ivar url: The URL of the resource, relative to `https://content.twilio.com`. """ - def __init__(self, version: Version, payload: Dict[str, Any], content_sid: str): + def __init__(self, version: Version, payload: Dict[str, Any], sid: str): super().__init__(version) self.sid: Optional[str] = payload.get("sid") @@ -36,7 +36,7 @@ def __init__(self, version: Version, payload: Dict[str, Any], content_sid: str): self.url: Optional[str] = payload.get("url") self._solution = { - "content_sid": content_sid, + "sid": sid, } self._context: Optional[ApprovalFetchContext] = None @@ -51,7 +51,7 @@ def _proxy(self) -> "ApprovalFetchContext": if self._context is None: self._context = ApprovalFetchContext( self._version, - content_sid=self._solution["content_sid"], + sid=self._solution["sid"], ) return self._context @@ -85,20 +85,20 @@ def __repr__(self) -> str: class ApprovalFetchContext(InstanceContext): - def __init__(self, version: Version, content_sid: str): + def __init__(self, version: Version, sid: str): """ Initialize the ApprovalFetchContext :param version: Version that contains the resource - :param content_sid: The Twilio-provided string that uniquely identifies the Content resource whose approval information to fetch. + :param sid: The Twilio-provided string that uniquely identifies the Content resource whose approval information to fetch. """ super().__init__(version) # Path Solution self._solution = { - "content_sid": content_sid, + "sid": sid, } - self._uri = "/Content/{content_sid}/ApprovalRequests".format(**self._solution) + self._uri = "/Content/{sid}/ApprovalRequests".format(**self._solution) def fetch(self) -> ApprovalFetchInstance: """ @@ -116,7 +116,7 @@ def fetch(self) -> ApprovalFetchInstance: return ApprovalFetchInstance( self._version, payload, - content_sid=self._solution["content_sid"], + sid=self._solution["sid"], ) async def fetch_async(self) -> ApprovalFetchInstance: @@ -135,7 +135,7 @@ async def fetch_async(self) -> ApprovalFetchInstance: return ApprovalFetchInstance( self._version, payload, - content_sid=self._solution["content_sid"], + sid=self._solution["sid"], ) def __repr__(self) -> str: @@ -150,19 +150,19 @@ def __repr__(self) -> str: class ApprovalFetchList(ListResource): - def __init__(self, version: Version, content_sid: str): + def __init__(self, version: Version, sid: str): """ Initialize the ApprovalFetchList :param version: Version that contains the resource - :param content_sid: The Twilio-provided string that uniquely identifies the Content resource whose approval information to fetch. + :param sid: The Twilio-provided string that uniquely identifies the Content resource whose approval information to fetch. """ super().__init__(version) # Path Solution self._solution = { - "content_sid": content_sid, + "sid": sid, } def get(self) -> ApprovalFetchContext: @@ -170,18 +170,14 @@ def get(self) -> ApprovalFetchContext: Constructs a ApprovalFetchContext """ - return ApprovalFetchContext( - self._version, content_sid=self._solution["content_sid"] - ) + return ApprovalFetchContext(self._version, sid=self._solution["sid"]) def __call__(self) -> ApprovalFetchContext: """ Constructs a ApprovalFetchContext """ - return ApprovalFetchContext( - self._version, content_sid=self._solution["content_sid"] - ) + return ApprovalFetchContext(self._version, sid=self._solution["sid"]) def __repr__(self) -> str: """ diff --git a/twilio/rest/intelligence/v2/operator_type.py b/twilio/rest/intelligence/v2/operator_type.py index ff2403b1cb..f1f839fe79 100644 --- a/twilio/rest/intelligence/v2/operator_type.py +++ b/twilio/rest/intelligence/v2/operator_type.py @@ -27,8 +27,9 @@ class OperatorTypeInstance(InstanceResource): class Availability(object): INTERNAL = "internal" BETA = "beta" - PUBLIC = "public" + GENERAL_AVAILABILITY = "general-availability" RETIRED = "retired" + DEPRECATED = "deprecated" class OutputType(object): TEXT_CLASSIFICATION = "text-classification" diff --git a/twilio/rest/marketplace/v1/installed_add_on/installed_add_on_usage.py b/twilio/rest/marketplace/v1/installed_add_on/installed_add_on_usage.py index 7e44ac4e0e..47a9a7c13b 100644 --- a/twilio/rest/marketplace/v1/installed_add_on/installed_add_on_usage.py +++ b/twilio/rest/marketplace/v1/installed_add_on/installed_add_on_usage.py @@ -22,8 +22,8 @@ class InstalledAddOnUsageInstance(InstanceResource): """ + :ivar total_submitted: Total amount in local currency that was billed in this request. Aggregates all billable_items that were successfully submitted. :ivar billable_items: - :ivar total_submitted: Represents the total quantity submitted. """ def __init__( @@ -31,10 +31,12 @@ def __init__( ): super().__init__(version) - self.billable_items: Optional[List[str]] = payload.get("billable_items") self.total_submitted: Optional[float] = deserialize.decimal( payload.get("total_submitted") ) + self.billable_items: Optional[List[InstalledAddOnUsageList.str]] = payload.get( + "billable_items" + ) self._solution = { "installed_add_on_sid": installed_add_on_sid, @@ -54,11 +56,15 @@ class InstalledAddOnUsageList(ListResource): class MarketplaceV1InstalledAddOnInstalledAddOnUsage(object): """ + :ivar total_submitted: Total amount in local currency that was billed in this request. Aggregates all billable_items that were successfully submitted. :ivar billable_items: """ def __init__(self, payload: Dict[str, Any]): + self.total_submitted: Optional[float] = deserialize.decimal( + payload.get("total_submitted") + ) self.billable_items: Optional[ List[ InstalledAddOnUsageList.MarketplaceV1InstalledAddOnInstalledAddOnUsageBillableItems @@ -67,34 +73,18 @@ def __init__(self, payload: Dict[str, Any]): def to_dict(self): return { + "total_submitted": self.total_submitted, "billable_items": [ billable_items.to_dict() for billable_items in self.billable_items ], } - class MarketplaceV1InstalledAddOnInstalledAddOnUsageBillableItems(object): - """ - :ivar quantity: Any floating number greater than 0. - :ivar sid: BillingSid to use for billing. - """ - - def __init__(self, payload: Dict[str, Any]): - - self.quantity: Optional[float] = payload.get("quantity") - self.sid: Optional[str] = payload.get("sid") - - def to_dict(self): - return { - "quantity": self.quantity, - "sid": self.sid, - } - def __init__(self, version: Version, installed_add_on_sid: str): """ Initialize the InstalledAddOnUsageList :param version: Version that contains the resource - :param installed_add_on_sid: + :param installed_add_on_sid: Customer Installation SID to report usage on. """ super().__init__(version) diff --git a/twilio/rest/marketplace/v1/module_data_management.py b/twilio/rest/marketplace/v1/module_data_management.py index 837f5fc3f7..8ef224cec1 100644 --- a/twilio/rest/marketplace/v1/module_data_management.py +++ b/twilio/rest/marketplace/v1/module_data_management.py @@ -30,6 +30,7 @@ class ModuleDataManagementInstance(InstanceResource): :ivar module_info: A JSON object containing essential attributes that define a module. This information is presented on the Module detail page in the Twilio Marketplace Catalog. You can pass the following attributes in the JSON object :ivar documentation: A JSON object for providing comprehensive information, instructions, and resources related to the module :ivar configuration: A JSON object for providing listing specific configuration. Contains button setup, notification url, among others. + :ivar pricing: A JSON object for providing Listing specific pricing information. """ def __init__( @@ -45,6 +46,7 @@ def __init__( self.module_info: Optional[Dict[str, object]] = payload.get("module_info") self.documentation: Optional[Dict[str, object]] = payload.get("documentation") self.configuration: Optional[Dict[str, object]] = payload.get("configuration") + self.pricing: Optional[Dict[str, object]] = payload.get("pricing") self._solution = { "sid": sid or self.sid, @@ -92,16 +94,18 @@ def update( policies: Union[str, object] = values.unset, support: Union[str, object] = values.unset, configuration: Union[str, object] = values.unset, + pricing: Union[str, object] = values.unset, ) -> "ModuleDataManagementInstance": """ Update the ModuleDataManagementInstance - :param module_info: - :param description: - :param documentation: - :param policies: - :param support: - :param configuration: + :param module_info: A JSON object containing essential attributes that define a Listing. + :param description: A JSON object describing the Listing. You can define the main body of the description, highlight key features or aspects of the Listing, and provide code samples for developers if applicable. + :param documentation: A JSON object for providing comprehensive information, instructions, and resources related to the Listing. + :param policies: A JSON object describing the Listing's privacy and legal policies. The maximum file size for Policies is 5MB. + :param support: A JSON object containing information on how Marketplace users can obtain support for the Listing. Use this parameter to provide details such as contact information and support description. + :param configuration: A JSON object for providing Listing-specific configuration. Contains button setup, notification URL, and more. + :param pricing: A JSON object for providing Listing's purchase options. :returns: The updated ModuleDataManagementInstance """ @@ -112,6 +116,7 @@ def update( policies=policies, support=support, configuration=configuration, + pricing=pricing, ) async def update_async( @@ -122,16 +127,18 @@ async def update_async( policies: Union[str, object] = values.unset, support: Union[str, object] = values.unset, configuration: Union[str, object] = values.unset, + pricing: Union[str, object] = values.unset, ) -> "ModuleDataManagementInstance": """ Asynchronous coroutine to update the ModuleDataManagementInstance - :param module_info: - :param description: - :param documentation: - :param policies: - :param support: - :param configuration: + :param module_info: A JSON object containing essential attributes that define a Listing. + :param description: A JSON object describing the Listing. You can define the main body of the description, highlight key features or aspects of the Listing, and provide code samples for developers if applicable. + :param documentation: A JSON object for providing comprehensive information, instructions, and resources related to the Listing. + :param policies: A JSON object describing the Listing's privacy and legal policies. The maximum file size for Policies is 5MB. + :param support: A JSON object containing information on how Marketplace users can obtain support for the Listing. Use this parameter to provide details such as contact information and support description. + :param configuration: A JSON object for providing Listing-specific configuration. Contains button setup, notification URL, and more. + :param pricing: A JSON object for providing Listing's purchase options. :returns: The updated ModuleDataManagementInstance """ @@ -142,6 +149,7 @@ async def update_async( policies=policies, support=support, configuration=configuration, + pricing=pricing, ) def __repr__(self) -> str: @@ -161,7 +169,7 @@ def __init__(self, version: Version, sid: str): Initialize the ModuleDataManagementContext :param version: Version that contains the resource - :param sid: + :param sid: SID that uniquely identifies the Listing. """ super().__init__(version) @@ -217,16 +225,18 @@ def update( policies: Union[str, object] = values.unset, support: Union[str, object] = values.unset, configuration: Union[str, object] = values.unset, + pricing: Union[str, object] = values.unset, ) -> ModuleDataManagementInstance: """ Update the ModuleDataManagementInstance - :param module_info: - :param description: - :param documentation: - :param policies: - :param support: - :param configuration: + :param module_info: A JSON object containing essential attributes that define a Listing. + :param description: A JSON object describing the Listing. You can define the main body of the description, highlight key features or aspects of the Listing, and provide code samples for developers if applicable. + :param documentation: A JSON object for providing comprehensive information, instructions, and resources related to the Listing. + :param policies: A JSON object describing the Listing's privacy and legal policies. The maximum file size for Policies is 5MB. + :param support: A JSON object containing information on how Marketplace users can obtain support for the Listing. Use this parameter to provide details such as contact information and support description. + :param configuration: A JSON object for providing Listing-specific configuration. Contains button setup, notification URL, and more. + :param pricing: A JSON object for providing Listing's purchase options. :returns: The updated ModuleDataManagementInstance """ @@ -238,6 +248,7 @@ def update( "Policies": policies, "Support": support, "Configuration": configuration, + "Pricing": pricing, } ) @@ -259,16 +270,18 @@ async def update_async( policies: Union[str, object] = values.unset, support: Union[str, object] = values.unset, configuration: Union[str, object] = values.unset, + pricing: Union[str, object] = values.unset, ) -> ModuleDataManagementInstance: """ Asynchronous coroutine to update the ModuleDataManagementInstance - :param module_info: - :param description: - :param documentation: - :param policies: - :param support: - :param configuration: + :param module_info: A JSON object containing essential attributes that define a Listing. + :param description: A JSON object describing the Listing. You can define the main body of the description, highlight key features or aspects of the Listing, and provide code samples for developers if applicable. + :param documentation: A JSON object for providing comprehensive information, instructions, and resources related to the Listing. + :param policies: A JSON object describing the Listing's privacy and legal policies. The maximum file size for Policies is 5MB. + :param support: A JSON object containing information on how Marketplace users can obtain support for the Listing. Use this parameter to provide details such as contact information and support description. + :param configuration: A JSON object for providing Listing-specific configuration. Contains button setup, notification URL, and more. + :param pricing: A JSON object for providing Listing's purchase options. :returns: The updated ModuleDataManagementInstance """ @@ -280,6 +293,7 @@ async def update_async( "Policies": policies, "Support": support, "Configuration": configuration, + "Pricing": pricing, } ) @@ -318,7 +332,7 @@ def get(self, sid: str) -> ModuleDataManagementContext: """ Constructs a ModuleDataManagementContext - :param sid: + :param sid: SID that uniquely identifies the Listing. """ return ModuleDataManagementContext(self._version, sid=sid) @@ -326,7 +340,7 @@ def __call__(self, sid: str) -> ModuleDataManagementContext: """ Constructs a ModuleDataManagementContext - :param sid: + :param sid: SID that uniquely identifies the Listing. """ return ModuleDataManagementContext(self._version, sid=sid) diff --git a/twilio/rest/numbers/v2/bundle_clone.py b/twilio/rest/numbers/v2/bundle_clone.py index ff24e29063..820fbc9db5 100644 --- a/twilio/rest/numbers/v2/bundle_clone.py +++ b/twilio/rest/numbers/v2/bundle_clone.py @@ -101,7 +101,7 @@ def create( Create the BundleCloneInstance :param target_account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) where the bundle needs to be cloned. - :param move_to_draft: This is to determine whether the cloned bundle needs to be in draft state or not. + :param move_to_draft: If set to true, the cloned bundle will be in the DRAFT state, else it will be twilio-approved :param friendly_name: The string that you assigned to describe the cloned bundle. :returns: The created BundleCloneInstance @@ -122,7 +122,7 @@ async def create_async( Asynchronous coroutine to create the BundleCloneInstance :param target_account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) where the bundle needs to be cloned. - :param move_to_draft: This is to determine whether the cloned bundle needs to be in draft state or not. + :param move_to_draft: If set to true, the cloned bundle will be in the DRAFT state, else it will be twilio-approved :param friendly_name: The string that you assigned to describe the cloned bundle. :returns: The created BundleCloneInstance @@ -172,7 +172,7 @@ def create( Create the BundleCloneInstance :param target_account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) where the bundle needs to be cloned. - :param move_to_draft: This is to determine whether the cloned bundle needs to be in draft state or not. + :param move_to_draft: If set to true, the cloned bundle will be in the DRAFT state, else it will be twilio-approved :param friendly_name: The string that you assigned to describe the cloned bundle. :returns: The created BundleCloneInstance @@ -201,7 +201,7 @@ async def create_async( Asynchronous coroutine to create the BundleCloneInstance :param target_account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) where the bundle needs to be cloned. - :param move_to_draft: This is to determine whether the cloned bundle needs to be in draft state or not. + :param move_to_draft: If set to true, the cloned bundle will be in the DRAFT state, else it will be twilio-approved :param friendly_name: The string that you assigned to describe the cloned bundle. :returns: The created BundleCloneInstance diff --git a/twilio/rest/numbers/v2/regulatory_compliance/bundle/__init__.py b/twilio/rest/numbers/v2/regulatory_compliance/bundle/__init__.py index 5c8b48f11d..8ad16f21ce 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/bundle/__init__.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/bundle/__init__.py @@ -499,7 +499,7 @@ def create( :param regulation_sid: The unique string of a regulation that is associated to the Bundle resource. :param iso_country: The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Bundle's phone number country ownership request. :param end_user_type: - :param number_type: The type of phone number of the Bundle's ownership request. Can be `local`, `mobile`, `national`, or `toll free`. + :param number_type: The type of phone number of the Bundle's ownership request. Can be `local`, `mobile`, `national`, or `toll-free`. :param is_test: Indicates that Bundle is a Test Bundle and will be Auto-Rejected :returns: The created BundleInstance @@ -545,7 +545,7 @@ async def create_async( :param regulation_sid: The unique string of a regulation that is associated to the Bundle resource. :param iso_country: The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Bundle's phone number country ownership request. :param end_user_type: - :param number_type: The type of phone number of the Bundle's ownership request. Can be `local`, `mobile`, `national`, or `toll free`. + :param number_type: The type of phone number of the Bundle's ownership request. Can be `local`, `mobile`, `national`, or `toll-free`. :param is_test: Indicates that Bundle is a Test Bundle and will be Auto-Rejected :returns: The created BundleInstance @@ -597,7 +597,7 @@ def stream( :param str friendly_name: The string that you assigned to describe the resource. The column can contain 255 variable characters. :param str regulation_sid: The unique string of a [Regulation resource](https://www.twilio.com/docs/phone-numbers/regulatory/api/regulations) that is associated to the Bundle resource. :param str iso_country: The 2-digit [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Bundle's phone number country ownership request. - :param str number_type: The type of phone number of the Bundle's ownership request. Can be `local`, `mobile`, `national`, or `tollfree`. + :param str number_type: The type of phone number of the Bundle's ownership request. Can be `local`, `mobile`, `national`, or `toll-free`. :param bool has_valid_until_date: Indicates that the Bundle is a valid Bundle until a specified expiration date. :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`. @@ -657,7 +657,7 @@ async def stream_async( :param str friendly_name: The string that you assigned to describe the resource. The column can contain 255 variable characters. :param str regulation_sid: The unique string of a [Regulation resource](https://www.twilio.com/docs/phone-numbers/regulatory/api/regulations) that is associated to the Bundle resource. :param str iso_country: The 2-digit [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Bundle's phone number country ownership request. - :param str number_type: The type of phone number of the Bundle's ownership request. Can be `local`, `mobile`, `national`, or `tollfree`. + :param str number_type: The type of phone number of the Bundle's ownership request. Can be `local`, `mobile`, `national`, or `toll-free`. :param bool has_valid_until_date: Indicates that the Bundle is a valid Bundle until a specified expiration date. :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`. @@ -716,7 +716,7 @@ def list( :param str friendly_name: The string that you assigned to describe the resource. The column can contain 255 variable characters. :param str regulation_sid: The unique string of a [Regulation resource](https://www.twilio.com/docs/phone-numbers/regulatory/api/regulations) that is associated to the Bundle resource. :param str iso_country: The 2-digit [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Bundle's phone number country ownership request. - :param str number_type: The type of phone number of the Bundle's ownership request. Can be `local`, `mobile`, `national`, or `tollfree`. + :param str number_type: The type of phone number of the Bundle's ownership request. Can be `local`, `mobile`, `national`, or `toll-free`. :param bool has_valid_until_date: Indicates that the Bundle is a valid Bundle until a specified expiration date. :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`. @@ -775,7 +775,7 @@ async def list_async( :param str friendly_name: The string that you assigned to describe the resource. The column can contain 255 variable characters. :param str regulation_sid: The unique string of a [Regulation resource](https://www.twilio.com/docs/phone-numbers/regulatory/api/regulations) that is associated to the Bundle resource. :param str iso_country: The 2-digit [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Bundle's phone number country ownership request. - :param str number_type: The type of phone number of the Bundle's ownership request. Can be `local`, `mobile`, `national`, or `tollfree`. + :param str number_type: The type of phone number of the Bundle's ownership request. Can be `local`, `mobile`, `national`, or `toll-free`. :param bool has_valid_until_date: Indicates that the Bundle is a valid Bundle until a specified expiration date. :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`. @@ -835,7 +835,7 @@ def page( :param friendly_name: The string that you assigned to describe the resource. The column can contain 255 variable characters. :param regulation_sid: The unique string of a [Regulation resource](https://www.twilio.com/docs/phone-numbers/regulatory/api/regulations) that is associated to the Bundle resource. :param iso_country: The 2-digit [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Bundle's phone number country ownership request. - :param number_type: The type of phone number of the Bundle's ownership request. Can be `local`, `mobile`, `national`, or `tollfree`. + :param number_type: The type of phone number of the Bundle's ownership request. Can be `local`, `mobile`, `national`, or `toll-free`. :param has_valid_until_date: Indicates that the Bundle is a valid Bundle until a specified expiration date. :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`. @@ -895,7 +895,7 @@ async def page_async( :param friendly_name: The string that you assigned to describe the resource. The column can contain 255 variable characters. :param regulation_sid: The unique string of a [Regulation resource](https://www.twilio.com/docs/phone-numbers/regulatory/api/regulations) that is associated to the Bundle resource. :param iso_country: The 2-digit [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Bundle's phone number country ownership request. - :param number_type: The type of phone number of the Bundle's ownership request. Can be `local`, `mobile`, `national`, or `tollfree`. + :param number_type: The type of phone number of the Bundle's ownership request. Can be `local`, `mobile`, `national`, or `toll-free`. :param has_valid_until_date: Indicates that the Bundle is a valid Bundle until a specified expiration date. :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`. From 4168b097641b9d0f4b0d60dc632650eb4babec92 Mon Sep 17 00:00:00 2001 From: Twilio Date: Wed, 18 Sep 2024 13:23:24 +0000 Subject: [PATCH 33/87] Release 9.3.1 --- setup.py | 2 +- twilio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 6366ea68eb..c3b935f109 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name="twilio", - version="9.3.0", + version="9.3.1", description="Twilio API client and TwiML generator", author="Twilio", help_center="https://www.twilio.com/help/contact", diff --git a/twilio/__init__.py b/twilio/__init__.py index 529960ecb5..de97d54994 100644 --- a/twilio/__init__.py +++ b/twilio/__init__.py @@ -1,2 +1,2 @@ -__version_info__ = ("9", "3", "0") +__version_info__ = ("9", "3", "1") __version__ = ".".join(__version_info__) From 75e8b145c05da7e6cf9fc9a06812cbf102a65d90 Mon Sep 17 00:00:00 2001 From: Twilio Date: Wed, 25 Sep 2024 11:48:41 +0000 Subject: [PATCH 34/87] [Librarian] Regenerated @ 08245333f4a8c9235d547b189cd9c422f73e0e7e 7bb98153c25ebfee95e6e85bd4c57969e6d02435 --- CHANGES.md | 11 + twilio/rest/accounts/v1/__init__.py | 16 + twilio/rest/accounts/v1/bulk_consents.py | 106 ++++ twilio/rest/accounts/v1/bulk_contacts.py | 106 ++++ .../rest/assistants/v1/assistant/__init__.py | 67 +++ .../v1/assistant/assistants_knowledge.py | 506 ++++++++++++++++++ .../v1/assistant/assistants_tool.py | 506 ++++++++++++++++++ .../rest/assistants/v1/assistant/message.py | 153 ++++++ .../rest/assistants/v1/knowledge/__init__.py | 23 + .../v1/knowledge/knowledge_status.py | 192 +++++++ twilio/rest/assistants/v1/tool.py | 60 +++ twilio/rest/numbers/v1/__init__.py | 24 +- ...hook_configuration_fetch.py => webhook.py} | 26 +- .../v1/service/environment/deployment.py | 14 +- 14 files changed, 1778 insertions(+), 32 deletions(-) create mode 100644 twilio/rest/accounts/v1/bulk_consents.py create mode 100644 twilio/rest/accounts/v1/bulk_contacts.py create mode 100644 twilio/rest/assistants/v1/assistant/assistants_knowledge.py create mode 100644 twilio/rest/assistants/v1/assistant/assistants_tool.py create mode 100644 twilio/rest/assistants/v1/assistant/message.py create mode 100644 twilio/rest/assistants/v1/knowledge/knowledge_status.py rename twilio/rest/numbers/v1/{porting_webhook_configuration_fetch.py => webhook.py} (77%) diff --git a/CHANGES.md b/CHANGES.md index e8d6748656..307f94f7d0 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,17 @@ twilio-python Changelog Here you can see the full list of changes between each twilio-python release. +[2024-09-25] Version 9.3.2 +-------------------------- +**Accounts** +- Update docs and mounts. +- Change library visibility to public +- Enable consent and contact bulk upsert APIs in prod. + +**Serverless** +- Add is_plugin parameter in deployments api to check if it is plugins deployment + + [2024-09-18] Version 9.3.1 -------------------------- **Library - Chore** diff --git a/twilio/rest/accounts/v1/__init__.py b/twilio/rest/accounts/v1/__init__.py index 142d5c7a96..6f5012d0fa 100644 --- a/twilio/rest/accounts/v1/__init__.py +++ b/twilio/rest/accounts/v1/__init__.py @@ -16,6 +16,8 @@ from twilio.base.version import Version from twilio.base.domain import Domain from twilio.rest.accounts.v1.auth_token_promotion import AuthTokenPromotionList +from twilio.rest.accounts.v1.bulk_consents import BulkConsentsList +from twilio.rest.accounts.v1.bulk_contacts import BulkContactsList from twilio.rest.accounts.v1.credential import CredentialList from twilio.rest.accounts.v1.safelist import SafelistList from twilio.rest.accounts.v1.secondary_auth_token import SecondaryAuthTokenList @@ -31,6 +33,8 @@ def __init__(self, domain: Domain): """ super().__init__(domain, "v1") self._auth_token_promotion: Optional[AuthTokenPromotionList] = None + self._bulk_consents: Optional[BulkConsentsList] = None + self._bulk_contacts: Optional[BulkContactsList] = None self._credentials: Optional[CredentialList] = None self._safelist: Optional[SafelistList] = None self._secondary_auth_token: Optional[SecondaryAuthTokenList] = None @@ -41,6 +45,18 @@ def auth_token_promotion(self) -> AuthTokenPromotionList: self._auth_token_promotion = AuthTokenPromotionList(self) return self._auth_token_promotion + @property + def bulk_consents(self) -> BulkConsentsList: + if self._bulk_consents is None: + self._bulk_consents = BulkConsentsList(self) + return self._bulk_consents + + @property + def bulk_contacts(self) -> BulkContactsList: + if self._bulk_contacts is None: + self._bulk_contacts = BulkContactsList(self) + return self._bulk_contacts + @property def credentials(self) -> CredentialList: if self._credentials is None: diff --git a/twilio/rest/accounts/v1/bulk_consents.py b/twilio/rest/accounts/v1/bulk_consents.py new file mode 100644 index 0000000000..850d72162e --- /dev/null +++ b/twilio/rest/accounts/v1/bulk_consents.py @@ -0,0 +1,106 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Accounts + 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 serialize, values + +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class BulkConsentsInstance(InstanceResource): + """ + :ivar items: A list of objects where each object represents the result of processing a `correlation_id`. Each object contains the following fields: `correlation_id`, a unique 32-character UUID that maps the response to the original request; `error_code`, an integer where 0 indicates success and any non-zero value represents an error; and `error_messages`, an array of strings describing specific validation errors encountered. If the request is successful, the error_messages array will be empty. + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) + + self.items: Optional[Dict[str, object]] = payload.get("items") + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "" + + +class BulkConsentsList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the BulkConsentsList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/Consents/Bulk" + + def create(self, items: List[object]) -> BulkConsentsInstance: + """ + Create the BulkConsentsInstance + + :param items: This is a list of objects that describes a contact's opt-in status. Each object contains the following fields: `contact_id`, which must be a string representing phone number in [E.164 format](https://www.twilio.com/docs/glossary/what-e164); `correlation_id`, a unique 32-character UUID used to uniquely map the request item with the response item; `sender_id`, which can be either a valid messaging service SID or a from phone number; `status`, a string representing the consent status. Can be one of [`opt-in`, `opt-out`]; and `source`, a string indicating the medium through which the consent was collected. Can be one of [`website`, `offline`, `opt-in-message`, `opt-out-message`, `others`]. + + :returns: The created BulkConsentsInstance + """ + + data = values.of( + { + "Items": serialize.map(items, lambda e: serialize.object(e)), + } + ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return BulkConsentsInstance(self._version, payload) + + async def create_async(self, items: List[object]) -> BulkConsentsInstance: + """ + Asynchronously create the BulkConsentsInstance + + :param items: This is a list of objects that describes a contact's opt-in status. Each object contains the following fields: `contact_id`, which must be a string representing phone number in [E.164 format](https://www.twilio.com/docs/glossary/what-e164); `correlation_id`, a unique 32-character UUID used to uniquely map the request item with the response item; `sender_id`, which can be either a valid messaging service SID or a from phone number; `status`, a string representing the consent status. Can be one of [`opt-in`, `opt-out`]; and `source`, a string indicating the medium through which the consent was collected. Can be one of [`website`, `offline`, `opt-in-message`, `opt-out-message`, `others`]. + + :returns: The created BulkConsentsInstance + """ + + data = values.of( + { + "Items": serialize.map(items, lambda e: serialize.object(e)), + } + ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return BulkConsentsInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/accounts/v1/bulk_contacts.py b/twilio/rest/accounts/v1/bulk_contacts.py new file mode 100644 index 0000000000..0d68908e31 --- /dev/null +++ b/twilio/rest/accounts/v1/bulk_contacts.py @@ -0,0 +1,106 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Accounts + 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 serialize, values + +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class BulkContactsInstance(InstanceResource): + """ + :ivar items: A list of objects where each object represents the result of processing a `correlation_id`. Each object contains the following fields: `correlation_id`, a unique 32-character UUID that maps the response to the original request; `error_code`, an integer where 0 indicates success and any non-zero value represents an error; and `error_messages`, an array of strings describing specific validation errors encountered. If the request is successful, the error_messages array will be empty. + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) + + self.items: Optional[Dict[str, object]] = payload.get("items") + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "" + + +class BulkContactsList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the BulkContactsList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/Contacts/Bulk" + + def create(self, items: List[object]) -> BulkContactsInstance: + """ + Create the BulkContactsInstance + + :param items: A list of objects where each object represents a contact's details. Each object includes the following fields: `contact_id`, which must be a string representing phone number in [E.164 format](https://www.twilio.com/docs/glossary/what-e164); `correlation_id`, a unique 32-character UUID that maps the response to the original request; `country_iso_code`, a string representing the country using the ISO format (e.g., US for the United States); and `zip_code`, a string representing the postal code. + + :returns: The created BulkContactsInstance + """ + + data = values.of( + { + "Items": serialize.map(items, lambda e: serialize.object(e)), + } + ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return BulkContactsInstance(self._version, payload) + + async def create_async(self, items: List[object]) -> BulkContactsInstance: + """ + Asynchronously create the BulkContactsInstance + + :param items: A list of objects where each object represents a contact's details. Each object includes the following fields: `contact_id`, which must be a string representing phone number in [E.164 format](https://www.twilio.com/docs/glossary/what-e164); `correlation_id`, a unique 32-character UUID that maps the response to the original request; `country_iso_code`, a string representing the country using the ISO format (e.g., US for the United States); and `zip_code`, a string representing the postal code. + + :returns: The created BulkContactsInstance + """ + + data = values.of( + { + "Items": serialize.map(items, lambda e: serialize.object(e)), + } + ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return BulkContactsInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/assistants/v1/assistant/__init__.py b/twilio/rest/assistants/v1/assistant/__init__.py index 10e90c4743..a865a040eb 100644 --- a/twilio/rest/assistants/v1/assistant/__init__.py +++ b/twilio/rest/assistants/v1/assistant/__init__.py @@ -20,7 +20,12 @@ from twilio.base.list_resource import ListResource from twilio.base.version import Version from twilio.base.page import Page +from twilio.rest.assistants.v1.assistant.assistants_knowledge import ( + AssistantsKnowledgeList, +) +from twilio.rest.assistants.v1.assistant.assistants_tool import AssistantsToolList from twilio.rest.assistants.v1.assistant.feedback import FeedbackList +from twilio.rest.assistants.v1.assistant.message import MessageList class AssistantInstance(InstanceResource): @@ -31,6 +36,7 @@ class AssistantInstance(InstanceResource): :ivar model: The default model used by the assistant. :ivar name: The name of the assistant. :ivar owner: The owner/company of the assistant. + :ivar url: The url of the assistant resource. :ivar personality_prompt: The personality prompt to be used for assistant. :ivar date_created: The date and time in GMT when the Assistant was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. :ivar date_updated: The date and time in GMT when the Assistant was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. @@ -49,6 +55,7 @@ def __init__( self.model: Optional[str] = payload.get("model") self.name: Optional[str] = payload.get("name") self.owner: Optional[str] = payload.get("owner") + self.url: Optional[str] = payload.get("url") self.personality_prompt: Optional[str] = payload.get("personality_prompt") self.date_created: Optional[datetime] = deserialize.iso8601_datetime( payload.get("date_created") @@ -149,6 +156,20 @@ async def update_async( assistants_v1_service_update_assistant_request=assistants_v1_service_update_assistant_request, ) + @property + def assistants_knowledge(self) -> AssistantsKnowledgeList: + """ + Access the assistants_knowledge + """ + return self._proxy.assistants_knowledge + + @property + def assistants_tools(self) -> AssistantsToolList: + """ + Access the assistants_tools + """ + return self._proxy.assistants_tools + @property def feedbacks(self) -> FeedbackList: """ @@ -156,6 +177,13 @@ def feedbacks(self) -> FeedbackList: """ return self._proxy.feedbacks + @property + def messages(self) -> MessageList: + """ + Access the messages + """ + return self._proxy.messages + def __repr__(self) -> str: """ Provide a friendly representation @@ -183,7 +211,10 @@ def __init__(self, version: Version, id: str): } self._uri = "/Assistants/{id}".format(**self._solution) + self._assistants_knowledge: Optional[AssistantsKnowledgeList] = None + self._assistants_tools: Optional[AssistantsToolList] = None self._feedbacks: Optional[FeedbackList] = None + self._messages: Optional[MessageList] = None def delete(self) -> bool: """ @@ -299,6 +330,30 @@ async def update_async( return AssistantInstance(self._version, payload, id=self._solution["id"]) + @property + def assistants_knowledge(self) -> AssistantsKnowledgeList: + """ + Access the assistants_knowledge + """ + if self._assistants_knowledge is None: + self._assistants_knowledge = AssistantsKnowledgeList( + self._version, + self._solution["id"], + ) + return self._assistants_knowledge + + @property + def assistants_tools(self) -> AssistantsToolList: + """ + Access the assistants_tools + """ + if self._assistants_tools is None: + self._assistants_tools = AssistantsToolList( + self._version, + self._solution["id"], + ) + return self._assistants_tools + @property def feedbacks(self) -> FeedbackList: """ @@ -311,6 +366,18 @@ def feedbacks(self) -> FeedbackList: ) return self._feedbacks + @property + def messages(self) -> MessageList: + """ + Access the messages + """ + if self._messages is None: + self._messages = MessageList( + self._version, + self._solution["id"], + ) + return self._messages + def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/assistants/v1/assistant/assistants_knowledge.py b/twilio/rest/assistants/v1/assistant/assistants_knowledge.py new file mode 100644 index 0000000000..b3c7e9ae0e --- /dev/null +++ b/twilio/rest/assistants/v1/assistant/assistants_knowledge.py @@ -0,0 +1,506 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Assistants + 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 datetime import datetime +from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator +from twilio.base import deserialize, values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version +from twilio.base.page import Page + + +class AssistantsKnowledgeInstance(InstanceResource): + """ + :ivar description: The type of knowledge source. + :ivar id: The description of knowledge. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Knowledge resource. + :ivar knowledge_source_details: The details of the knowledge source based on the type. + :ivar name: The name of the knowledge source. + :ivar status: The status of processing the knowledge source ('QUEUED', 'PROCESSING', 'COMPLETED', 'FAILED') + :ivar type: The type of knowledge source ('Web', 'Database', 'Text', 'File') + :ivar url: The url of the knowledge resource. + :ivar date_created: The date and time in GMT when the Knowledge was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date and time in GMT when the Knowledge was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + assistant_id: str, + id: Optional[str] = None, + ): + super().__init__(version) + + self.description: Optional[str] = payload.get("description") + self.id: Optional[str] = payload.get("id") + self.account_sid: Optional[str] = payload.get("account_sid") + self.knowledge_source_details: Optional[Dict[str, object]] = payload.get( + "knowledge_source_details" + ) + self.name: Optional[str] = payload.get("name") + self.status: Optional[str] = payload.get("status") + self.type: Optional[str] = payload.get("type") + self.url: Optional[str] = payload.get("url") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + + self._solution = { + "assistant_id": assistant_id, + "id": id or self.id, + } + self._context: Optional[AssistantsKnowledgeContext] = None + + @property + def _proxy(self) -> "AssistantsKnowledgeContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: AssistantsKnowledgeContext for this AssistantsKnowledgeInstance + """ + if self._context is None: + self._context = AssistantsKnowledgeContext( + self._version, + assistant_id=self._solution["assistant_id"], + id=self._solution["id"], + ) + return self._context + + def create(self) -> "AssistantsKnowledgeInstance": + """ + Create the AssistantsKnowledgeInstance + + + :returns: The created AssistantsKnowledgeInstance + """ + return self._proxy.create() + + async def create_async(self) -> "AssistantsKnowledgeInstance": + """ + Asynchronous coroutine to create the AssistantsKnowledgeInstance + + + :returns: The created AssistantsKnowledgeInstance + """ + return await self._proxy.create_async() + + def delete(self) -> bool: + """ + Deletes the AssistantsKnowledgeInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the AssistantsKnowledgeInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + 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 AssistantsKnowledgeContext(InstanceContext): + + def __init__(self, version: Version, assistant_id: str, id: str): + """ + Initialize the AssistantsKnowledgeContext + + :param version: Version that contains the resource + :param assistant_id: The assistant ID. + :param id: The knowledge ID. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_id": assistant_id, + "id": id, + } + self._uri = "/Assistants/{assistant_id}/Knowledge/{id}".format(**self._solution) + + def create(self) -> AssistantsKnowledgeInstance: + """ + Create the AssistantsKnowledgeInstance + + + :returns: The created AssistantsKnowledgeInstance + """ + data = values.of({}) + + payload = self._version.create(method="POST", uri=self._uri, data=data) + + return AssistantsKnowledgeInstance( + self._version, + payload, + assistant_id=self._solution["assistant_id"], + id=self._solution["id"], + ) + + async def create_async(self) -> AssistantsKnowledgeInstance: + """ + Asynchronous coroutine to create the AssistantsKnowledgeInstance + + + :returns: The created AssistantsKnowledgeInstance + """ + data = values.of({}) + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data + ) + + return AssistantsKnowledgeInstance( + self._version, + payload, + assistant_id=self._solution["assistant_id"], + id=self._solution["id"], + ) + + def delete(self) -> bool: + """ + Deletes the AssistantsKnowledgeInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._version.delete( + method="DELETE", + uri=self._uri, + ) + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the AssistantsKnowledgeInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._version.delete_async( + method="DELETE", + uri=self._uri, + ) + + 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 AssistantsKnowledgePage(Page): + + def get_instance(self, payload: Dict[str, Any]) -> AssistantsKnowledgeInstance: + """ + Build an instance of AssistantsKnowledgeInstance + + :param payload: Payload response from the API + """ + return AssistantsKnowledgeInstance( + self._version, payload, assistant_id=self._solution["assistant_id"] + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class AssistantsKnowledgeList(ListResource): + + def __init__(self, version: Version, assistant_id: str): + """ + Initialize the AssistantsKnowledgeList + + :param version: Version that contains the resource + :param assistant_id: The assistant ID. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_id": assistant_id, + } + self._uri = "/Assistants/{assistant_id}/Knowledge".format(**self._solution) + + def create(self) -> AssistantsKnowledgeInstance: + """ + Create the AssistantsKnowledgeInstance + + + :returns: The created AssistantsKnowledgeInstance + """ + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + payload = self._version.create(method="POST", uri=self._uri, headers=headers) + + return AssistantsKnowledgeInstance( + self._version, payload, assistant_id=self._solution["assistant_id"] + ) + + async def create_async(self) -> AssistantsKnowledgeInstance: + """ + Asynchronously create the AssistantsKnowledgeInstance + + + :returns: The created AssistantsKnowledgeInstance + """ + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + payload = await self._version.create_async( + method="POST", uri=self._uri, headers=headers + ) + + return AssistantsKnowledgeInstance( + self._version, payload, assistant_id=self._solution["assistant_id"] + ) + + def stream( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[AssistantsKnowledgeInstance]: + """ + Streams AssistantsKnowledgeInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = self.page(page_size=limits["page_size"]) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[AssistantsKnowledgeInstance]: + """ + Asynchronously streams AssistantsKnowledgeInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = await self.page_async(page_size=limits["page_size"]) + + return self._version.stream_async(page, limits["limit"]) + + def list( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[AssistantsKnowledgeInstance]: + """ + Lists AssistantsKnowledgeInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return list( + self.stream( + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[AssistantsKnowledgeInstance]: + """ + Asynchronously lists AssistantsKnowledgeInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return [ + record + async for record in await self.stream_async( + limit=limit, + page_size=page_size, + ) + ] + + def page( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> AssistantsKnowledgePage: + """ + Retrieve a single page of AssistantsKnowledgeInstance records from the API. + Request is executed immediately + + :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 + + :returns: Page of AssistantsKnowledgeInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = self._version.page(method="GET", uri=self._uri, params=data) + return AssistantsKnowledgePage(self._version, response, self._solution) + + async def page_async( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> AssistantsKnowledgePage: + """ + Asynchronously retrieve a single page of AssistantsKnowledgeInstance records from the API. + Request is executed immediately + + :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 + + :returns: Page of AssistantsKnowledgeInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = await self._version.page_async( + method="GET", uri=self._uri, params=data + ) + return AssistantsKnowledgePage(self._version, response, self._solution) + + def get_page(self, target_url: str) -> AssistantsKnowledgePage: + """ + Retrieve a specific page of AssistantsKnowledgeInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of AssistantsKnowledgeInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return AssistantsKnowledgePage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> AssistantsKnowledgePage: + """ + Asynchronously retrieve a specific page of AssistantsKnowledgeInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of AssistantsKnowledgeInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return AssistantsKnowledgePage(self._version, response, self._solution) + + def get(self, id: str) -> AssistantsKnowledgeContext: + """ + Constructs a AssistantsKnowledgeContext + + :param id: The knowledge ID. + """ + return AssistantsKnowledgeContext( + self._version, assistant_id=self._solution["assistant_id"], id=id + ) + + def __call__(self, id: str) -> AssistantsKnowledgeContext: + """ + Constructs a AssistantsKnowledgeContext + + :param id: The knowledge ID. + """ + return AssistantsKnowledgeContext( + self._version, assistant_id=self._solution["assistant_id"], id=id + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/assistants/v1/assistant/assistants_tool.py b/twilio/rest/assistants/v1/assistant/assistants_tool.py new file mode 100644 index 0000000000..0bed2b76a3 --- /dev/null +++ b/twilio/rest/assistants/v1/assistant/assistants_tool.py @@ -0,0 +1,506 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Assistants + 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 datetime import datetime +from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator +from twilio.base import deserialize, values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version +from twilio.base.page import Page + + +class AssistantsToolInstance(InstanceResource): + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Tool resource. + :ivar description: The description of the tool. + :ivar enabled: True if the tool is enabled. + :ivar id: The tool ID. + :ivar meta: The metadata related to method, url, input_schema to used with the Tool. + :ivar name: The name of the tool. + :ivar requires_auth: The authentication requirement for the tool. + :ivar type: The type of the tool. ('WEBHOOK') + :ivar url: The url of the tool resource. + :ivar date_created: The date and time in GMT when the Tool was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date and time in GMT when the Tool was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + assistant_id: str, + id: Optional[str] = None, + ): + super().__init__(version) + + self.account_sid: Optional[str] = payload.get("account_sid") + self.description: Optional[str] = payload.get("description") + self.enabled: Optional[bool] = payload.get("enabled") + self.id: Optional[str] = payload.get("id") + self.meta: Optional[Dict[str, object]] = payload.get("meta") + self.name: Optional[str] = payload.get("name") + self.requires_auth: Optional[bool] = payload.get("requires_auth") + self.type: Optional[str] = payload.get("type") + self.url: Optional[str] = payload.get("url") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + + self._solution = { + "assistant_id": assistant_id, + "id": id or self.id, + } + self._context: Optional[AssistantsToolContext] = None + + @property + def _proxy(self) -> "AssistantsToolContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: AssistantsToolContext for this AssistantsToolInstance + """ + if self._context is None: + self._context = AssistantsToolContext( + self._version, + assistant_id=self._solution["assistant_id"], + id=self._solution["id"], + ) + return self._context + + def create(self) -> "AssistantsToolInstance": + """ + Create the AssistantsToolInstance + + + :returns: The created AssistantsToolInstance + """ + return self._proxy.create() + + async def create_async(self) -> "AssistantsToolInstance": + """ + Asynchronous coroutine to create the AssistantsToolInstance + + + :returns: The created AssistantsToolInstance + """ + return await self._proxy.create_async() + + def delete(self) -> bool: + """ + Deletes the AssistantsToolInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the AssistantsToolInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + 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 AssistantsToolContext(InstanceContext): + + def __init__(self, version: Version, assistant_id: str, id: str): + """ + Initialize the AssistantsToolContext + + :param version: Version that contains the resource + :param assistant_id: The assistant ID. + :param id: The tool ID. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_id": assistant_id, + "id": id, + } + self._uri = "/Assistants/{assistant_id}/Tools/{id}".format(**self._solution) + + def create(self) -> AssistantsToolInstance: + """ + Create the AssistantsToolInstance + + + :returns: The created AssistantsToolInstance + """ + data = values.of({}) + + payload = self._version.create(method="POST", uri=self._uri, data=data) + + return AssistantsToolInstance( + self._version, + payload, + assistant_id=self._solution["assistant_id"], + id=self._solution["id"], + ) + + async def create_async(self) -> AssistantsToolInstance: + """ + Asynchronous coroutine to create the AssistantsToolInstance + + + :returns: The created AssistantsToolInstance + """ + data = values.of({}) + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data + ) + + return AssistantsToolInstance( + self._version, + payload, + assistant_id=self._solution["assistant_id"], + id=self._solution["id"], + ) + + def delete(self) -> bool: + """ + Deletes the AssistantsToolInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._version.delete( + method="DELETE", + uri=self._uri, + ) + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the AssistantsToolInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._version.delete_async( + method="DELETE", + uri=self._uri, + ) + + 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 AssistantsToolPage(Page): + + def get_instance(self, payload: Dict[str, Any]) -> AssistantsToolInstance: + """ + Build an instance of AssistantsToolInstance + + :param payload: Payload response from the API + """ + return AssistantsToolInstance( + self._version, payload, assistant_id=self._solution["assistant_id"] + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class AssistantsToolList(ListResource): + + def __init__(self, version: Version, assistant_id: str): + """ + Initialize the AssistantsToolList + + :param version: Version that contains the resource + :param assistant_id: The assistant ID. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_id": assistant_id, + } + self._uri = "/Assistants/{assistant_id}/Tools".format(**self._solution) + + def create(self) -> AssistantsToolInstance: + """ + Create the AssistantsToolInstance + + + :returns: The created AssistantsToolInstance + """ + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + payload = self._version.create(method="POST", uri=self._uri, headers=headers) + + return AssistantsToolInstance( + self._version, payload, assistant_id=self._solution["assistant_id"] + ) + + async def create_async(self) -> AssistantsToolInstance: + """ + Asynchronously create the AssistantsToolInstance + + + :returns: The created AssistantsToolInstance + """ + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + payload = await self._version.create_async( + method="POST", uri=self._uri, headers=headers + ) + + return AssistantsToolInstance( + self._version, payload, assistant_id=self._solution["assistant_id"] + ) + + def stream( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[AssistantsToolInstance]: + """ + Streams AssistantsToolInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = self.page(page_size=limits["page_size"]) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[AssistantsToolInstance]: + """ + Asynchronously streams AssistantsToolInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = await self.page_async(page_size=limits["page_size"]) + + return self._version.stream_async(page, limits["limit"]) + + def list( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[AssistantsToolInstance]: + """ + Lists AssistantsToolInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return list( + self.stream( + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[AssistantsToolInstance]: + """ + Asynchronously lists AssistantsToolInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return [ + record + async for record in await self.stream_async( + limit=limit, + page_size=page_size, + ) + ] + + def page( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> AssistantsToolPage: + """ + Retrieve a single page of AssistantsToolInstance records from the API. + Request is executed immediately + + :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 + + :returns: Page of AssistantsToolInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = self._version.page(method="GET", uri=self._uri, params=data) + return AssistantsToolPage(self._version, response, self._solution) + + async def page_async( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> AssistantsToolPage: + """ + Asynchronously retrieve a single page of AssistantsToolInstance records from the API. + Request is executed immediately + + :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 + + :returns: Page of AssistantsToolInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = await self._version.page_async( + method="GET", uri=self._uri, params=data + ) + return AssistantsToolPage(self._version, response, self._solution) + + def get_page(self, target_url: str) -> AssistantsToolPage: + """ + Retrieve a specific page of AssistantsToolInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of AssistantsToolInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return AssistantsToolPage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> AssistantsToolPage: + """ + Asynchronously retrieve a specific page of AssistantsToolInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of AssistantsToolInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return AssistantsToolPage(self._version, response, self._solution) + + def get(self, id: str) -> AssistantsToolContext: + """ + Constructs a AssistantsToolContext + + :param id: The tool ID. + """ + return AssistantsToolContext( + self._version, assistant_id=self._solution["assistant_id"], id=id + ) + + def __call__(self, id: str) -> AssistantsToolContext: + """ + Constructs a AssistantsToolContext + + :param id: The tool ID. + """ + return AssistantsToolContext( + self._version, assistant_id=self._solution["assistant_id"], id=id + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/assistants/v1/assistant/message.py b/twilio/rest/assistants/v1/assistant/message.py new file mode 100644 index 0000000000..b42514cb38 --- /dev/null +++ b/twilio/rest/assistants/v1/assistant/message.py @@ -0,0 +1,153 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Assistants + 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 import values + +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class MessageInstance(InstanceResource): + """ + :ivar status: success or failure based on whether the request successfully generated a response. + :ivar flagged: If successful, this property will denote whether the response was flagged or not. + :ivar aborted: This property will denote whether the request was aborted or not. + :ivar session_id: The unique name for the session. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that sent the Message. + :ivar body: If successful, the body of the generated response + :ivar error: The error message if generation was not successful + """ + + def __init__(self, version: Version, payload: Dict[str, Any], id: str): + super().__init__(version) + + self.status: Optional[str] = payload.get("status") + self.flagged: Optional[bool] = payload.get("flagged") + self.aborted: Optional[bool] = payload.get("aborted") + self.session_id: Optional[str] = payload.get("session_id") + self.account_sid: Optional[str] = payload.get("account_sid") + self.body: Optional[str] = payload.get("body") + self.error: Optional[str] = payload.get("error") + + self._solution = { + "id": id, + } + + 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 MessageList(ListResource): + + class AssistantsV1ServiceAssistantSendMessageRequest(object): + """ + :ivar identity: The unique identity of user for the session. + :ivar session_id: The unique name for the session. + :ivar body: The query to ask the assistant. + :ivar webhook: The webhook url to call after the assistant has generated a response or report an error. + :ivar mode: one of the modes 'chat', 'email' or 'voice' + """ + + def __init__(self, payload: Dict[str, Any]): + + self.identity: Optional[str] = payload.get("identity") + self.session_id: Optional[str] = payload.get("session_id") + self.body: Optional[str] = payload.get("body") + self.webhook: Optional[str] = payload.get("webhook") + self.mode: Optional[str] = payload.get("mode") + + def to_dict(self): + return { + "identity": self.identity, + "session_id": self.session_id, + "body": self.body, + "webhook": self.webhook, + "mode": self.mode, + } + + def __init__(self, version: Version, id: str): + """ + Initialize the MessageList + + :param version: Version that contains the resource + :param id: the Assistant ID. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "id": id, + } + self._uri = "/Assistants/{id}/Messages".format(**self._solution) + + def create( + self, + assistants_v1_service_assistant_send_message_request: AssistantsV1ServiceAssistantSendMessageRequest, + ) -> MessageInstance: + """ + Create the MessageInstance + + :param assistants_v1_service_assistant_send_message_request: + + :returns: The created MessageInstance + """ + data = assistants_v1_service_assistant_send_message_request.to_dict() + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return MessageInstance(self._version, payload, id=self._solution["id"]) + + async def create_async( + self, + assistants_v1_service_assistant_send_message_request: AssistantsV1ServiceAssistantSendMessageRequest, + ) -> MessageInstance: + """ + Asynchronously create the MessageInstance + + :param assistants_v1_service_assistant_send_message_request: + + :returns: The created MessageInstance + """ + data = assistants_v1_service_assistant_send_message_request.to_dict() + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + 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, id=self._solution["id"]) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/assistants/v1/knowledge/__init__.py b/twilio/rest/assistants/v1/knowledge/__init__.py index 32b17e2353..498bc80f95 100644 --- a/twilio/rest/assistants/v1/knowledge/__init__.py +++ b/twilio/rest/assistants/v1/knowledge/__init__.py @@ -21,6 +21,7 @@ from twilio.base.version import Version from twilio.base.page import Page from twilio.rest.assistants.v1.knowledge.chunk import ChunkList +from twilio.rest.assistants.v1.knowledge.knowledge_status import KnowledgeStatusList class KnowledgeInstance(InstanceResource): @@ -32,6 +33,7 @@ class KnowledgeInstance(InstanceResource): :ivar name: The name of the knowledge source. :ivar status: The status of processing the knowledge source ('QUEUED', 'PROCESSING', 'COMPLETED', 'FAILED') :ivar type: The type of knowledge source ('Web', 'Database', 'Text', 'File') + :ivar url: The url of the knowledge resource. :ivar date_created: The date and time in GMT when the Knowledge was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. :ivar date_updated: The date and time in GMT when the Knowledge was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. """ @@ -50,6 +52,7 @@ def __init__( self.name: Optional[str] = payload.get("name") self.status: Optional[str] = payload.get("status") self.type: Optional[str] = payload.get("type") + self.url: Optional[str] = payload.get("url") self.date_created: Optional[datetime] = deserialize.iso8601_datetime( payload.get("date_created") ) @@ -154,6 +157,13 @@ def chunks(self) -> ChunkList: """ return self._proxy.chunks + @property + def knowledge_status(self) -> KnowledgeStatusList: + """ + Access the knowledge_status + """ + return self._proxy.knowledge_status + def __repr__(self) -> str: """ Provide a friendly representation @@ -182,6 +192,7 @@ def __init__(self, version: Version, id: str): self._uri = "/Knowledge/{id}".format(**self._solution) self._chunks: Optional[ChunkList] = None + self._knowledge_status: Optional[KnowledgeStatusList] = None def delete(self) -> bool: """ @@ -309,6 +320,18 @@ def chunks(self) -> ChunkList: ) return self._chunks + @property + def knowledge_status(self) -> KnowledgeStatusList: + """ + Access the knowledge_status + """ + if self._knowledge_status is None: + self._knowledge_status = KnowledgeStatusList( + self._version, + self._solution["id"], + ) + return self._knowledge_status + def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/assistants/v1/knowledge/knowledge_status.py b/twilio/rest/assistants/v1/knowledge/knowledge_status.py new file mode 100644 index 0000000000..14a56b0cc2 --- /dev/null +++ b/twilio/rest/assistants/v1/knowledge/knowledge_status.py @@ -0,0 +1,192 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Assistants + 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 datetime import datetime +from typing import Any, Dict, Optional +from twilio.base import deserialize +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class KnowledgeStatusInstance(InstanceResource): + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Knowledge resource. + :ivar status: The status of processing the knowledge source ('QUEUED', 'PROCESSING', 'COMPLETED', 'FAILED') + :ivar last_status: The last status of processing the knowledge source ('QUEUED', 'PROCESSING', 'COMPLETED', 'FAILED') + :ivar date_updated: The date and time in GMT when the Knowledge was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], id: str): + super().__init__(version) + + self.account_sid: Optional[str] = payload.get("account_sid") + self.status: Optional[str] = payload.get("status") + self.last_status: Optional[str] = payload.get("last_status") + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + + self._solution = { + "id": id, + } + self._context: Optional[KnowledgeStatusContext] = None + + @property + def _proxy(self) -> "KnowledgeStatusContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: KnowledgeStatusContext for this KnowledgeStatusInstance + """ + if self._context is None: + self._context = KnowledgeStatusContext( + self._version, + id=self._solution["id"], + ) + return self._context + + def fetch(self) -> "KnowledgeStatusInstance": + """ + Fetch the KnowledgeStatusInstance + + + :returns: The fetched KnowledgeStatusInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "KnowledgeStatusInstance": + """ + Asynchronous coroutine to fetch the KnowledgeStatusInstance + + + :returns: The fetched KnowledgeStatusInstance + """ + return await self._proxy.fetch_async() + + 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 KnowledgeStatusContext(InstanceContext): + + def __init__(self, version: Version, id: str): + """ + Initialize the KnowledgeStatusContext + + :param version: Version that contains the resource + :param id: the Knowledge ID. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "id": id, + } + self._uri = "/Knowledge/{id}/Status".format(**self._solution) + + def fetch(self) -> KnowledgeStatusInstance: + """ + Fetch the KnowledgeStatusInstance + + + :returns: The fetched KnowledgeStatusInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return KnowledgeStatusInstance( + self._version, + payload, + id=self._solution["id"], + ) + + async def fetch_async(self) -> KnowledgeStatusInstance: + """ + Asynchronous coroutine to fetch the KnowledgeStatusInstance + + + :returns: The fetched KnowledgeStatusInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return KnowledgeStatusInstance( + self._version, + payload, + id=self._solution["id"], + ) + + 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 KnowledgeStatusList(ListResource): + + def __init__(self, version: Version, id: str): + """ + Initialize the KnowledgeStatusList + + :param version: Version that contains the resource + :param id: the Knowledge ID. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "id": id, + } + + def get(self) -> KnowledgeStatusContext: + """ + Constructs a KnowledgeStatusContext + + """ + return KnowledgeStatusContext(self._version, id=self._solution["id"]) + + def __call__(self) -> KnowledgeStatusContext: + """ + Constructs a KnowledgeStatusContext + + """ + return KnowledgeStatusContext(self._version, id=self._solution["id"]) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/assistants/v1/tool.py b/twilio/rest/assistants/v1/tool.py index a66a818b5d..a8b1ac6472 100644 --- a/twilio/rest/assistants/v1/tool.py +++ b/twilio/rest/assistants/v1/tool.py @@ -32,8 +32,10 @@ class ToolInstance(InstanceResource): :ivar name: The name of the tool. :ivar requires_auth: The authentication requirement for the tool. :ivar type: The type of the tool. ('WEBHOOK') + :ivar url: The url of the tool resource. :ivar date_created: The date and time in GMT when the Tool was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. :ivar date_updated: The date and time in GMT when the Tool was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar policies: The Policies associated with the tool. """ def __init__( @@ -49,12 +51,14 @@ def __init__( self.name: Optional[str] = payload.get("name") self.requires_auth: Optional[bool] = payload.get("requires_auth") self.type: Optional[str] = payload.get("type") + self.url: Optional[str] = payload.get("url") self.date_created: Optional[datetime] = deserialize.iso8601_datetime( payload.get("date_created") ) self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( payload.get("date_updated") ) + self.policies: Optional[List[str]] = payload.get("policies") self._solution = { "id": id or self.id, @@ -94,6 +98,24 @@ async def delete_async(self) -> bool: """ return await self._proxy.delete_async() + def fetch(self) -> "ToolInstance": + """ + Fetch the ToolInstance + + + :returns: The fetched ToolInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "ToolInstance": + """ + Asynchronous coroutine to fetch the ToolInstance + + + :returns: The fetched ToolInstance + """ + return await self._proxy.fetch_async() + def update( self, assistants_v1_service_update_tool_request: Union[ @@ -179,6 +201,44 @@ async def delete_async(self) -> bool: uri=self._uri, ) + def fetch(self) -> ToolInstance: + """ + Fetch the ToolInstance + + + :returns: The fetched ToolInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return ToolInstance( + self._version, + payload, + id=self._solution["id"], + ) + + async def fetch_async(self) -> ToolInstance: + """ + Asynchronous coroutine to fetch the ToolInstance + + + :returns: The fetched ToolInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return ToolInstance( + self._version, + payload, + id=self._solution["id"], + ) + def update( self, assistants_v1_service_update_tool_request: Union[ diff --git a/twilio/rest/numbers/v1/__init__.py b/twilio/rest/numbers/v1/__init__.py index 043364c3d5..68f078a88d 100644 --- a/twilio/rest/numbers/v1/__init__.py +++ b/twilio/rest/numbers/v1/__init__.py @@ -28,12 +28,10 @@ from twilio.rest.numbers.v1.porting_webhook_configuration_delete import ( PortingWebhookConfigurationDeleteList, ) -from twilio.rest.numbers.v1.porting_webhook_configuration_fetch import ( - PortingWebhookConfigurationFetchList, -) from twilio.rest.numbers.v1.signing_request_configuration import ( SigningRequestConfigurationList, ) +from twilio.rest.numbers.v1.webhook import WebhookList class V1(Version): @@ -58,12 +56,10 @@ def __init__(self, domain: Domain): self._porting_webhook_configurations_delete: Optional[ PortingWebhookConfigurationDeleteList ] = None - self._porting_webhook_configuration_fetch: Optional[ - PortingWebhookConfigurationFetchList - ] = None self._signing_request_configurations: Optional[ SigningRequestConfigurationList ] = None + self._webhook: Optional[WebhookList] = None @property def bulk_eligibilities(self) -> BulkEligibilityList: @@ -111,22 +107,18 @@ def porting_webhook_configurations_delete( ) return self._porting_webhook_configurations_delete - @property - def porting_webhook_configuration_fetch( - self, - ) -> PortingWebhookConfigurationFetchList: - if self._porting_webhook_configuration_fetch is None: - self._porting_webhook_configuration_fetch = ( - PortingWebhookConfigurationFetchList(self) - ) - return self._porting_webhook_configuration_fetch - @property def signing_request_configurations(self) -> SigningRequestConfigurationList: if self._signing_request_configurations is None: self._signing_request_configurations = SigningRequestConfigurationList(self) return self._signing_request_configurations + @property + def webhook(self) -> WebhookList: + if self._webhook is None: + self._webhook = WebhookList(self) + return self._webhook + def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py b/twilio/rest/numbers/v1/webhook.py similarity index 77% rename from twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py rename to twilio/rest/numbers/v1/webhook.py index 89b8064bdb..88ca64e9e1 100644 --- a/twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py +++ b/twilio/rest/numbers/v1/webhook.py @@ -21,7 +21,7 @@ from twilio.base.version import Version -class PortingWebhookConfigurationFetchInstance(InstanceResource): +class WebhookInstance(InstanceResource): """ :ivar url: The URL of the webhook configuration request :ivar port_in_target_url: The complete webhook url that will be called when a notification event for port in request or port in phone number happens @@ -52,14 +52,14 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" -class PortingWebhookConfigurationFetchList(ListResource): +class WebhookList(ListResource): def __init__(self, version: Version): """ - Initialize the PortingWebhookConfigurationFetchList + Initialize the WebhookList :param version: Version that contains the resource @@ -68,25 +68,25 @@ def __init__(self, version: Version): self._uri = "/Porting/Configuration/Webhook" - def fetch(self) -> PortingWebhookConfigurationFetchInstance: + def fetch(self) -> WebhookInstance: """ - Asynchronously fetch the PortingWebhookConfigurationFetchInstance + Asynchronously fetch the WebhookInstance - :returns: The fetched PortingWebhookConfigurationFetchInstance + :returns: The fetched WebhookInstance """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) - return PortingWebhookConfigurationFetchInstance(self._version, payload) + return WebhookInstance(self._version, payload) - async def fetch_async(self) -> PortingWebhookConfigurationFetchInstance: + async def fetch_async(self) -> WebhookInstance: """ - Asynchronously fetch the PortingWebhookConfigurationFetchInstance + Asynchronously fetch the WebhookInstance - :returns: The fetched PortingWebhookConfigurationFetchInstance + :returns: The fetched WebhookInstance """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -94,7 +94,7 @@ async def fetch_async(self) -> PortingWebhookConfigurationFetchInstance: method="GET", uri=self._uri, headers=headers ) - return PortingWebhookConfigurationFetchInstance(self._version, payload) + return WebhookInstance(self._version, payload) def __repr__(self) -> str: """ @@ -102,4 +102,4 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" diff --git a/twilio/rest/serverless/v1/service/environment/deployment.py b/twilio/rest/serverless/v1/service/environment/deployment.py index 63ef1b4610..e9d86d0c37 100644 --- a/twilio/rest/serverless/v1/service/environment/deployment.py +++ b/twilio/rest/serverless/v1/service/environment/deployment.py @@ -14,7 +14,7 @@ from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values +from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -235,12 +235,15 @@ def __init__(self, version: Version, service_sid: str, environment_sid: str): ) def create( - self, build_sid: Union[str, object] = values.unset + self, + build_sid: Union[str, object] = values.unset, + is_plugin: Union[bool, object] = values.unset, ) -> DeploymentInstance: """ Create the DeploymentInstance :param build_sid: The SID of the Build for the Deployment. + :param is_plugin: Whether the Deployment is a plugin. :returns: The created DeploymentInstance """ @@ -248,6 +251,7 @@ def create( data = values.of( { "BuildSid": build_sid, + "IsPlugin": serialize.boolean_to_string(is_plugin), } ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -264,12 +268,15 @@ def create( ) async def create_async( - self, build_sid: Union[str, object] = values.unset + self, + build_sid: Union[str, object] = values.unset, + is_plugin: Union[bool, object] = values.unset, ) -> DeploymentInstance: """ Asynchronously create the DeploymentInstance :param build_sid: The SID of the Build for the Deployment. + :param is_plugin: Whether the Deployment is a plugin. :returns: The created DeploymentInstance """ @@ -277,6 +284,7 @@ async def create_async( data = values.of( { "BuildSid": build_sid, + "IsPlugin": serialize.boolean_to_string(is_plugin), } ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) From 0f81bbb865e29b67ab7bcc0cfe084894023faca5 Mon Sep 17 00:00:00 2001 From: Twilio Date: Wed, 25 Sep 2024 11:53:24 +0000 Subject: [PATCH 35/87] Release 9.3.2 --- setup.py | 2 +- twilio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index c3b935f109..be0c82e703 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name="twilio", - version="9.3.1", + version="9.3.2", description="Twilio API client and TwiML generator", author="Twilio", help_center="https://www.twilio.com/help/contact", diff --git a/twilio/__init__.py b/twilio/__init__.py index de97d54994..9c85cf3a45 100644 --- a/twilio/__init__.py +++ b/twilio/__init__.py @@ -1,2 +1,2 @@ -__version_info__ = ("9", "3", "1") +__version_info__ = ("9", "3", "2") __version__ = ".".join(__version_info__) From 7fc68cb385b22a783ed63fb503fca21828fe4d68 Mon Sep 17 00:00:00 2001 From: Shubham Date: Thu, 3 Oct 2024 15:08:15 +0530 Subject: [PATCH 36/87] chore: add assistants init files (#816) --- twilio/rest/assistants/__init__.py | 56 ++++++++++++++++++++++++++++++ twilio/rest/iam/__init__.py | 2 +- 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 twilio/rest/assistants/__init__.py diff --git a/twilio/rest/assistants/__init__.py b/twilio/rest/assistants/__init__.py new file mode 100644 index 0000000000..60c812014d --- /dev/null +++ b/twilio/rest/assistants/__init__.py @@ -0,0 +1,56 @@ +from warnings import warn + +from twilio.rest.assistants import AssistantsBase +from twilio.rest.assistants.v1.assistant import AssistantList +from twilio.rest.assistants.v1.knowledge import KnowledgeList +from twilio.rest.assistants.v1.policy import PolicyList +from twilio.rest.assistants.v1.session import SessionList +from twilio.rest.assistants.v1.tool import ToolList + + +class Assistants(AssistantsBase): + + @property + def assistants(self) -> AssistantList: + warn( + "assistants is deprecated. Use v1.assistants instead.", + DeprecationWarning, + stacklevel=2, + ) + return self.v1.assistants + + @property + def knowledge(self) -> KnowledgeList: + warn( + "knowledge is deprecated. Use v1.knowledge instead.", + DeprecationWarning, + stacklevel=2, + ) + return self.v1.knowledge + + @property + def policies(self) -> PolicyList: + warn( + "policies is deprecated. Use v1.policies instead.", + DeprecationWarning, + stacklevel=2, + ) + return self.v1.policies + + @property + def sessions(self) -> SessionList: + warn( + "sessions is deprecated. Use v1.sessions instead.", + DeprecationWarning, + stacklevel=2, + ) + return self.v1.sessions + + @property + def tools(self) -> ToolList: + warn( + "tools is deprecated. Use v1.tools instead.", + DeprecationWarning, + stacklevel=2, + ) + return self.v1.tools diff --git a/twilio/rest/iam/__init__.py b/twilio/rest/iam/__init__.py index 7a7819bcc2..f992caa578 100644 --- a/twilio/rest/iam/__init__.py +++ b/twilio/rest/iam/__init__.py @@ -6,7 +6,7 @@ from twilio.rest.iam.v1.new_api_key import NewApiKeyList -class Accounts(IamBase): +class Iam(IamBase): @property def api_key(self) -> ApiKeyList: warn( From 726c36a09758eeddb7f07fcd9859ac365c3c805a Mon Sep 17 00:00:00 2001 From: Twilio Date: Thu, 3 Oct 2024 15:38:15 +0000 Subject: [PATCH 37/87] [Librarian] Regenerated @ 021bab52f93b55d7a5786bd27716bf3a0be2d7b9 aa81ca7c51512c448626fafb32aeb46838510334 --- CHANGES.md | 16 + twilio/rest/iam/v1/__init__.py | 12 +- twilio/rest/iam/v1/{new_api_key.py => key.py} | 30 +- twilio/rest/numbers/v1/porting_portability.py | 24 +- twilio/rest/preview/PreviewBase.py | 11 - .../rest/preview/deployed_devices/__init__.py | 43 -- .../deployed_devices/fleet/__init__.py | 674 ----------------- .../deployed_devices/fleet/certificate.py | 656 ---------------- .../deployed_devices/fleet/deployment.py | 630 ---------------- .../preview/deployed_devices/fleet/device.py | 700 ------------------ .../preview/deployed_devices/fleet/key.py | 646 ---------------- .../taskrouter/v1/workspace/task/__init__.py | 12 +- twilio/rest/verify/v2/service/verification.py | 10 + .../verify/v2/service/verification_check.py | 6 + 14 files changed, 79 insertions(+), 3391 deletions(-) rename twilio/rest/iam/v1/{new_api_key.py => key.py} (88%) delete mode 100644 twilio/rest/preview/deployed_devices/__init__.py delete mode 100644 twilio/rest/preview/deployed_devices/fleet/__init__.py delete mode 100644 twilio/rest/preview/deployed_devices/fleet/certificate.py delete mode 100644 twilio/rest/preview/deployed_devices/fleet/deployment.py delete mode 100644 twilio/rest/preview/deployed_devices/fleet/device.py delete mode 100644 twilio/rest/preview/deployed_devices/fleet/key.py diff --git a/CHANGES.md b/CHANGES.md index 307f94f7d0..5808d307b5 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,22 @@ twilio-python Changelog Here you can see the full list of changes between each twilio-python release. +[2024-10-03] Version 9.3.3 +-------------------------- +**Library - Chore** +- [PR #816](https://github.com/twilio/twilio-python/pull/816): add assistants init files. Thanks to [@tiwarishubham635](https://github.com/tiwarishubham635)! + +**Messaging** +- Add A2P external campaign CnpMigration flag + +**Numbers** +- Add address sid to portability API + +**Verify** +- Add `SnaClientToken` optional parameter on Verification check. +- Add `EnableSnaClientToken` optional parameter for Verification creation. + + [2024-09-25] Version 9.3.2 -------------------------- **Accounts** diff --git a/twilio/rest/iam/v1/__init__.py b/twilio/rest/iam/v1/__init__.py index 0c46947341..408de11acb 100644 --- a/twilio/rest/iam/v1/__init__.py +++ b/twilio/rest/iam/v1/__init__.py @@ -17,7 +17,7 @@ from twilio.base.domain import Domain from twilio.rest.iam.v1.api_key import ApiKeyList from twilio.rest.iam.v1.get_api_keys import GetApiKeysList -from twilio.rest.iam.v1.new_api_key import NewApiKeyList +from twilio.rest.iam.v1.key import KeyList class V1(Version): @@ -31,7 +31,7 @@ def __init__(self, domain: Domain): super().__init__(domain, "v1") self._api_key: Optional[ApiKeyList] = None self._get_api_keys: Optional[GetApiKeysList] = None - self._new_api_key: Optional[NewApiKeyList] = None + self._keys: Optional[KeyList] = None @property def api_key(self) -> ApiKeyList: @@ -46,10 +46,10 @@ def get_api_keys(self) -> GetApiKeysList: return self._get_api_keys @property - def new_api_key(self) -> NewApiKeyList: - if self._new_api_key is None: - self._new_api_key = NewApiKeyList(self) - return self._new_api_key + def keys(self) -> KeyList: + if self._keys is None: + self._keys = KeyList(self) + return self._keys def __repr__(self) -> str: """ diff --git a/twilio/rest/iam/v1/new_api_key.py b/twilio/rest/iam/v1/key.py similarity index 88% rename from twilio/rest/iam/v1/new_api_key.py rename to twilio/rest/iam/v1/key.py index e3f9fa05a6..5adcbc6939 100644 --- a/twilio/rest/iam/v1/new_api_key.py +++ b/twilio/rest/iam/v1/key.py @@ -21,7 +21,7 @@ from twilio.base.version import Version -class NewApiKeyInstance(InstanceResource): +class KeyInstance(InstanceResource): class Keytype(object): RESTRICTED = "restricted" @@ -56,14 +56,14 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" -class NewApiKeyList(ListResource): +class KeyList(ListResource): def __init__(self, version: Version): """ - Initialize the NewApiKeyList + Initialize the KeyList :param version: Version that contains the resource @@ -76,18 +76,18 @@ def create( self, account_sid: str, friendly_name: Union[str, object] = values.unset, - key_type: Union["NewApiKeyInstance.Keytype", object] = values.unset, + key_type: Union["KeyInstance.Keytype", object] = values.unset, policy: Union[object, object] = values.unset, - ) -> NewApiKeyInstance: + ) -> KeyInstance: """ - Create the NewApiKeyInstance + Create the KeyInstance :param account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Payments resource. :param friendly_name: A descriptive string that you create to describe the resource. It can be up to 64 characters long. :param key_type: :param policy: The \\\\`Policy\\\\` object is a collection that specifies the allowed Twilio permissions for the restricted key. For more information on the permissions available with restricted API keys, refer to the [Twilio documentation](https://www.twilio.com/docs/iam/api-keys/restricted-api-keys#permissions-available-with-restricted-api-keys). - :returns: The created NewApiKeyInstance + :returns: The created KeyInstance """ data = values.of( @@ -104,24 +104,24 @@ def create( method="POST", uri=self._uri, data=data, headers=headers ) - return NewApiKeyInstance(self._version, payload) + return KeyInstance(self._version, payload) async def create_async( self, account_sid: str, friendly_name: Union[str, object] = values.unset, - key_type: Union["NewApiKeyInstance.Keytype", object] = values.unset, + key_type: Union["KeyInstance.Keytype", object] = values.unset, policy: Union[object, object] = values.unset, - ) -> NewApiKeyInstance: + ) -> KeyInstance: """ - Asynchronously create the NewApiKeyInstance + Asynchronously create the KeyInstance :param account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Payments resource. :param friendly_name: A descriptive string that you create to describe the resource. It can be up to 64 characters long. :param key_type: :param policy: The \\\\`Policy\\\\` object is a collection that specifies the allowed Twilio permissions for the restricted key. For more information on the permissions available with restricted API keys, refer to the [Twilio documentation](https://www.twilio.com/docs/iam/api-keys/restricted-api-keys#permissions-available-with-restricted-api-keys). - :returns: The created NewApiKeyInstance + :returns: The created KeyInstance """ data = values.of( @@ -138,7 +138,7 @@ async def create_async( method="POST", uri=self._uri, data=data, headers=headers ) - return NewApiKeyInstance(self._version, payload) + return KeyInstance(self._version, payload) def __repr__(self) -> str: """ @@ -146,4 +146,4 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" diff --git a/twilio/rest/numbers/v1/porting_portability.py b/twilio/rest/numbers/v1/porting_portability.py index 1f0fc210a4..826a69a243 100644 --- a/twilio/rest/numbers/v1/porting_portability.py +++ b/twilio/rest/numbers/v1/porting_portability.py @@ -85,31 +85,39 @@ def _proxy(self) -> "PortingPortabilityContext": return self._context def fetch( - self, target_account_sid: Union[str, object] = values.unset + self, + target_account_sid: Union[str, object] = values.unset, + address_sid: Union[str, object] = values.unset, ) -> "PortingPortabilityInstance": """ Fetch the PortingPortabilityInstance :param target_account_sid: Account Sid to which the number will be ported. This can be used to determine if a sub account already has the number in its inventory or a different sub account. If this is not provided, the authenticated account will be assumed to be the target account. + :param address_sid: Address Sid of customer to which the number will be ported. :returns: The fetched PortingPortabilityInstance """ return self._proxy.fetch( target_account_sid=target_account_sid, + address_sid=address_sid, ) async def fetch_async( - self, target_account_sid: Union[str, object] = values.unset + self, + target_account_sid: Union[str, object] = values.unset, + address_sid: Union[str, object] = values.unset, ) -> "PortingPortabilityInstance": """ Asynchronous coroutine to fetch the PortingPortabilityInstance :param target_account_sid: Account Sid to which the number will be ported. This can be used to determine if a sub account already has the number in its inventory or a different sub account. If this is not provided, the authenticated account will be assumed to be the target account. + :param address_sid: Address Sid of customer to which the number will be ported. :returns: The fetched PortingPortabilityInstance """ return await self._proxy.fetch_async( target_account_sid=target_account_sid, + address_sid=address_sid, ) def __repr__(self) -> str: @@ -142,12 +150,15 @@ def __init__(self, version: Version, phone_number: str): ) def fetch( - self, target_account_sid: Union[str, object] = values.unset + self, + target_account_sid: Union[str, object] = values.unset, + address_sid: Union[str, object] = values.unset, ) -> PortingPortabilityInstance: """ Fetch the PortingPortabilityInstance :param target_account_sid: Account Sid to which the number will be ported. This can be used to determine if a sub account already has the number in its inventory or a different sub account. If this is not provided, the authenticated account will be assumed to be the target account. + :param address_sid: Address Sid of customer to which the number will be ported. :returns: The fetched PortingPortabilityInstance """ @@ -155,6 +166,7 @@ def fetch( data = values.of( { "TargetAccountSid": target_account_sid, + "AddressSid": address_sid, } ) @@ -167,12 +179,15 @@ def fetch( ) async def fetch_async( - self, target_account_sid: Union[str, object] = values.unset + self, + target_account_sid: Union[str, object] = values.unset, + address_sid: Union[str, object] = values.unset, ) -> PortingPortabilityInstance: """ Asynchronous coroutine to fetch the PortingPortabilityInstance :param target_account_sid: Account Sid to which the number will be ported. This can be used to determine if a sub account already has the number in its inventory or a different sub account. If this is not provided, the authenticated account will be assumed to be the target account. + :param address_sid: Address Sid of customer to which the number will be ported. :returns: The fetched PortingPortabilityInstance """ @@ -180,6 +195,7 @@ async def fetch_async( data = values.of( { "TargetAccountSid": target_account_sid, + "AddressSid": address_sid, } ) diff --git a/twilio/rest/preview/PreviewBase.py b/twilio/rest/preview/PreviewBase.py index 6608a69a2c..2b44efaf63 100644 --- a/twilio/rest/preview/PreviewBase.py +++ b/twilio/rest/preview/PreviewBase.py @@ -13,7 +13,6 @@ from twilio.base.domain import Domain from twilio.rest import Client -from twilio.rest.preview.deployed_devices import DeployedDevices from twilio.rest.preview.hosted_numbers import HostedNumbers from twilio.rest.preview.sync import Sync from twilio.rest.preview.marketplace import Marketplace @@ -29,21 +28,11 @@ def __init__(self, twilio: Client): :returns: Domain for Preview """ super().__init__(twilio, "https://preview.twilio.com") - self._deployed_devices: Optional[DeployedDevices] = None self._hosted_numbers: Optional[HostedNumbers] = None self._sync: Optional[Sync] = None self._marketplace: Optional[Marketplace] = None self._wireless: Optional[Wireless] = None - @property - def deployed_devices(self) -> DeployedDevices: - """ - :returns: Versions deployed_devices of Preview - """ - if self._deployed_devices is None: - self._deployed_devices = DeployedDevices(self) - return self._deployed_devices - @property def hosted_numbers(self) -> HostedNumbers: """ diff --git a/twilio/rest/preview/deployed_devices/__init__.py b/twilio/rest/preview/deployed_devices/__init__.py deleted file mode 100644 index 795ee96566..0000000000 --- a/twilio/rest/preview/deployed_devices/__init__.py +++ /dev/null @@ -1,43 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Preview - 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 Optional -from twilio.base.version import Version -from twilio.base.domain import Domain -from twilio.rest.preview.deployed_devices.fleet import FleetList - - -class DeployedDevices(Version): - - def __init__(self, domain: Domain): - """ - Initialize the DeployedDevices version of Preview - - :param domain: The Twilio.preview domain - """ - super().__init__(domain, "DeployedDevices") - self._fleets: Optional[FleetList] = None - - @property - def fleets(self) -> FleetList: - if self._fleets is None: - self._fleets = FleetList(self) - return self._fleets - - def __repr__(self) -> str: - """ - Provide a friendly representation - :returns: Machine friendly representation - """ - return "" diff --git a/twilio/rest/preview/deployed_devices/fleet/__init__.py b/twilio/rest/preview/deployed_devices/fleet/__init__.py deleted file mode 100644 index f7321fdb2b..0000000000 --- a/twilio/rest/preview/deployed_devices/fleet/__init__.py +++ /dev/null @@ -1,674 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Preview - 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 datetime import datetime -from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.version import Version -from twilio.base.page import Page -from twilio.rest.preview.deployed_devices.fleet.certificate import CertificateList -from twilio.rest.preview.deployed_devices.fleet.deployment import DeploymentList -from twilio.rest.preview.deployed_devices.fleet.device import DeviceList -from twilio.rest.preview.deployed_devices.fleet.key import KeyList - - -class FleetInstance(InstanceResource): - """ - :ivar sid: Contains a 34 character string that uniquely identifies this Fleet resource. - :ivar url: Contains an absolute URL for this Fleet resource. - :ivar unique_name: Contains a unique and addressable name of this Fleet, e.g. 'default', up to 128 characters long. - :ivar friendly_name: Contains a human readable descriptive text for this Fleet, up to 256 characters long. - :ivar account_sid: Speicifies the unique string identifier of the Account responsible for this Fleet. - :ivar default_deployment_sid: Contains the string identifier of the automatically provisioned default Deployment of this Fleet. - :ivar date_created: Specifies the date this Fleet was created, given in UTC ISO 8601 format. - :ivar date_updated: Specifies the date this Fleet was last updated, given in UTC ISO 8601 format. - :ivar links: Contains a dictionary of URL links to nested resources of this Fleet. - """ - - def __init__( - self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None - ): - super().__init__(version) - - self.sid: Optional[str] = payload.get("sid") - self.url: Optional[str] = payload.get("url") - self.unique_name: Optional[str] = payload.get("unique_name") - self.friendly_name: Optional[str] = payload.get("friendly_name") - self.account_sid: Optional[str] = payload.get("account_sid") - self.default_deployment_sid: Optional[str] = payload.get( - "default_deployment_sid" - ) - self.date_created: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("date_created") - ) - self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("date_updated") - ) - self.links: Optional[Dict[str, object]] = payload.get("links") - - self._solution = { - "sid": sid or self.sid, - } - self._context: Optional[FleetContext] = None - - @property - def _proxy(self) -> "FleetContext": - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: FleetContext for this FleetInstance - """ - if self._context is None: - self._context = FleetContext( - self._version, - sid=self._solution["sid"], - ) - return self._context - - def delete(self) -> bool: - """ - Deletes the FleetInstance - - - :returns: True if delete succeeds, False otherwise - """ - return self._proxy.delete() - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the FleetInstance - - - :returns: True if delete succeeds, False otherwise - """ - return await self._proxy.delete_async() - - def fetch(self) -> "FleetInstance": - """ - Fetch the FleetInstance - - - :returns: The fetched FleetInstance - """ - return self._proxy.fetch() - - async def fetch_async(self) -> "FleetInstance": - """ - Asynchronous coroutine to fetch the FleetInstance - - - :returns: The fetched FleetInstance - """ - return await self._proxy.fetch_async() - - def update( - self, - friendly_name: Union[str, object] = values.unset, - default_deployment_sid: Union[str, object] = values.unset, - ) -> "FleetInstance": - """ - Update the FleetInstance - - :param friendly_name: Provides a human readable descriptive text for this Fleet, up to 256 characters long. - :param default_deployment_sid: Provides a string identifier of a Deployment that is going to be used as a default one for this Fleet. - - :returns: The updated FleetInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - default_deployment_sid=default_deployment_sid, - ) - - async def update_async( - self, - friendly_name: Union[str, object] = values.unset, - default_deployment_sid: Union[str, object] = values.unset, - ) -> "FleetInstance": - """ - Asynchronous coroutine to update the FleetInstance - - :param friendly_name: Provides a human readable descriptive text for this Fleet, up to 256 characters long. - :param default_deployment_sid: Provides a string identifier of a Deployment that is going to be used as a default one for this Fleet. - - :returns: The updated FleetInstance - """ - return await self._proxy.update_async( - friendly_name=friendly_name, - default_deployment_sid=default_deployment_sid, - ) - - @property - def certificates(self) -> CertificateList: - """ - Access the certificates - """ - return self._proxy.certificates - - @property - def deployments(self) -> DeploymentList: - """ - Access the deployments - """ - return self._proxy.deployments - - @property - def devices(self) -> DeviceList: - """ - Access the devices - """ - return self._proxy.devices - - @property - def keys(self) -> KeyList: - """ - Access the keys - """ - return self._proxy.keys - - 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 FleetContext(InstanceContext): - - def __init__(self, version: Version, sid: str): - """ - Initialize the FleetContext - - :param version: Version that contains the resource - :param sid: Provides a 34 character string that uniquely identifies the requested Fleet resource. - """ - super().__init__(version) - - # Path Solution - self._solution = { - "sid": sid, - } - self._uri = "/Fleets/{sid}".format(**self._solution) - - self._certificates: Optional[CertificateList] = None - self._deployments: Optional[DeploymentList] = None - self._devices: Optional[DeviceList] = None - self._keys: Optional[KeyList] = None - - def delete(self) -> bool: - """ - Deletes the FleetInstance - - - :returns: True if delete succeeds, False otherwise - """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the FleetInstance - - - :returns: True if delete succeeds, False otherwise - """ - return await self._version.delete_async( - method="DELETE", - uri=self._uri, - ) - - def fetch(self) -> FleetInstance: - """ - Fetch the FleetInstance - - - :returns: The fetched FleetInstance - """ - - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) - - return FleetInstance( - self._version, - payload, - sid=self._solution["sid"], - ) - - async def fetch_async(self) -> FleetInstance: - """ - Asynchronous coroutine to fetch the FleetInstance - - - :returns: The fetched FleetInstance - """ - - payload = await self._version.fetch_async( - method="GET", - uri=self._uri, - ) - - return FleetInstance( - self._version, - payload, - sid=self._solution["sid"], - ) - - def update( - self, - friendly_name: Union[str, object] = values.unset, - default_deployment_sid: Union[str, object] = values.unset, - ) -> FleetInstance: - """ - Update the FleetInstance - - :param friendly_name: Provides a human readable descriptive text for this Fleet, up to 256 characters long. - :param default_deployment_sid: Provides a string identifier of a Deployment that is going to be used as a default one for this Fleet. - - :returns: The updated FleetInstance - """ - data = values.of( - { - "FriendlyName": friendly_name, - "DefaultDeploymentSid": default_deployment_sid, - } - ) - - payload = self._version.update( - method="POST", - uri=self._uri, - data=data, - ) - - return FleetInstance(self._version, payload, sid=self._solution["sid"]) - - async def update_async( - self, - friendly_name: Union[str, object] = values.unset, - default_deployment_sid: Union[str, object] = values.unset, - ) -> FleetInstance: - """ - Asynchronous coroutine to update the FleetInstance - - :param friendly_name: Provides a human readable descriptive text for this Fleet, up to 256 characters long. - :param default_deployment_sid: Provides a string identifier of a Deployment that is going to be used as a default one for this Fleet. - - :returns: The updated FleetInstance - """ - data = values.of( - { - "FriendlyName": friendly_name, - "DefaultDeploymentSid": default_deployment_sid, - } - ) - - payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, - ) - - return FleetInstance(self._version, payload, sid=self._solution["sid"]) - - @property - def certificates(self) -> CertificateList: - """ - Access the certificates - """ - if self._certificates is None: - self._certificates = CertificateList( - self._version, - self._solution["sid"], - ) - return self._certificates - - @property - def deployments(self) -> DeploymentList: - """ - Access the deployments - """ - if self._deployments is None: - self._deployments = DeploymentList( - self._version, - self._solution["sid"], - ) - return self._deployments - - @property - def devices(self) -> DeviceList: - """ - Access the devices - """ - if self._devices is None: - self._devices = DeviceList( - self._version, - self._solution["sid"], - ) - return self._devices - - @property - def keys(self) -> KeyList: - """ - Access the keys - """ - if self._keys is None: - self._keys = KeyList( - self._version, - self._solution["sid"], - ) - return self._keys - - 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 FleetPage(Page): - - def get_instance(self, payload: Dict[str, Any]) -> FleetInstance: - """ - Build an instance of FleetInstance - - :param payload: Payload response from the API - """ - return FleetInstance(self._version, payload) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" - - -class FleetList(ListResource): - - def __init__(self, version: Version): - """ - Initialize the FleetList - - :param version: Version that contains the resource - - """ - super().__init__(version) - - self._uri = "/Fleets" - - def create(self, friendly_name: Union[str, object] = values.unset) -> FleetInstance: - """ - Create the FleetInstance - - :param friendly_name: Provides a human readable descriptive text for this Fleet, up to 256 characters long. - - :returns: The created FleetInstance - """ - - data = values.of( - { - "FriendlyName": friendly_name, - } - ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - payload = self._version.create( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return FleetInstance(self._version, payload) - - async def create_async( - self, friendly_name: Union[str, object] = values.unset - ) -> FleetInstance: - """ - Asynchronously create the FleetInstance - - :param friendly_name: Provides a human readable descriptive text for this Fleet, up to 256 characters long. - - :returns: The created FleetInstance - """ - - data = values.of( - { - "FriendlyName": friendly_name, - } - ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - payload = await self._version.create_async( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return FleetInstance(self._version, payload) - - def stream( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> Iterator[FleetInstance]: - """ - Streams FleetInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - """ - limits = self._version.read_limits(limit, page_size) - page = self.page(page_size=limits["page_size"]) - - return self._version.stream(page, limits["limit"]) - - async def stream_async( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> AsyncIterator[FleetInstance]: - """ - Asynchronously streams FleetInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - """ - limits = self._version.read_limits(limit, page_size) - page = await self.page_async(page_size=limits["page_size"]) - - return self._version.stream_async(page, limits["limit"]) - - def list( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[FleetInstance]: - """ - Lists FleetInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: list that will contain up to limit results - """ - return list( - self.stream( - limit=limit, - page_size=page_size, - ) - ) - - async def list_async( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[FleetInstance]: - """ - Asynchronously lists FleetInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: list that will contain up to limit results - """ - return [ - record - async for record in await self.stream_async( - limit=limit, - page_size=page_size, - ) - ] - - def page( - self, - page_token: Union[str, object] = values.unset, - page_number: Union[int, object] = values.unset, - page_size: Union[int, object] = values.unset, - ) -> FleetPage: - """ - Retrieve a single page of FleetInstance records from the API. - Request is executed immediately - - :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 - - :returns: Page of FleetInstance - """ - data = values.of( - { - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - response = self._version.page(method="GET", uri=self._uri, params=data) - return FleetPage(self._version, response) - - async def page_async( - self, - page_token: Union[str, object] = values.unset, - page_number: Union[int, object] = values.unset, - page_size: Union[int, object] = values.unset, - ) -> FleetPage: - """ - Asynchronously retrieve a single page of FleetInstance records from the API. - Request is executed immediately - - :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 - - :returns: Page of FleetInstance - """ - data = values.of( - { - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - response = await self._version.page_async( - method="GET", uri=self._uri, params=data - ) - return FleetPage(self._version, response) - - def get_page(self, target_url: str) -> FleetPage: - """ - Retrieve a specific page of FleetInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of FleetInstance - """ - response = self._version.domain.twilio.request("GET", target_url) - return FleetPage(self._version, response) - - async def get_page_async(self, target_url: str) -> FleetPage: - """ - Asynchronously retrieve a specific page of FleetInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of FleetInstance - """ - response = await self._version.domain.twilio.request_async("GET", target_url) - return FleetPage(self._version, response) - - def get(self, sid: str) -> FleetContext: - """ - Constructs a FleetContext - - :param sid: Provides a 34 character string that uniquely identifies the requested Fleet resource. - """ - return FleetContext(self._version, sid=sid) - - def __call__(self, sid: str) -> FleetContext: - """ - Constructs a FleetContext - - :param sid: Provides a 34 character string that uniquely identifies the requested Fleet resource. - """ - return FleetContext(self._version, sid=sid) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" diff --git a/twilio/rest/preview/deployed_devices/fleet/certificate.py b/twilio/rest/preview/deployed_devices/fleet/certificate.py deleted file mode 100644 index 895bdc5682..0000000000 --- a/twilio/rest/preview/deployed_devices/fleet/certificate.py +++ /dev/null @@ -1,656 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Preview - 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 datetime import datetime -from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.version import Version -from twilio.base.page import Page - - -class CertificateInstance(InstanceResource): - """ - :ivar sid: Contains a 34 character string that uniquely identifies this Certificate credential resource. - :ivar url: Contains an absolute URL for this Certificate credential resource. - :ivar friendly_name: Contains a human readable descriptive text for this Certificate credential, up to 256 characters long. - :ivar fleet_sid: Specifies the unique string identifier of the Fleet that the given Certificate credential belongs to. - :ivar account_sid: Specifies the unique string identifier of the Account responsible for this Certificate credential. - :ivar device_sid: Specifies the unique string identifier of a Device authenticated with this Certificate credential. - :ivar thumbprint: Contains a unique hash of the payload of this Certificate credential, used to authenticate the Device. - :ivar date_created: Specifies the date this Certificate credential was created, given in UTC ISO 8601 format. - :ivar date_updated: Specifies the date this Certificate credential was last updated, given in UTC ISO 8601 format. - """ - - def __init__( - self, - version: Version, - payload: Dict[str, Any], - fleet_sid: str, - sid: Optional[str] = None, - ): - super().__init__(version) - - self.sid: Optional[str] = payload.get("sid") - self.url: Optional[str] = payload.get("url") - self.friendly_name: Optional[str] = payload.get("friendly_name") - self.fleet_sid: Optional[str] = payload.get("fleet_sid") - self.account_sid: Optional[str] = payload.get("account_sid") - self.device_sid: Optional[str] = payload.get("device_sid") - self.thumbprint: Optional[str] = payload.get("thumbprint") - self.date_created: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("date_created") - ) - self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("date_updated") - ) - - self._solution = { - "fleet_sid": fleet_sid, - "sid": sid or self.sid, - } - self._context: Optional[CertificateContext] = None - - @property - def _proxy(self) -> "CertificateContext": - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CertificateContext for this CertificateInstance - """ - if self._context is None: - self._context = CertificateContext( - self._version, - fleet_sid=self._solution["fleet_sid"], - sid=self._solution["sid"], - ) - return self._context - - def delete(self) -> bool: - """ - Deletes the CertificateInstance - - - :returns: True if delete succeeds, False otherwise - """ - return self._proxy.delete() - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the CertificateInstance - - - :returns: True if delete succeeds, False otherwise - """ - return await self._proxy.delete_async() - - def fetch(self) -> "CertificateInstance": - """ - Fetch the CertificateInstance - - - :returns: The fetched CertificateInstance - """ - return self._proxy.fetch() - - async def fetch_async(self) -> "CertificateInstance": - """ - Asynchronous coroutine to fetch the CertificateInstance - - - :returns: The fetched CertificateInstance - """ - return await self._proxy.fetch_async() - - def update( - self, - friendly_name: Union[str, object] = values.unset, - device_sid: Union[str, object] = values.unset, - ) -> "CertificateInstance": - """ - Update the CertificateInstance - - :param friendly_name: Provides a human readable descriptive text for this Certificate credential, up to 256 characters long. - :param device_sid: Provides the unique string identifier of an existing Device to become authenticated with this Certificate credential. - - :returns: The updated CertificateInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - device_sid=device_sid, - ) - - async def update_async( - self, - friendly_name: Union[str, object] = values.unset, - device_sid: Union[str, object] = values.unset, - ) -> "CertificateInstance": - """ - Asynchronous coroutine to update the CertificateInstance - - :param friendly_name: Provides a human readable descriptive text for this Certificate credential, up to 256 characters long. - :param device_sid: Provides the unique string identifier of an existing Device to become authenticated with this Certificate credential. - - :returns: The updated CertificateInstance - """ - return await self._proxy.update_async( - friendly_name=friendly_name, - device_sid=device_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 CertificateContext(InstanceContext): - - def __init__(self, version: Version, fleet_sid: str, sid: str): - """ - Initialize the CertificateContext - - :param version: Version that contains the resource - :param fleet_sid: - :param sid: Provides a 34 character string that uniquely identifies the requested Certificate credential resource. - """ - super().__init__(version) - - # Path Solution - self._solution = { - "fleet_sid": fleet_sid, - "sid": sid, - } - self._uri = "/Fleets/{fleet_sid}/Certificates/{sid}".format(**self._solution) - - def delete(self) -> bool: - """ - Deletes the CertificateInstance - - - :returns: True if delete succeeds, False otherwise - """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the CertificateInstance - - - :returns: True if delete succeeds, False otherwise - """ - return await self._version.delete_async( - method="DELETE", - uri=self._uri, - ) - - def fetch(self) -> CertificateInstance: - """ - Fetch the CertificateInstance - - - :returns: The fetched CertificateInstance - """ - - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) - - return CertificateInstance( - self._version, - payload, - fleet_sid=self._solution["fleet_sid"], - sid=self._solution["sid"], - ) - - async def fetch_async(self) -> CertificateInstance: - """ - Asynchronous coroutine to fetch the CertificateInstance - - - :returns: The fetched CertificateInstance - """ - - payload = await self._version.fetch_async( - method="GET", - uri=self._uri, - ) - - return CertificateInstance( - self._version, - payload, - fleet_sid=self._solution["fleet_sid"], - sid=self._solution["sid"], - ) - - def update( - self, - friendly_name: Union[str, object] = values.unset, - device_sid: Union[str, object] = values.unset, - ) -> CertificateInstance: - """ - Update the CertificateInstance - - :param friendly_name: Provides a human readable descriptive text for this Certificate credential, up to 256 characters long. - :param device_sid: Provides the unique string identifier of an existing Device to become authenticated with this Certificate credential. - - :returns: The updated CertificateInstance - """ - data = values.of( - { - "FriendlyName": friendly_name, - "DeviceSid": device_sid, - } - ) - - payload = self._version.update( - method="POST", - uri=self._uri, - data=data, - ) - - return CertificateInstance( - self._version, - payload, - fleet_sid=self._solution["fleet_sid"], - sid=self._solution["sid"], - ) - - async def update_async( - self, - friendly_name: Union[str, object] = values.unset, - device_sid: Union[str, object] = values.unset, - ) -> CertificateInstance: - """ - Asynchronous coroutine to update the CertificateInstance - - :param friendly_name: Provides a human readable descriptive text for this Certificate credential, up to 256 characters long. - :param device_sid: Provides the unique string identifier of an existing Device to become authenticated with this Certificate credential. - - :returns: The updated CertificateInstance - """ - data = values.of( - { - "FriendlyName": friendly_name, - "DeviceSid": device_sid, - } - ) - - payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, - ) - - return CertificateInstance( - self._version, - payload, - fleet_sid=self._solution["fleet_sid"], - sid=self._solution["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 CertificatePage(Page): - - def get_instance(self, payload: Dict[str, Any]) -> CertificateInstance: - """ - Build an instance of CertificateInstance - - :param payload: Payload response from the API - """ - return CertificateInstance( - self._version, payload, fleet_sid=self._solution["fleet_sid"] - ) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" - - -class CertificateList(ListResource): - - def __init__(self, version: Version, fleet_sid: str): - """ - Initialize the CertificateList - - :param version: Version that contains the resource - :param fleet_sid: - - """ - super().__init__(version) - - # Path Solution - self._solution = { - "fleet_sid": fleet_sid, - } - self._uri = "/Fleets/{fleet_sid}/Certificates".format(**self._solution) - - def create( - self, - certificate_data: str, - friendly_name: Union[str, object] = values.unset, - device_sid: Union[str, object] = values.unset, - ) -> CertificateInstance: - """ - Create the CertificateInstance - - :param certificate_data: Provides a URL encoded representation of the public certificate in PEM format. - :param friendly_name: Provides a human readable descriptive text for this Certificate credential, up to 256 characters long. - :param device_sid: Provides the unique string identifier of an existing Device to become authenticated with this Certificate credential. - - :returns: The created CertificateInstance - """ - - data = values.of( - { - "CertificateData": certificate_data, - "FriendlyName": friendly_name, - "DeviceSid": device_sid, - } - ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - payload = self._version.create( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return CertificateInstance( - self._version, payload, fleet_sid=self._solution["fleet_sid"] - ) - - async def create_async( - self, - certificate_data: str, - friendly_name: Union[str, object] = values.unset, - device_sid: Union[str, object] = values.unset, - ) -> CertificateInstance: - """ - Asynchronously create the CertificateInstance - - :param certificate_data: Provides a URL encoded representation of the public certificate in PEM format. - :param friendly_name: Provides a human readable descriptive text for this Certificate credential, up to 256 characters long. - :param device_sid: Provides the unique string identifier of an existing Device to become authenticated with this Certificate credential. - - :returns: The created CertificateInstance - """ - - data = values.of( - { - "CertificateData": certificate_data, - "FriendlyName": friendly_name, - "DeviceSid": device_sid, - } - ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - payload = await self._version.create_async( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return CertificateInstance( - self._version, payload, fleet_sid=self._solution["fleet_sid"] - ) - - def stream( - self, - device_sid: Union[str, object] = values.unset, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> Iterator[CertificateInstance]: - """ - Streams CertificateInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param str device_sid: Filters the resulting list of Certificates by a unique string identifier of an authenticated Device. - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - """ - limits = self._version.read_limits(limit, page_size) - page = self.page(device_sid=device_sid, page_size=limits["page_size"]) - - return self._version.stream(page, limits["limit"]) - - async def stream_async( - self, - device_sid: Union[str, object] = values.unset, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> AsyncIterator[CertificateInstance]: - """ - Asynchronously streams CertificateInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param str device_sid: Filters the resulting list of Certificates by a unique string identifier of an authenticated Device. - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - """ - limits = self._version.read_limits(limit, page_size) - page = await self.page_async( - device_sid=device_sid, page_size=limits["page_size"] - ) - - return self._version.stream_async(page, limits["limit"]) - - def list( - self, - device_sid: Union[str, object] = values.unset, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[CertificateInstance]: - """ - Lists CertificateInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param str device_sid: Filters the resulting list of Certificates by a unique string identifier of an authenticated Device. - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: list that will contain up to limit results - """ - return list( - self.stream( - device_sid=device_sid, - limit=limit, - page_size=page_size, - ) - ) - - async def list_async( - self, - device_sid: Union[str, object] = values.unset, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[CertificateInstance]: - """ - Asynchronously lists CertificateInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param str device_sid: Filters the resulting list of Certificates by a unique string identifier of an authenticated Device. - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: list that will contain up to limit results - """ - return [ - record - async for record in await self.stream_async( - device_sid=device_sid, - limit=limit, - page_size=page_size, - ) - ] - - def page( - self, - device_sid: Union[str, object] = values.unset, - page_token: Union[str, object] = values.unset, - page_number: Union[int, object] = values.unset, - page_size: Union[int, object] = values.unset, - ) -> CertificatePage: - """ - Retrieve a single page of CertificateInstance records from the API. - Request is executed immediately - - :param device_sid: Filters the resulting list of Certificates by a unique string identifier of an authenticated Device. - :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 - - :returns: Page of CertificateInstance - """ - data = values.of( - { - "DeviceSid": device_sid, - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - response = self._version.page(method="GET", uri=self._uri, params=data) - return CertificatePage(self._version, response, self._solution) - - async def page_async( - self, - device_sid: Union[str, object] = values.unset, - page_token: Union[str, object] = values.unset, - page_number: Union[int, object] = values.unset, - page_size: Union[int, object] = values.unset, - ) -> CertificatePage: - """ - Asynchronously retrieve a single page of CertificateInstance records from the API. - Request is executed immediately - - :param device_sid: Filters the resulting list of Certificates by a unique string identifier of an authenticated Device. - :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 - - :returns: Page of CertificateInstance - """ - data = values.of( - { - "DeviceSid": device_sid, - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - response = await self._version.page_async( - method="GET", uri=self._uri, params=data - ) - return CertificatePage(self._version, response, self._solution) - - def get_page(self, target_url: str) -> CertificatePage: - """ - Retrieve a specific page of CertificateInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of CertificateInstance - """ - response = self._version.domain.twilio.request("GET", target_url) - return CertificatePage(self._version, response, self._solution) - - async def get_page_async(self, target_url: str) -> CertificatePage: - """ - Asynchronously retrieve a specific page of CertificateInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of CertificateInstance - """ - response = await self._version.domain.twilio.request_async("GET", target_url) - return CertificatePage(self._version, response, self._solution) - - def get(self, sid: str) -> CertificateContext: - """ - Constructs a CertificateContext - - :param sid: Provides a 34 character string that uniquely identifies the requested Certificate credential resource. - """ - return CertificateContext( - self._version, fleet_sid=self._solution["fleet_sid"], sid=sid - ) - - def __call__(self, sid: str) -> CertificateContext: - """ - Constructs a CertificateContext - - :param sid: Provides a 34 character string that uniquely identifies the requested Certificate credential resource. - """ - return CertificateContext( - self._version, fleet_sid=self._solution["fleet_sid"], sid=sid - ) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" diff --git a/twilio/rest/preview/deployed_devices/fleet/deployment.py b/twilio/rest/preview/deployed_devices/fleet/deployment.py deleted file mode 100644 index 80f9f2372d..0000000000 --- a/twilio/rest/preview/deployed_devices/fleet/deployment.py +++ /dev/null @@ -1,630 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Preview - 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 datetime import datetime -from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.version import Version -from twilio.base.page import Page - - -class DeploymentInstance(InstanceResource): - """ - :ivar sid: Contains a 34 character string that uniquely identifies this Deployment resource. - :ivar url: Contains an absolute URL for this Deployment resource. - :ivar friendly_name: Contains a human readable descriptive text for this Deployment, up to 64 characters long - :ivar fleet_sid: Specifies the unique string identifier of the Fleet that the given Deployment belongs to. - :ivar account_sid: Specifies the unique string identifier of the Account responsible for this Deployment. - :ivar sync_service_sid: Specifies the unique string identifier of the Twilio Sync service instance linked to and accessible by this Deployment. - :ivar date_created: Specifies the date this Deployment was created, given in UTC ISO 8601 format. - :ivar date_updated: Specifies the date this Deployment was last updated, given in UTC ISO 8601 format. - """ - - def __init__( - self, - version: Version, - payload: Dict[str, Any], - fleet_sid: str, - sid: Optional[str] = None, - ): - super().__init__(version) - - self.sid: Optional[str] = payload.get("sid") - self.url: Optional[str] = payload.get("url") - self.friendly_name: Optional[str] = payload.get("friendly_name") - self.fleet_sid: Optional[str] = payload.get("fleet_sid") - self.account_sid: Optional[str] = payload.get("account_sid") - self.sync_service_sid: Optional[str] = payload.get("sync_service_sid") - self.date_created: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("date_created") - ) - self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("date_updated") - ) - - self._solution = { - "fleet_sid": fleet_sid, - "sid": sid or self.sid, - } - self._context: Optional[DeploymentContext] = None - - @property - def _proxy(self) -> "DeploymentContext": - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: DeploymentContext for this DeploymentInstance - """ - if self._context is None: - self._context = DeploymentContext( - self._version, - fleet_sid=self._solution["fleet_sid"], - sid=self._solution["sid"], - ) - return self._context - - def delete(self) -> bool: - """ - Deletes the DeploymentInstance - - - :returns: True if delete succeeds, False otherwise - """ - return self._proxy.delete() - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the DeploymentInstance - - - :returns: True if delete succeeds, False otherwise - """ - return await self._proxy.delete_async() - - def fetch(self) -> "DeploymentInstance": - """ - Fetch the DeploymentInstance - - - :returns: The fetched DeploymentInstance - """ - return self._proxy.fetch() - - async def fetch_async(self) -> "DeploymentInstance": - """ - Asynchronous coroutine to fetch the DeploymentInstance - - - :returns: The fetched DeploymentInstance - """ - return await self._proxy.fetch_async() - - def update( - self, - friendly_name: Union[str, object] = values.unset, - sync_service_sid: Union[str, object] = values.unset, - ) -> "DeploymentInstance": - """ - Update the DeploymentInstance - - :param friendly_name: Provides a human readable descriptive text for this Deployment, up to 64 characters long - :param sync_service_sid: Provides the unique string identifier of the Twilio Sync service instance that will be linked to and accessible by this Deployment. - - :returns: The updated DeploymentInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - sync_service_sid=sync_service_sid, - ) - - async def update_async( - self, - friendly_name: Union[str, object] = values.unset, - sync_service_sid: Union[str, object] = values.unset, - ) -> "DeploymentInstance": - """ - Asynchronous coroutine to update the DeploymentInstance - - :param friendly_name: Provides a human readable descriptive text for this Deployment, up to 64 characters long - :param sync_service_sid: Provides the unique string identifier of the Twilio Sync service instance that will be linked to and accessible by this Deployment. - - :returns: The updated DeploymentInstance - """ - return await self._proxy.update_async( - friendly_name=friendly_name, - sync_service_sid=sync_service_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 DeploymentContext(InstanceContext): - - def __init__(self, version: Version, fleet_sid: str, sid: str): - """ - Initialize the DeploymentContext - - :param version: Version that contains the resource - :param fleet_sid: - :param sid: Provides a 34 character string that uniquely identifies the requested Deployment resource. - """ - super().__init__(version) - - # Path Solution - self._solution = { - "fleet_sid": fleet_sid, - "sid": sid, - } - self._uri = "/Fleets/{fleet_sid}/Deployments/{sid}".format(**self._solution) - - def delete(self) -> bool: - """ - Deletes the DeploymentInstance - - - :returns: True if delete succeeds, False otherwise - """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the DeploymentInstance - - - :returns: True if delete succeeds, False otherwise - """ - return await self._version.delete_async( - method="DELETE", - uri=self._uri, - ) - - def fetch(self) -> DeploymentInstance: - """ - Fetch the DeploymentInstance - - - :returns: The fetched DeploymentInstance - """ - - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) - - return DeploymentInstance( - self._version, - payload, - fleet_sid=self._solution["fleet_sid"], - sid=self._solution["sid"], - ) - - async def fetch_async(self) -> DeploymentInstance: - """ - Asynchronous coroutine to fetch the DeploymentInstance - - - :returns: The fetched DeploymentInstance - """ - - payload = await self._version.fetch_async( - method="GET", - uri=self._uri, - ) - - return DeploymentInstance( - self._version, - payload, - fleet_sid=self._solution["fleet_sid"], - sid=self._solution["sid"], - ) - - def update( - self, - friendly_name: Union[str, object] = values.unset, - sync_service_sid: Union[str, object] = values.unset, - ) -> DeploymentInstance: - """ - Update the DeploymentInstance - - :param friendly_name: Provides a human readable descriptive text for this Deployment, up to 64 characters long - :param sync_service_sid: Provides the unique string identifier of the Twilio Sync service instance that will be linked to and accessible by this Deployment. - - :returns: The updated DeploymentInstance - """ - data = values.of( - { - "FriendlyName": friendly_name, - "SyncServiceSid": sync_service_sid, - } - ) - - payload = self._version.update( - method="POST", - uri=self._uri, - data=data, - ) - - return DeploymentInstance( - self._version, - payload, - fleet_sid=self._solution["fleet_sid"], - sid=self._solution["sid"], - ) - - async def update_async( - self, - friendly_name: Union[str, object] = values.unset, - sync_service_sid: Union[str, object] = values.unset, - ) -> DeploymentInstance: - """ - Asynchronous coroutine to update the DeploymentInstance - - :param friendly_name: Provides a human readable descriptive text for this Deployment, up to 64 characters long - :param sync_service_sid: Provides the unique string identifier of the Twilio Sync service instance that will be linked to and accessible by this Deployment. - - :returns: The updated DeploymentInstance - """ - data = values.of( - { - "FriendlyName": friendly_name, - "SyncServiceSid": sync_service_sid, - } - ) - - payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, - ) - - return DeploymentInstance( - self._version, - payload, - fleet_sid=self._solution["fleet_sid"], - sid=self._solution["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 DeploymentPage(Page): - - def get_instance(self, payload: Dict[str, Any]) -> DeploymentInstance: - """ - Build an instance of DeploymentInstance - - :param payload: Payload response from the API - """ - return DeploymentInstance( - self._version, payload, fleet_sid=self._solution["fleet_sid"] - ) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" - - -class DeploymentList(ListResource): - - def __init__(self, version: Version, fleet_sid: str): - """ - Initialize the DeploymentList - - :param version: Version that contains the resource - :param fleet_sid: - - """ - super().__init__(version) - - # Path Solution - self._solution = { - "fleet_sid": fleet_sid, - } - self._uri = "/Fleets/{fleet_sid}/Deployments".format(**self._solution) - - def create( - self, - friendly_name: Union[str, object] = values.unset, - sync_service_sid: Union[str, object] = values.unset, - ) -> DeploymentInstance: - """ - Create the DeploymentInstance - - :param friendly_name: Provides a human readable descriptive text for this Deployment, up to 256 characters long. - :param sync_service_sid: Provides the unique string identifier of the Twilio Sync service instance that will be linked to and accessible by this Deployment. - - :returns: The created DeploymentInstance - """ - - data = values.of( - { - "FriendlyName": friendly_name, - "SyncServiceSid": sync_service_sid, - } - ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - payload = self._version.create( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return DeploymentInstance( - self._version, payload, fleet_sid=self._solution["fleet_sid"] - ) - - async def create_async( - self, - friendly_name: Union[str, object] = values.unset, - sync_service_sid: Union[str, object] = values.unset, - ) -> DeploymentInstance: - """ - Asynchronously create the DeploymentInstance - - :param friendly_name: Provides a human readable descriptive text for this Deployment, up to 256 characters long. - :param sync_service_sid: Provides the unique string identifier of the Twilio Sync service instance that will be linked to and accessible by this Deployment. - - :returns: The created DeploymentInstance - """ - - data = values.of( - { - "FriendlyName": friendly_name, - "SyncServiceSid": sync_service_sid, - } - ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - payload = await self._version.create_async( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return DeploymentInstance( - self._version, payload, fleet_sid=self._solution["fleet_sid"] - ) - - def stream( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> Iterator[DeploymentInstance]: - """ - Streams DeploymentInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - """ - limits = self._version.read_limits(limit, page_size) - page = self.page(page_size=limits["page_size"]) - - return self._version.stream(page, limits["limit"]) - - async def stream_async( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> AsyncIterator[DeploymentInstance]: - """ - Asynchronously streams DeploymentInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - """ - limits = self._version.read_limits(limit, page_size) - page = await self.page_async(page_size=limits["page_size"]) - - return self._version.stream_async(page, limits["limit"]) - - def list( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[DeploymentInstance]: - """ - Lists DeploymentInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: list that will contain up to limit results - """ - return list( - self.stream( - limit=limit, - page_size=page_size, - ) - ) - - async def list_async( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[DeploymentInstance]: - """ - Asynchronously lists DeploymentInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: list that will contain up to limit results - """ - return [ - record - async for record in await self.stream_async( - limit=limit, - page_size=page_size, - ) - ] - - def page( - self, - page_token: Union[str, object] = values.unset, - page_number: Union[int, object] = values.unset, - page_size: Union[int, object] = values.unset, - ) -> DeploymentPage: - """ - Retrieve a single page of DeploymentInstance records from the API. - Request is executed immediately - - :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 - - :returns: Page of DeploymentInstance - """ - data = values.of( - { - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - response = self._version.page(method="GET", uri=self._uri, params=data) - return DeploymentPage(self._version, response, self._solution) - - async def page_async( - self, - page_token: Union[str, object] = values.unset, - page_number: Union[int, object] = values.unset, - page_size: Union[int, object] = values.unset, - ) -> DeploymentPage: - """ - Asynchronously retrieve a single page of DeploymentInstance records from the API. - Request is executed immediately - - :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 - - :returns: Page of DeploymentInstance - """ - data = values.of( - { - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - response = await self._version.page_async( - method="GET", uri=self._uri, params=data - ) - return DeploymentPage(self._version, response, self._solution) - - def get_page(self, target_url: str) -> DeploymentPage: - """ - Retrieve a specific page of DeploymentInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of DeploymentInstance - """ - response = self._version.domain.twilio.request("GET", target_url) - return DeploymentPage(self._version, response, self._solution) - - async def get_page_async(self, target_url: str) -> DeploymentPage: - """ - Asynchronously retrieve a specific page of DeploymentInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of DeploymentInstance - """ - response = await self._version.domain.twilio.request_async("GET", target_url) - return DeploymentPage(self._version, response, self._solution) - - def get(self, sid: str) -> DeploymentContext: - """ - Constructs a DeploymentContext - - :param sid: Provides a 34 character string that uniquely identifies the requested Deployment resource. - """ - return DeploymentContext( - self._version, fleet_sid=self._solution["fleet_sid"], sid=sid - ) - - def __call__(self, sid: str) -> DeploymentContext: - """ - Constructs a DeploymentContext - - :param sid: Provides a 34 character string that uniquely identifies the requested Deployment resource. - """ - return DeploymentContext( - self._version, fleet_sid=self._solution["fleet_sid"], sid=sid - ) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" diff --git a/twilio/rest/preview/deployed_devices/fleet/device.py b/twilio/rest/preview/deployed_devices/fleet/device.py deleted file mode 100644 index 3cacc88f2b..0000000000 --- a/twilio/rest/preview/deployed_devices/fleet/device.py +++ /dev/null @@ -1,700 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Preview - 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 datetime import datetime -from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, serialize, values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.version import Version -from twilio.base.page import Page - - -class DeviceInstance(InstanceResource): - """ - :ivar sid: Contains a 34 character string that uniquely identifies this Device resource. - :ivar url: Contains an absolute URL for this Device resource. - :ivar unique_name: Contains a unique and addressable name of this Device, assigned by the developer, up to 128 characters long. - :ivar friendly_name: Contains a human readable descriptive text for this Device, up to 256 characters long - :ivar fleet_sid: Specifies the unique string identifier of the Fleet that the given Device belongs to. - :ivar enabled: Contains a boolean flag indicating whether the device is enabled or not, blocks device connectivity if set to false. - :ivar account_sid: Specifies the unique string identifier of the Account responsible for this Device. - :ivar identity: Contains an arbitrary string identifier representing a human user associated with this Device, assigned by the developer, up to 256 characters long. - :ivar deployment_sid: Specifies the unique string identifier of the Deployment group that this Device is associated with. - :ivar date_created: Specifies the date this Device was created, given in UTC ISO 8601 format. - :ivar date_updated: Specifies the date this Device was last updated, given in UTC ISO 8601 format. - :ivar date_authenticated: Specifies the date this Device was last authenticated, given in UTC ISO 8601 format. - """ - - def __init__( - self, - version: Version, - payload: Dict[str, Any], - fleet_sid: str, - sid: Optional[str] = None, - ): - super().__init__(version) - - self.sid: Optional[str] = payload.get("sid") - self.url: Optional[str] = payload.get("url") - self.unique_name: Optional[str] = payload.get("unique_name") - self.friendly_name: Optional[str] = payload.get("friendly_name") - self.fleet_sid: Optional[str] = payload.get("fleet_sid") - self.enabled: Optional[bool] = payload.get("enabled") - self.account_sid: Optional[str] = payload.get("account_sid") - self.identity: Optional[str] = payload.get("identity") - self.deployment_sid: Optional[str] = payload.get("deployment_sid") - self.date_created: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("date_created") - ) - self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("date_updated") - ) - self.date_authenticated: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("date_authenticated") - ) - - self._solution = { - "fleet_sid": fleet_sid, - "sid": sid or self.sid, - } - self._context: Optional[DeviceContext] = None - - @property - def _proxy(self) -> "DeviceContext": - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: DeviceContext for this DeviceInstance - """ - if self._context is None: - self._context = DeviceContext( - self._version, - fleet_sid=self._solution["fleet_sid"], - sid=self._solution["sid"], - ) - return self._context - - def delete(self) -> bool: - """ - Deletes the DeviceInstance - - - :returns: True if delete succeeds, False otherwise - """ - return self._proxy.delete() - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the DeviceInstance - - - :returns: True if delete succeeds, False otherwise - """ - return await self._proxy.delete_async() - - def fetch(self) -> "DeviceInstance": - """ - Fetch the DeviceInstance - - - :returns: The fetched DeviceInstance - """ - return self._proxy.fetch() - - async def fetch_async(self) -> "DeviceInstance": - """ - Asynchronous coroutine to fetch the DeviceInstance - - - :returns: The fetched DeviceInstance - """ - return await self._proxy.fetch_async() - - def update( - self, - friendly_name: Union[str, object] = values.unset, - identity: Union[str, object] = values.unset, - deployment_sid: Union[str, object] = values.unset, - enabled: Union[bool, object] = values.unset, - ) -> "DeviceInstance": - """ - Update the DeviceInstance - - :param friendly_name: Provides a human readable descriptive text to be assigned to this Device, up to 256 characters long. - :param identity: Provides an arbitrary string identifier representing a human user to be associated with this Device, up to 256 characters long. - :param deployment_sid: Specifies the unique string identifier of the Deployment group that this Device is going to be associated with. - :param enabled: - - :returns: The updated DeviceInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - identity=identity, - deployment_sid=deployment_sid, - enabled=enabled, - ) - - async def update_async( - self, - friendly_name: Union[str, object] = values.unset, - identity: Union[str, object] = values.unset, - deployment_sid: Union[str, object] = values.unset, - enabled: Union[bool, object] = values.unset, - ) -> "DeviceInstance": - """ - Asynchronous coroutine to update the DeviceInstance - - :param friendly_name: Provides a human readable descriptive text to be assigned to this Device, up to 256 characters long. - :param identity: Provides an arbitrary string identifier representing a human user to be associated with this Device, up to 256 characters long. - :param deployment_sid: Specifies the unique string identifier of the Deployment group that this Device is going to be associated with. - :param enabled: - - :returns: The updated DeviceInstance - """ - return await self._proxy.update_async( - friendly_name=friendly_name, - identity=identity, - deployment_sid=deployment_sid, - enabled=enabled, - ) - - 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 DeviceContext(InstanceContext): - - def __init__(self, version: Version, fleet_sid: str, sid: str): - """ - Initialize the DeviceContext - - :param version: Version that contains the resource - :param fleet_sid: - :param sid: Provides a 34 character string that uniquely identifies the requested Device resource. - """ - super().__init__(version) - - # Path Solution - self._solution = { - "fleet_sid": fleet_sid, - "sid": sid, - } - self._uri = "/Fleets/{fleet_sid}/Devices/{sid}".format(**self._solution) - - def delete(self) -> bool: - """ - Deletes the DeviceInstance - - - :returns: True if delete succeeds, False otherwise - """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the DeviceInstance - - - :returns: True if delete succeeds, False otherwise - """ - return await self._version.delete_async( - method="DELETE", - uri=self._uri, - ) - - def fetch(self) -> DeviceInstance: - """ - Fetch the DeviceInstance - - - :returns: The fetched DeviceInstance - """ - - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) - - return DeviceInstance( - self._version, - payload, - fleet_sid=self._solution["fleet_sid"], - sid=self._solution["sid"], - ) - - async def fetch_async(self) -> DeviceInstance: - """ - Asynchronous coroutine to fetch the DeviceInstance - - - :returns: The fetched DeviceInstance - """ - - payload = await self._version.fetch_async( - method="GET", - uri=self._uri, - ) - - return DeviceInstance( - self._version, - payload, - fleet_sid=self._solution["fleet_sid"], - sid=self._solution["sid"], - ) - - def update( - self, - friendly_name: Union[str, object] = values.unset, - identity: Union[str, object] = values.unset, - deployment_sid: Union[str, object] = values.unset, - enabled: Union[bool, object] = values.unset, - ) -> DeviceInstance: - """ - Update the DeviceInstance - - :param friendly_name: Provides a human readable descriptive text to be assigned to this Device, up to 256 characters long. - :param identity: Provides an arbitrary string identifier representing a human user to be associated with this Device, up to 256 characters long. - :param deployment_sid: Specifies the unique string identifier of the Deployment group that this Device is going to be associated with. - :param enabled: - - :returns: The updated DeviceInstance - """ - data = values.of( - { - "FriendlyName": friendly_name, - "Identity": identity, - "DeploymentSid": deployment_sid, - "Enabled": serialize.boolean_to_string(enabled), - } - ) - - payload = self._version.update( - method="POST", - uri=self._uri, - data=data, - ) - - return DeviceInstance( - self._version, - payload, - fleet_sid=self._solution["fleet_sid"], - sid=self._solution["sid"], - ) - - async def update_async( - self, - friendly_name: Union[str, object] = values.unset, - identity: Union[str, object] = values.unset, - deployment_sid: Union[str, object] = values.unset, - enabled: Union[bool, object] = values.unset, - ) -> DeviceInstance: - """ - Asynchronous coroutine to update the DeviceInstance - - :param friendly_name: Provides a human readable descriptive text to be assigned to this Device, up to 256 characters long. - :param identity: Provides an arbitrary string identifier representing a human user to be associated with this Device, up to 256 characters long. - :param deployment_sid: Specifies the unique string identifier of the Deployment group that this Device is going to be associated with. - :param enabled: - - :returns: The updated DeviceInstance - """ - data = values.of( - { - "FriendlyName": friendly_name, - "Identity": identity, - "DeploymentSid": deployment_sid, - "Enabled": serialize.boolean_to_string(enabled), - } - ) - - payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, - ) - - return DeviceInstance( - self._version, - payload, - fleet_sid=self._solution["fleet_sid"], - sid=self._solution["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 DevicePage(Page): - - def get_instance(self, payload: Dict[str, Any]) -> DeviceInstance: - """ - Build an instance of DeviceInstance - - :param payload: Payload response from the API - """ - return DeviceInstance( - self._version, payload, fleet_sid=self._solution["fleet_sid"] - ) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" - - -class DeviceList(ListResource): - - def __init__(self, version: Version, fleet_sid: str): - """ - Initialize the DeviceList - - :param version: Version that contains the resource - :param fleet_sid: - - """ - super().__init__(version) - - # Path Solution - self._solution = { - "fleet_sid": fleet_sid, - } - self._uri = "/Fleets/{fleet_sid}/Devices".format(**self._solution) - - def create( - self, - unique_name: Union[str, object] = values.unset, - friendly_name: Union[str, object] = values.unset, - identity: Union[str, object] = values.unset, - deployment_sid: Union[str, object] = values.unset, - enabled: Union[bool, object] = values.unset, - ) -> DeviceInstance: - """ - Create the DeviceInstance - - :param unique_name: Provides a unique and addressable name to be assigned to this Device, to be used in addition to SID, up to 128 characters long. - :param friendly_name: Provides a human readable descriptive text to be assigned to this Device, up to 256 characters long. - :param identity: Provides an arbitrary string identifier representing a human user to be associated with this Device, up to 256 characters long. - :param deployment_sid: Specifies the unique string identifier of the Deployment group that this Device is going to be associated with. - :param enabled: - - :returns: The created DeviceInstance - """ - - data = values.of( - { - "UniqueName": unique_name, - "FriendlyName": friendly_name, - "Identity": identity, - "DeploymentSid": deployment_sid, - "Enabled": serialize.boolean_to_string(enabled), - } - ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - payload = self._version.create( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return DeviceInstance( - self._version, payload, fleet_sid=self._solution["fleet_sid"] - ) - - async def create_async( - self, - unique_name: Union[str, object] = values.unset, - friendly_name: Union[str, object] = values.unset, - identity: Union[str, object] = values.unset, - deployment_sid: Union[str, object] = values.unset, - enabled: Union[bool, object] = values.unset, - ) -> DeviceInstance: - """ - Asynchronously create the DeviceInstance - - :param unique_name: Provides a unique and addressable name to be assigned to this Device, to be used in addition to SID, up to 128 characters long. - :param friendly_name: Provides a human readable descriptive text to be assigned to this Device, up to 256 characters long. - :param identity: Provides an arbitrary string identifier representing a human user to be associated with this Device, up to 256 characters long. - :param deployment_sid: Specifies the unique string identifier of the Deployment group that this Device is going to be associated with. - :param enabled: - - :returns: The created DeviceInstance - """ - - data = values.of( - { - "UniqueName": unique_name, - "FriendlyName": friendly_name, - "Identity": identity, - "DeploymentSid": deployment_sid, - "Enabled": serialize.boolean_to_string(enabled), - } - ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - payload = await self._version.create_async( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return DeviceInstance( - self._version, payload, fleet_sid=self._solution["fleet_sid"] - ) - - def stream( - self, - deployment_sid: Union[str, object] = values.unset, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> Iterator[DeviceInstance]: - """ - Streams DeviceInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param str deployment_sid: Filters the resulting list of Devices by a unique string identifier of the Deployment they are associated with. - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - """ - limits = self._version.read_limits(limit, page_size) - page = self.page(deployment_sid=deployment_sid, page_size=limits["page_size"]) - - return self._version.stream(page, limits["limit"]) - - async def stream_async( - self, - deployment_sid: Union[str, object] = values.unset, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> AsyncIterator[DeviceInstance]: - """ - Asynchronously streams DeviceInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param str deployment_sid: Filters the resulting list of Devices by a unique string identifier of the Deployment they are associated with. - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - """ - limits = self._version.read_limits(limit, page_size) - page = await self.page_async( - deployment_sid=deployment_sid, page_size=limits["page_size"] - ) - - return self._version.stream_async(page, limits["limit"]) - - def list( - self, - deployment_sid: Union[str, object] = values.unset, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[DeviceInstance]: - """ - Lists DeviceInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param str deployment_sid: Filters the resulting list of Devices by a unique string identifier of the Deployment they are associated with. - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: list that will contain up to limit results - """ - return list( - self.stream( - deployment_sid=deployment_sid, - limit=limit, - page_size=page_size, - ) - ) - - async def list_async( - self, - deployment_sid: Union[str, object] = values.unset, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[DeviceInstance]: - """ - Asynchronously lists DeviceInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param str deployment_sid: Filters the resulting list of Devices by a unique string identifier of the Deployment they are associated with. - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: list that will contain up to limit results - """ - return [ - record - async for record in await self.stream_async( - deployment_sid=deployment_sid, - limit=limit, - page_size=page_size, - ) - ] - - def page( - self, - deployment_sid: Union[str, object] = values.unset, - page_token: Union[str, object] = values.unset, - page_number: Union[int, object] = values.unset, - page_size: Union[int, object] = values.unset, - ) -> DevicePage: - """ - Retrieve a single page of DeviceInstance records from the API. - Request is executed immediately - - :param deployment_sid: Filters the resulting list of Devices by a unique string identifier of the Deployment they are associated with. - :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 - - :returns: Page of DeviceInstance - """ - data = values.of( - { - "DeploymentSid": deployment_sid, - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - response = self._version.page(method="GET", uri=self._uri, params=data) - return DevicePage(self._version, response, self._solution) - - async def page_async( - self, - deployment_sid: Union[str, object] = values.unset, - page_token: Union[str, object] = values.unset, - page_number: Union[int, object] = values.unset, - page_size: Union[int, object] = values.unset, - ) -> DevicePage: - """ - Asynchronously retrieve a single page of DeviceInstance records from the API. - Request is executed immediately - - :param deployment_sid: Filters the resulting list of Devices by a unique string identifier of the Deployment they are associated with. - :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 - - :returns: Page of DeviceInstance - """ - data = values.of( - { - "DeploymentSid": deployment_sid, - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - response = await self._version.page_async( - method="GET", uri=self._uri, params=data - ) - return DevicePage(self._version, response, self._solution) - - def get_page(self, target_url: str) -> DevicePage: - """ - Retrieve a specific page of DeviceInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of DeviceInstance - """ - response = self._version.domain.twilio.request("GET", target_url) - return DevicePage(self._version, response, self._solution) - - async def get_page_async(self, target_url: str) -> DevicePage: - """ - Asynchronously retrieve a specific page of DeviceInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of DeviceInstance - """ - response = await self._version.domain.twilio.request_async("GET", target_url) - return DevicePage(self._version, response, self._solution) - - def get(self, sid: str) -> DeviceContext: - """ - Constructs a DeviceContext - - :param sid: Provides a 34 character string that uniquely identifies the requested Device resource. - """ - return DeviceContext( - self._version, fleet_sid=self._solution["fleet_sid"], sid=sid - ) - - def __call__(self, sid: str) -> DeviceContext: - """ - Constructs a DeviceContext - - :param sid: Provides a 34 character string that uniquely identifies the requested Device resource. - """ - return DeviceContext( - self._version, fleet_sid=self._solution["fleet_sid"], sid=sid - ) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" diff --git a/twilio/rest/preview/deployed_devices/fleet/key.py b/twilio/rest/preview/deployed_devices/fleet/key.py deleted file mode 100644 index 1b7c06e1f9..0000000000 --- a/twilio/rest/preview/deployed_devices/fleet/key.py +++ /dev/null @@ -1,646 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Preview - 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 datetime import datetime -from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.version import Version -from twilio.base.page import Page - - -class KeyInstance(InstanceResource): - """ - :ivar sid: Contains a 34 character string that uniquely identifies this Key credential resource. - :ivar url: Contains an absolute URL for this Key credential resource. - :ivar friendly_name: Contains a human readable descriptive text for this Key credential, up to 256 characters long. - :ivar fleet_sid: Specifies the unique string identifier of the Fleet that the given Key credential belongs to. - :ivar account_sid: Specifies the unique string identifier of the Account responsible for this Key credential. - :ivar device_sid: Specifies the unique string identifier of a Device authenticated with this Key credential. - :ivar secret: Contains the automatically generated secret belonging to this Key credential, used to authenticate the Device. - :ivar date_created: Specifies the date this Key credential was created, given in UTC ISO 8601 format. - :ivar date_updated: Specifies the date this Key credential was last updated, given in UTC ISO 8601 format. - """ - - def __init__( - self, - version: Version, - payload: Dict[str, Any], - fleet_sid: str, - sid: Optional[str] = None, - ): - super().__init__(version) - - self.sid: Optional[str] = payload.get("sid") - self.url: Optional[str] = payload.get("url") - self.friendly_name: Optional[str] = payload.get("friendly_name") - self.fleet_sid: Optional[str] = payload.get("fleet_sid") - self.account_sid: Optional[str] = payload.get("account_sid") - self.device_sid: Optional[str] = payload.get("device_sid") - self.secret: Optional[str] = payload.get("secret") - self.date_created: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("date_created") - ) - self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("date_updated") - ) - - self._solution = { - "fleet_sid": fleet_sid, - "sid": sid or self.sid, - } - self._context: Optional[KeyContext] = None - - @property - def _proxy(self) -> "KeyContext": - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: KeyContext for this KeyInstance - """ - if self._context is None: - self._context = KeyContext( - self._version, - fleet_sid=self._solution["fleet_sid"], - sid=self._solution["sid"], - ) - return self._context - - def delete(self) -> bool: - """ - Deletes the KeyInstance - - - :returns: True if delete succeeds, False otherwise - """ - return self._proxy.delete() - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the KeyInstance - - - :returns: True if delete succeeds, False otherwise - """ - return await self._proxy.delete_async() - - def fetch(self) -> "KeyInstance": - """ - Fetch the KeyInstance - - - :returns: The fetched KeyInstance - """ - return self._proxy.fetch() - - async def fetch_async(self) -> "KeyInstance": - """ - Asynchronous coroutine to fetch the KeyInstance - - - :returns: The fetched KeyInstance - """ - return await self._proxy.fetch_async() - - def update( - self, - friendly_name: Union[str, object] = values.unset, - device_sid: Union[str, object] = values.unset, - ) -> "KeyInstance": - """ - Update the KeyInstance - - :param friendly_name: Provides a human readable descriptive text for this Key credential, up to 256 characters long. - :param device_sid: Provides the unique string identifier of an existing Device to become authenticated with this Key credential. - - :returns: The updated KeyInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - device_sid=device_sid, - ) - - async def update_async( - self, - friendly_name: Union[str, object] = values.unset, - device_sid: Union[str, object] = values.unset, - ) -> "KeyInstance": - """ - Asynchronous coroutine to update the KeyInstance - - :param friendly_name: Provides a human readable descriptive text for this Key credential, up to 256 characters long. - :param device_sid: Provides the unique string identifier of an existing Device to become authenticated with this Key credential. - - :returns: The updated KeyInstance - """ - return await self._proxy.update_async( - friendly_name=friendly_name, - device_sid=device_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 KeyContext(InstanceContext): - - def __init__(self, version: Version, fleet_sid: str, sid: str): - """ - Initialize the KeyContext - - :param version: Version that contains the resource - :param fleet_sid: - :param sid: Provides a 34 character string that uniquely identifies the requested Key credential resource. - """ - super().__init__(version) - - # Path Solution - self._solution = { - "fleet_sid": fleet_sid, - "sid": sid, - } - self._uri = "/Fleets/{fleet_sid}/Keys/{sid}".format(**self._solution) - - def delete(self) -> bool: - """ - Deletes the KeyInstance - - - :returns: True if delete succeeds, False otherwise - """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the KeyInstance - - - :returns: True if delete succeeds, False otherwise - """ - return await self._version.delete_async( - method="DELETE", - uri=self._uri, - ) - - def fetch(self) -> KeyInstance: - """ - Fetch the KeyInstance - - - :returns: The fetched KeyInstance - """ - - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) - - return KeyInstance( - self._version, - payload, - fleet_sid=self._solution["fleet_sid"], - sid=self._solution["sid"], - ) - - async def fetch_async(self) -> KeyInstance: - """ - Asynchronous coroutine to fetch the KeyInstance - - - :returns: The fetched KeyInstance - """ - - payload = await self._version.fetch_async( - method="GET", - uri=self._uri, - ) - - return KeyInstance( - self._version, - payload, - fleet_sid=self._solution["fleet_sid"], - sid=self._solution["sid"], - ) - - def update( - self, - friendly_name: Union[str, object] = values.unset, - device_sid: Union[str, object] = values.unset, - ) -> KeyInstance: - """ - Update the KeyInstance - - :param friendly_name: Provides a human readable descriptive text for this Key credential, up to 256 characters long. - :param device_sid: Provides the unique string identifier of an existing Device to become authenticated with this Key credential. - - :returns: The updated KeyInstance - """ - data = values.of( - { - "FriendlyName": friendly_name, - "DeviceSid": device_sid, - } - ) - - payload = self._version.update( - method="POST", - uri=self._uri, - data=data, - ) - - return KeyInstance( - self._version, - payload, - fleet_sid=self._solution["fleet_sid"], - sid=self._solution["sid"], - ) - - async def update_async( - self, - friendly_name: Union[str, object] = values.unset, - device_sid: Union[str, object] = values.unset, - ) -> KeyInstance: - """ - Asynchronous coroutine to update the KeyInstance - - :param friendly_name: Provides a human readable descriptive text for this Key credential, up to 256 characters long. - :param device_sid: Provides the unique string identifier of an existing Device to become authenticated with this Key credential. - - :returns: The updated KeyInstance - """ - data = values.of( - { - "FriendlyName": friendly_name, - "DeviceSid": device_sid, - } - ) - - payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, - ) - - return KeyInstance( - self._version, - payload, - fleet_sid=self._solution["fleet_sid"], - sid=self._solution["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 KeyPage(Page): - - def get_instance(self, payload: Dict[str, Any]) -> KeyInstance: - """ - Build an instance of KeyInstance - - :param payload: Payload response from the API - """ - return KeyInstance( - self._version, payload, fleet_sid=self._solution["fleet_sid"] - ) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" - - -class KeyList(ListResource): - - def __init__(self, version: Version, fleet_sid: str): - """ - Initialize the KeyList - - :param version: Version that contains the resource - :param fleet_sid: - - """ - super().__init__(version) - - # Path Solution - self._solution = { - "fleet_sid": fleet_sid, - } - self._uri = "/Fleets/{fleet_sid}/Keys".format(**self._solution) - - def create( - self, - friendly_name: Union[str, object] = values.unset, - device_sid: Union[str, object] = values.unset, - ) -> KeyInstance: - """ - Create the KeyInstance - - :param friendly_name: Provides a human readable descriptive text for this Key credential, up to 256 characters long. - :param device_sid: Provides the unique string identifier of an existing Device to become authenticated with this Key credential. - - :returns: The created KeyInstance - """ - - data = values.of( - { - "FriendlyName": friendly_name, - "DeviceSid": device_sid, - } - ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - payload = self._version.create( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return KeyInstance( - self._version, payload, fleet_sid=self._solution["fleet_sid"] - ) - - async def create_async( - self, - friendly_name: Union[str, object] = values.unset, - device_sid: Union[str, object] = values.unset, - ) -> KeyInstance: - """ - Asynchronously create the KeyInstance - - :param friendly_name: Provides a human readable descriptive text for this Key credential, up to 256 characters long. - :param device_sid: Provides the unique string identifier of an existing Device to become authenticated with this Key credential. - - :returns: The created KeyInstance - """ - - data = values.of( - { - "FriendlyName": friendly_name, - "DeviceSid": device_sid, - } - ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - payload = await self._version.create_async( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return KeyInstance( - self._version, payload, fleet_sid=self._solution["fleet_sid"] - ) - - def stream( - self, - device_sid: Union[str, object] = values.unset, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> Iterator[KeyInstance]: - """ - Streams KeyInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param str device_sid: Filters the resulting list of Keys by a unique string identifier of an authenticated Device. - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - """ - limits = self._version.read_limits(limit, page_size) - page = self.page(device_sid=device_sid, page_size=limits["page_size"]) - - return self._version.stream(page, limits["limit"]) - - async def stream_async( - self, - device_sid: Union[str, object] = values.unset, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> AsyncIterator[KeyInstance]: - """ - Asynchronously streams KeyInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param str device_sid: Filters the resulting list of Keys by a unique string identifier of an authenticated Device. - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - """ - limits = self._version.read_limits(limit, page_size) - page = await self.page_async( - device_sid=device_sid, page_size=limits["page_size"] - ) - - return self._version.stream_async(page, limits["limit"]) - - def list( - self, - device_sid: Union[str, object] = values.unset, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[KeyInstance]: - """ - Lists KeyInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param str device_sid: Filters the resulting list of Keys by a unique string identifier of an authenticated Device. - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: list that will contain up to limit results - """ - return list( - self.stream( - device_sid=device_sid, - limit=limit, - page_size=page_size, - ) - ) - - async def list_async( - self, - device_sid: Union[str, object] = values.unset, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[KeyInstance]: - """ - Asynchronously lists KeyInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param str device_sid: Filters the resulting list of Keys by a unique string identifier of an authenticated Device. - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: list that will contain up to limit results - """ - return [ - record - async for record in await self.stream_async( - device_sid=device_sid, - limit=limit, - page_size=page_size, - ) - ] - - def page( - self, - device_sid: Union[str, object] = values.unset, - page_token: Union[str, object] = values.unset, - page_number: Union[int, object] = values.unset, - page_size: Union[int, object] = values.unset, - ) -> KeyPage: - """ - Retrieve a single page of KeyInstance records from the API. - Request is executed immediately - - :param device_sid: Filters the resulting list of Keys by a unique string identifier of an authenticated Device. - :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 - - :returns: Page of KeyInstance - """ - data = values.of( - { - "DeviceSid": device_sid, - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - response = self._version.page(method="GET", uri=self._uri, params=data) - return KeyPage(self._version, response, self._solution) - - async def page_async( - self, - device_sid: Union[str, object] = values.unset, - page_token: Union[str, object] = values.unset, - page_number: Union[int, object] = values.unset, - page_size: Union[int, object] = values.unset, - ) -> KeyPage: - """ - Asynchronously retrieve a single page of KeyInstance records from the API. - Request is executed immediately - - :param device_sid: Filters the resulting list of Keys by a unique string identifier of an authenticated Device. - :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 - - :returns: Page of KeyInstance - """ - data = values.of( - { - "DeviceSid": device_sid, - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - response = await self._version.page_async( - method="GET", uri=self._uri, params=data - ) - return KeyPage(self._version, response, self._solution) - - def get_page(self, target_url: str) -> KeyPage: - """ - Retrieve a specific page of KeyInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of KeyInstance - """ - response = self._version.domain.twilio.request("GET", target_url) - return KeyPage(self._version, response, self._solution) - - async def get_page_async(self, target_url: str) -> KeyPage: - """ - Asynchronously retrieve a specific page of KeyInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of KeyInstance - """ - response = await self._version.domain.twilio.request_async("GET", target_url) - return KeyPage(self._version, response, self._solution) - - def get(self, sid: str) -> KeyContext: - """ - Constructs a KeyContext - - :param sid: Provides a 34 character string that uniquely identifies the requested Key credential resource. - """ - return KeyContext(self._version, fleet_sid=self._solution["fleet_sid"], sid=sid) - - def __call__(self, sid: str) -> KeyContext: - """ - Constructs a KeyContext - - :param sid: Provides a 34 character string that uniquely identifies the requested Key credential resource. - """ - return KeyContext(self._version, fleet_sid=self._solution["fleet_sid"], sid=sid) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" diff --git a/twilio/rest/taskrouter/v1/workspace/task/__init__.py b/twilio/rest/taskrouter/v1/workspace/task/__init__.py index 631b8f8bdb..ed25dc71d1 100644 --- a/twilio/rest/taskrouter/v1/workspace/task/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/task/__init__.py @@ -193,7 +193,7 @@ def update( :param reason: The reason that the Task was canceled or completed. This parameter is required only if the Task is canceled or completed. Setting this value queues the task for deletion and logs the reason. :param priority: The Task's new priority value. When supplied, the Task takes on the specified priority unless it matches a Workflow Target with a Priority set. Value can be 0 to 2^31^ (2,147,483,647). :param task_channel: When MultiTasking is enabled, specify the TaskChannel with the task to update. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. - :param virtual_start_time: The task's new virtual start time value. When supplied, the Task takes on the specified virtual start time. Value can't be in the future. + :param virtual_start_time: The task's new virtual start time value. When supplied, the Task takes on the specified virtual start time. Value can't be in the future or before the year of 1900. :returns: The updated TaskInstance """ @@ -226,7 +226,7 @@ async def update_async( :param reason: The reason that the Task was canceled or completed. This parameter is required only if the Task is canceled or completed. Setting this value queues the task for deletion and logs the reason. :param priority: The Task's new priority value. When supplied, the Task takes on the specified priority unless it matches a Workflow Target with a Priority set. Value can be 0 to 2^31^ (2,147,483,647). :param task_channel: When MultiTasking is enabled, specify the TaskChannel with the task to update. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. - :param virtual_start_time: The task's new virtual start time value. When supplied, the Task takes on the specified virtual start time. Value can't be in the future. + :param virtual_start_time: The task's new virtual start time value. When supplied, the Task takes on the specified virtual start time. Value can't be in the future or before the year of 1900. :returns: The updated TaskInstance """ @@ -371,7 +371,7 @@ def update( :param reason: The reason that the Task was canceled or completed. This parameter is required only if the Task is canceled or completed. Setting this value queues the task for deletion and logs the reason. :param priority: The Task's new priority value. When supplied, the Task takes on the specified priority unless it matches a Workflow Target with a Priority set. Value can be 0 to 2^31^ (2,147,483,647). :param task_channel: When MultiTasking is enabled, specify the TaskChannel with the task to update. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. - :param virtual_start_time: The task's new virtual start time value. When supplied, the Task takes on the specified virtual start time. Value can't be in the future. + :param virtual_start_time: The task's new virtual start time value. When supplied, the Task takes on the specified virtual start time. Value can't be in the future or before the year of 1900. :returns: The updated TaskInstance """ @@ -421,7 +421,7 @@ async def update_async( :param reason: The reason that the Task was canceled or completed. This parameter is required only if the Task is canceled or completed. Setting this value queues the task for deletion and logs the reason. :param priority: The Task's new priority value. When supplied, the Task takes on the specified priority unless it matches a Workflow Target with a Priority set. Value can be 0 to 2^31^ (2,147,483,647). :param task_channel: When MultiTasking is enabled, specify the TaskChannel with the task to update. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. - :param virtual_start_time: The task's new virtual start time value. When supplied, the Task takes on the specified virtual start time. Value can't be in the future. + :param virtual_start_time: The task's new virtual start time value. When supplied, the Task takes on the specified virtual start time. Value can't be in the future or before the year of 1900. :returns: The updated TaskInstance """ @@ -534,7 +534,7 @@ def create( :param task_channel: When MultiTasking is enabled, specify the TaskChannel by passing either its `unique_name` or `sid`. Default value is `default`. :param workflow_sid: The SID of the Workflow that you would like to handle routing for the new Task. If there is only one Workflow defined for the Workspace that you are posting the new task to, this parameter is optional. :param attributes: A URL-encoded JSON string with the attributes of the new task. This value is passed to the Workflow's `assignment_callback_url` when the Task is assigned to a Worker. For example: `{ \\\"task_type\\\": \\\"call\\\", \\\"twilio_call_sid\\\": \\\"CAxxx\\\", \\\"customer_ticket_number\\\": \\\"12345\\\" }`. - :param virtual_start_time: The virtual start time to assign the new task and override the default. When supplied, the new task will have this virtual start time. When not supplied, the new task will have the virtual start time equal to `date_created`. Value can't be in the future. + :param virtual_start_time: The virtual start time to assign the new task and override the default. When supplied, the new task will have this virtual start time. When not supplied, the new task will have the virtual start time equal to `date_created`. Value can't be in the future or before the year of 1900. :param routing_target: A SID of a Worker, Queue, or Workflow to route a Task to :param ignore_capacity: A boolean that indicates if the Task should respect a Worker's capacity and availability during assignment. This field can only be used when the `RoutingTarget` field is set to a Worker SID. By setting `IgnoreCapacity` to a value of `true`, `1`, or `yes`, the Task will be routed to the Worker without respecting their capacity and availability. Any other value will enforce the Worker's capacity and availability. The default value of `IgnoreCapacity` is `true` when the `RoutingTarget` is set to a Worker SID. :param task_queue_sid: The SID of the TaskQueue in which the Task belongs @@ -585,7 +585,7 @@ async def create_async( :param task_channel: When MultiTasking is enabled, specify the TaskChannel by passing either its `unique_name` or `sid`. Default value is `default`. :param workflow_sid: The SID of the Workflow that you would like to handle routing for the new Task. If there is only one Workflow defined for the Workspace that you are posting the new task to, this parameter is optional. :param attributes: A URL-encoded JSON string with the attributes of the new task. This value is passed to the Workflow's `assignment_callback_url` when the Task is assigned to a Worker. For example: `{ \\\"task_type\\\": \\\"call\\\", \\\"twilio_call_sid\\\": \\\"CAxxx\\\", \\\"customer_ticket_number\\\": \\\"12345\\\" }`. - :param virtual_start_time: The virtual start time to assign the new task and override the default. When supplied, the new task will have this virtual start time. When not supplied, the new task will have the virtual start time equal to `date_created`. Value can't be in the future. + :param virtual_start_time: The virtual start time to assign the new task and override the default. When supplied, the new task will have this virtual start time. When not supplied, the new task will have the virtual start time equal to `date_created`. Value can't be in the future or before the year of 1900. :param routing_target: A SID of a Worker, Queue, or Workflow to route a Task to :param ignore_capacity: A boolean that indicates if the Task should respect a Worker's capacity and availability during assignment. This field can only be used when the `RoutingTarget` field is set to a Worker SID. By setting `IgnoreCapacity` to a value of `true`, `1`, or `yes`, the Task will be routed to the Worker without respecting their capacity and availability. Any other value will enforce the Worker's capacity and availability. The default value of `IgnoreCapacity` is `true` when the `RoutingTarget` is set to a Worker SID. :param task_queue_sid: The SID of the TaskQueue in which the Task belongs diff --git a/twilio/rest/verify/v2/service/verification.py b/twilio/rest/verify/v2/service/verification.py index c8deef535b..23a956b65f 100644 --- a/twilio/rest/verify/v2/service/verification.py +++ b/twilio/rest/verify/v2/service/verification.py @@ -325,6 +325,7 @@ def create( template_sid: Union[str, object] = values.unset, template_custom_substitutions: Union[str, object] = values.unset, device_ip: Union[str, object] = values.unset, + enable_sna_client_token: Union[bool, object] = values.unset, risk_check: Union["VerificationInstance.RiskCheck", object] = values.unset, tags: Union[str, object] = values.unset, ) -> VerificationInstance: @@ -346,6 +347,7 @@ def create( :param template_sid: The message [template](https://www.twilio.com/docs/verify/api/templates). If provided, will override the default template for the Service. SMS and Voice channels only. :param template_custom_substitutions: A stringified JSON object in which the keys are the template's special variables and the values are the variables substitutions. :param device_ip: Strongly encouraged if using the auto channel. The IP address of the client's device. If provided, it has to be a valid IPv4 or IPv6 address. + :param enable_sna_client_token: An optional Boolean value to indicate the requirement of sna client token in the SNA URL invocation response for added security. This token must match in the Verification Check request to confirm phone number verification. :param risk_check: :param tags: A string containing a JSON map of key value pairs of tags to be recorded as metadata for the message. The object may contain up to 10 tags. Keys and values can each be up to 128 characters in length. @@ -369,6 +371,9 @@ def create( "TemplateSid": template_sid, "TemplateCustomSubstitutions": template_custom_substitutions, "DeviceIp": device_ip, + "EnableSnaClientToken": serialize.boolean_to_string( + enable_sna_client_token + ), "RiskCheck": risk_check, "Tags": tags, } @@ -400,6 +405,7 @@ async def create_async( template_sid: Union[str, object] = values.unset, template_custom_substitutions: Union[str, object] = values.unset, device_ip: Union[str, object] = values.unset, + enable_sna_client_token: Union[bool, object] = values.unset, risk_check: Union["VerificationInstance.RiskCheck", object] = values.unset, tags: Union[str, object] = values.unset, ) -> VerificationInstance: @@ -421,6 +427,7 @@ async def create_async( :param template_sid: The message [template](https://www.twilio.com/docs/verify/api/templates). If provided, will override the default template for the Service. SMS and Voice channels only. :param template_custom_substitutions: A stringified JSON object in which the keys are the template's special variables and the values are the variables substitutions. :param device_ip: Strongly encouraged if using the auto channel. The IP address of the client's device. If provided, it has to be a valid IPv4 or IPv6 address. + :param enable_sna_client_token: An optional Boolean value to indicate the requirement of sna client token in the SNA URL invocation response for added security. This token must match in the Verification Check request to confirm phone number verification. :param risk_check: :param tags: A string containing a JSON map of key value pairs of tags to be recorded as metadata for the message. The object may contain up to 10 tags. Keys and values can each be up to 128 characters in length. @@ -444,6 +451,9 @@ async def create_async( "TemplateSid": template_sid, "TemplateCustomSubstitutions": template_custom_substitutions, "DeviceIp": device_ip, + "EnableSnaClientToken": serialize.boolean_to_string( + enable_sna_client_token + ), "RiskCheck": risk_check, "Tags": tags, } diff --git a/twilio/rest/verify/v2/service/verification_check.py b/twilio/rest/verify/v2/service/verification_check.py index af216a39f6..fd1b3f897c 100644 --- a/twilio/rest/verify/v2/service/verification_check.py +++ b/twilio/rest/verify/v2/service/verification_check.py @@ -108,6 +108,7 @@ def create( verification_sid: Union[str, object] = values.unset, amount: Union[str, object] = values.unset, payee: Union[str, object] = values.unset, + sna_client_token: Union[str, object] = values.unset, ) -> VerificationCheckInstance: """ Create the VerificationCheckInstance @@ -117,6 +118,7 @@ def create( :param verification_sid: A SID that uniquely identifies the Verification Check. Either this parameter or the `to` phone number/[email](https://www.twilio.com/docs/verify/email) must be specified. :param amount: The amount of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. :param payee: The payee of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. + :param sna_client_token: A sna client token received in sna url invocation response needs to be passed in Verification Check request and should match to get successful response. :returns: The created VerificationCheckInstance """ @@ -128,6 +130,7 @@ def create( "VerificationSid": verification_sid, "Amount": amount, "Payee": payee, + "SnaClientToken": sna_client_token, } ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -147,6 +150,7 @@ async def create_async( verification_sid: Union[str, object] = values.unset, amount: Union[str, object] = values.unset, payee: Union[str, object] = values.unset, + sna_client_token: Union[str, object] = values.unset, ) -> VerificationCheckInstance: """ Asynchronously create the VerificationCheckInstance @@ -156,6 +160,7 @@ async def create_async( :param verification_sid: A SID that uniquely identifies the Verification Check. Either this parameter or the `to` phone number/[email](https://www.twilio.com/docs/verify/email) must be specified. :param amount: The amount of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. :param payee: The payee of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. + :param sna_client_token: A sna client token received in sna url invocation response needs to be passed in Verification Check request and should match to get successful response. :returns: The created VerificationCheckInstance """ @@ -167,6 +172,7 @@ async def create_async( "VerificationSid": verification_sid, "Amount": amount, "Payee": payee, + "SnaClientToken": sna_client_token, } ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) From 69b9ae8b978aef665c56ff4e3ab09004d505a679 Mon Sep 17 00:00:00 2001 From: Twilio Date: Thu, 3 Oct 2024 15:43:07 +0000 Subject: [PATCH 38/87] Release 9.3.3 --- setup.py | 2 +- twilio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index be0c82e703..911ec6d8a4 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name="twilio", - version="9.3.2", + version="9.3.3", description="Twilio API client and TwiML generator", author="Twilio", help_center="https://www.twilio.com/help/contact", diff --git a/twilio/__init__.py b/twilio/__init__.py index 9c85cf3a45..e5ba728ee2 100644 --- a/twilio/__init__.py +++ b/twilio/__init__.py @@ -1,2 +1,2 @@ -__version_info__ = ("9", "3", "2") +__version_info__ = ("9", "3", "3") __version__ = ".".join(__version_info__) From ccce7138163fad28f6d0055197367c2392676551 Mon Sep 17 00:00:00 2001 From: Twilio Date: Thu, 17 Oct 2024 14:06:21 +0000 Subject: [PATCH 39/87] [Librarian] Regenerated @ d97b0740a0c7cf86beebd56c6973927b07719cde 1fc3bb6195ebcbd02451fb8fc9080c695b075d4f --- CHANGES.md | 9 + twilio/rest/messaging/v1/__init__.py | 8 + .../rest/messaging/v1/request_managed_cert.py | 209 ++++++++++++++++++ twilio/rest/video/v1/room/__init__.py | 42 ++-- 4 files changed, 247 insertions(+), 21 deletions(-) create mode 100644 twilio/rest/messaging/v1/request_managed_cert.py diff --git a/CHANGES.md b/CHANGES.md index 5808d307b5..bdadc9361c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,15 @@ twilio-python Changelog Here you can see the full list of changes between each twilio-python release. +[2024-10-17] Version 9.3.4 +-------------------------- +**Api** +- Add response key `country` to fetch AvailablePhoneNumber resource by specific country. + +**Messaging** +- Make library and doc public for requestManagedCert Endpoint + + [2024-10-03] Version 9.3.3 -------------------------- **Library - Chore** diff --git a/twilio/rest/messaging/v1/__init__.py b/twilio/rest/messaging/v1/__init__.py index 6262dfe938..6bd630fbd8 100644 --- a/twilio/rest/messaging/v1/__init__.py +++ b/twilio/rest/messaging/v1/__init__.py @@ -29,6 +29,7 @@ from twilio.rest.messaging.v1.linkshortening_messaging_service_domain_association import ( LinkshorteningMessagingServiceDomainAssociationList, ) +from twilio.rest.messaging.v1.request_managed_cert import RequestManagedCertList from twilio.rest.messaging.v1.service import ServiceList from twilio.rest.messaging.v1.tollfree_verification import TollfreeVerificationList from twilio.rest.messaging.v1.usecase import UsecaseList @@ -57,6 +58,7 @@ def __init__(self, domain: Domain): self._linkshortening_messaging_service_domain_association: Optional[ LinkshorteningMessagingServiceDomainAssociationList ] = None + self._request_managed_cert: Optional[RequestManagedCertList] = None self._services: Optional[ServiceList] = None self._tollfree_verifications: Optional[TollfreeVerificationList] = None self._usecases: Optional[UsecaseList] = None @@ -117,6 +119,12 @@ def linkshortening_messaging_service_domain_association( ) return self._linkshortening_messaging_service_domain_association + @property + def request_managed_cert(self) -> RequestManagedCertList: + if self._request_managed_cert is None: + self._request_managed_cert = RequestManagedCertList(self) + return self._request_managed_cert + @property def services(self) -> ServiceList: if self._services is None: diff --git a/twilio/rest/messaging/v1/request_managed_cert.py b/twilio/rest/messaging/v1/request_managed_cert.py new file mode 100644 index 0000000000..fd79b5a686 --- /dev/null +++ b/twilio/rest/messaging/v1/request_managed_cert.py @@ -0,0 +1,209 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Messaging + 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 datetime import datetime +from typing import Any, Dict, Optional +from twilio.base import deserialize, values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class RequestManagedCertInstance(InstanceResource): + """ + :ivar domain_sid: The unique string that we created to identify the Domain resource. + :ivar date_updated: Date that this Domain was last updated. + :ivar date_created: Date that this Domain was registered to the Twilio platform to create a new Domain object. + :ivar date_expires: Date that the private certificate associated with this domain expires. This is the expiration date of your existing cert. + :ivar domain_name: Full url path for this domain. + :ivar certificate_sid: The unique string that we created to identify this Certificate resource. + :ivar url: + :ivar managed: A boolean flag indicating if the certificate is managed by Twilio. + :ivar requesting: A boolean flag indicating if a managed certificate needs to be fulfilled by Twilio. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + domain_sid: Optional[str] = None, + ): + super().__init__(version) + + self.domain_sid: Optional[str] = payload.get("domain_sid") + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_expires: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_expires") + ) + self.domain_name: Optional[str] = payload.get("domain_name") + self.certificate_sid: Optional[str] = payload.get("certificate_sid") + self.url: Optional[str] = payload.get("url") + self.managed: Optional[bool] = payload.get("managed") + self.requesting: Optional[bool] = payload.get("requesting") + + self._solution = { + "domain_sid": domain_sid or self.domain_sid, + } + self._context: Optional[RequestManagedCertContext] = None + + @property + def _proxy(self) -> "RequestManagedCertContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: RequestManagedCertContext for this RequestManagedCertInstance + """ + if self._context is None: + self._context = RequestManagedCertContext( + self._version, + domain_sid=self._solution["domain_sid"], + ) + return self._context + + def update(self) -> "RequestManagedCertInstance": + """ + Update the RequestManagedCertInstance + + + :returns: The updated RequestManagedCertInstance + """ + return self._proxy.update() + + async def update_async(self) -> "RequestManagedCertInstance": + """ + Asynchronous coroutine to update the RequestManagedCertInstance + + + :returns: The updated RequestManagedCertInstance + """ + return await self._proxy.update_async() + + 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 RequestManagedCertContext(InstanceContext): + + def __init__(self, version: Version, domain_sid: str): + """ + Initialize the RequestManagedCertContext + + :param version: Version that contains the resource + :param domain_sid: Unique string used to identify the domain that this certificate should be associated with. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "domain_sid": domain_sid, + } + self._uri = "/LinkShortening/Domains/{domain_sid}/RequestManagedCert".format( + **self._solution + ) + + def update(self) -> RequestManagedCertInstance: + """ + Update the RequestManagedCertInstance + + + :returns: The updated RequestManagedCertInstance + """ + data = values.of({}) + + payload = self._version.update( + method="POST", + uri=self._uri, + data=data, + ) + + return RequestManagedCertInstance( + self._version, payload, domain_sid=self._solution["domain_sid"] + ) + + async def update_async(self) -> RequestManagedCertInstance: + """ + Asynchronous coroutine to update the RequestManagedCertInstance + + + :returns: The updated RequestManagedCertInstance + """ + data = values.of({}) + + payload = await self._version.update_async( + method="POST", + uri=self._uri, + data=data, + ) + + return RequestManagedCertInstance( + self._version, payload, domain_sid=self._solution["domain_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 RequestManagedCertList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the RequestManagedCertList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + def get(self, domain_sid: str) -> RequestManagedCertContext: + """ + Constructs a RequestManagedCertContext + + :param domain_sid: Unique string used to identify the domain that this certificate should be associated with. + """ + return RequestManagedCertContext(self._version, domain_sid=domain_sid) + + def __call__(self, domain_sid: str) -> RequestManagedCertContext: + """ + Constructs a RequestManagedCertContext + + :param domain_sid: Unique string used to identify the domain that this certificate should be associated with. + """ + return RequestManagedCertContext(self._version, domain_sid=domain_sid) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/video/v1/room/__init__.py b/twilio/rest/video/v1/room/__init__.py index c735e5516f..4a6822c94b 100644 --- a/twilio/rest/video/v1/room/__init__.py +++ b/twilio/rest/video/v1/room/__init__.py @@ -43,25 +43,25 @@ class VideoCodec(object): H264 = "H264" """ - :ivar sid: The unique string that we created to identify the Room resource. + :ivar sid: The unique string that Twilio created to identify the Room resource. :ivar status: :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. :ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Room resource. :ivar enable_turn: Deprecated, now always considered to be true. :ivar unique_name: An application-defined string that uniquely identifies the resource. It can be used as a `room_sid` in place of the resource's `sid` in the URL to address the resource, assuming it does not contain any [reserved characters](https://tools.ietf.org/html/rfc3986#section-2.2) that would need to be URL encoded. This value is unique for `in-progress` rooms. SDK clients can use this name to connect to the room. REST API clients can use this name in place of the Room SID to interact with the room as long as the room is `in-progress`. - :ivar status_callback: The URL we call using the `status_callback_method` to send status information to your application on every room event. See [Status Callbacks](https://www.twilio.com/docs/video/api/status-callbacks) for more info. - :ivar status_callback_method: The HTTP method we use to call `status_callback`. Can be `POST` or `GET` and defaults to `POST`. + :ivar status_callback: The URL Twilio calls using the `status_callback_method` to send status information to your application on every room event. See [Status Callbacks](https://www.twilio.com/docs/video/api/status-callbacks) for more info. + :ivar status_callback_method: The HTTP method Twilio uses to call `status_callback`. Can be `POST` or `GET` and defaults to `POST`. :ivar end_time: The UTC end time of the room in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. :ivar duration: The duration of the room in seconds. :ivar type: :ivar max_participants: The maximum number of concurrent Participants allowed in the room. :ivar max_participant_duration: The maximum number of seconds a Participant can be connected to the room. The maximum possible value is 86400 seconds (24 hours). The default is 14400 seconds (4 hours). :ivar max_concurrent_published_tracks: The maximum number of published audio, video, and data tracks all participants combined are allowed to publish in the room at the same time. Check [Programmable Video Limits](https://www.twilio.com/docs/video/programmable-video-limits) for more details. If it is set to 0 it means unconstrained. - :ivar record_participants_on_connect: Whether to start recording when Participants connect. ***This feature is not available in `peer-to-peer` rooms.*** - :ivar video_codecs: An array of the video codecs that are supported when publishing a track in the room. Can be: `VP8` and `H264`. ***This feature is not available in `peer-to-peer` rooms*** - :ivar media_region: The region for the media server in Group Rooms. Can be: one of the [available Media Regions](https://www.twilio.com/docs/video/ip-addresses#media-servers). ***This feature is not available in `peer-to-peer` rooms.*** - :ivar audio_only: When set to true, indicates that the participants in the room will only publish audio. No video tracks will be allowed. Group rooms only. + :ivar record_participants_on_connect: Whether to start recording when Participants connect. + :ivar video_codecs: An array of the video codecs that are supported when publishing a track in the room. Can be: `VP8` and `H264`. + :ivar media_region: The region for the Room's media server. Can be one of the [available Media Regions](https://www.twilio.com/docs/video/ip-addresses#media-servers). + :ivar audio_only: When set to true, indicates that the participants in the room will only publish audio. No video tracks will be allowed. :ivar empty_room_timeout: Specifies how long (in minutes) a room will remain active after last participant leaves. Can be configured when creating a room via REST API. For Ad-Hoc rooms this value cannot be changed. :ivar unused_room_timeout: Specifies how long (in minutes) a room will remain active if no one joins. Can be configured when creating a room via REST API. For Ad-Hoc rooms this value cannot be changed. :ivar large_room: Indicates if this is a large room. @@ -419,14 +419,14 @@ def create( :param enable_turn: Deprecated, now always considered to be true. :param type: :param unique_name: An application-defined string that uniquely identifies the resource. It can be used as a `room_sid` in place of the resource's `sid` in the URL to address the resource, assuming it does not contain any [reserved characters](https://tools.ietf.org/html/rfc3986#section-2.2) that would need to be URL encoded. This value is unique for `in-progress` rooms. SDK clients can use this name to connect to the room. REST API clients can use this name in place of the Room SID to interact with the room as long as the room is `in-progress`. - :param status_callback: The URL we should call using the `status_callback_method` to send status information to your application on every room event. See [Status Callbacks](https://www.twilio.com/docs/video/api/status-callbacks) for more info. - :param status_callback_method: The HTTP method we should use to call `status_callback`. Can be `POST` or `GET`. - :param max_participants: The maximum number of concurrent Participants allowed in the room. Peer-to-peer rooms can have up to 10 Participants. Small Group rooms can have up to 4 Participants. Group rooms can have up to 50 Participants. - :param record_participants_on_connect: Whether to start recording when Participants connect. ***This feature is not available in `peer-to-peer` rooms.*** - :param video_codecs: An array of the video codecs that are supported when publishing a track in the room. Can be: `VP8` and `H264`. ***This feature is not available in `peer-to-peer` rooms*** - :param media_region: The region for the media server in Group Rooms. Can be: one of the [available Media Regions](https://www.twilio.com/docs/video/ip-addresses#group-rooms-media-servers). ***This feature is not available in `peer-to-peer` rooms.*** + :param status_callback: The URL Twilio should call using the `status_callback_method` to send status information to your application on every room event. See [Status Callbacks](https://www.twilio.com/docs/video/api/status-callbacks) for more info. + :param status_callback_method: The HTTP method Twilio should use to call `status_callback`. Can be `POST` or `GET`. + :param max_participants: The maximum number of concurrent Participants allowed in the room. The maximum allowed value is 50. + :param record_participants_on_connect: Whether to start recording when Participants connect. + :param video_codecs: An array of the video codecs that are supported when publishing a track in the room. Can be: `VP8` and `H264`. + :param media_region: The region for the Room's media server. Can be one of the [available Media Regions](https://www.twilio.com/docs/video/ip-addresses#group-rooms-media-servers). :param recording_rules: A collection of Recording Rules that describe how to include or exclude matching tracks for recording - :param audio_only: When set to true, indicates that the participants in the room will only publish audio. No video tracks will be allowed. Group rooms only. + :param audio_only: When set to true, indicates that the participants in the room will only publish audio. No video tracks will be allowed. :param max_participant_duration: The maximum number of seconds a Participant can be connected to the room. The maximum possible value is 86400 seconds (24 hours). The default is 14400 seconds (4 hours). :param empty_room_timeout: Configures how long (in minutes) a room will remain active after last participant leaves. Valid values range from 1 to 60 minutes (no fractions). :param unused_room_timeout: Configures how long (in minutes) a room will remain active if no one joins. Valid values range from 1 to 60 minutes (no fractions). @@ -488,14 +488,14 @@ async def create_async( :param enable_turn: Deprecated, now always considered to be true. :param type: :param unique_name: An application-defined string that uniquely identifies the resource. It can be used as a `room_sid` in place of the resource's `sid` in the URL to address the resource, assuming it does not contain any [reserved characters](https://tools.ietf.org/html/rfc3986#section-2.2) that would need to be URL encoded. This value is unique for `in-progress` rooms. SDK clients can use this name to connect to the room. REST API clients can use this name in place of the Room SID to interact with the room as long as the room is `in-progress`. - :param status_callback: The URL we should call using the `status_callback_method` to send status information to your application on every room event. See [Status Callbacks](https://www.twilio.com/docs/video/api/status-callbacks) for more info. - :param status_callback_method: The HTTP method we should use to call `status_callback`. Can be `POST` or `GET`. - :param max_participants: The maximum number of concurrent Participants allowed in the room. Peer-to-peer rooms can have up to 10 Participants. Small Group rooms can have up to 4 Participants. Group rooms can have up to 50 Participants. - :param record_participants_on_connect: Whether to start recording when Participants connect. ***This feature is not available in `peer-to-peer` rooms.*** - :param video_codecs: An array of the video codecs that are supported when publishing a track in the room. Can be: `VP8` and `H264`. ***This feature is not available in `peer-to-peer` rooms*** - :param media_region: The region for the media server in Group Rooms. Can be: one of the [available Media Regions](https://www.twilio.com/docs/video/ip-addresses#group-rooms-media-servers). ***This feature is not available in `peer-to-peer` rooms.*** + :param status_callback: The URL Twilio should call using the `status_callback_method` to send status information to your application on every room event. See [Status Callbacks](https://www.twilio.com/docs/video/api/status-callbacks) for more info. + :param status_callback_method: The HTTP method Twilio should use to call `status_callback`. Can be `POST` or `GET`. + :param max_participants: The maximum number of concurrent Participants allowed in the room. The maximum allowed value is 50. + :param record_participants_on_connect: Whether to start recording when Participants connect. + :param video_codecs: An array of the video codecs that are supported when publishing a track in the room. Can be: `VP8` and `H264`. + :param media_region: The region for the Room's media server. Can be one of the [available Media Regions](https://www.twilio.com/docs/video/ip-addresses#group-rooms-media-servers). :param recording_rules: A collection of Recording Rules that describe how to include or exclude matching tracks for recording - :param audio_only: When set to true, indicates that the participants in the room will only publish audio. No video tracks will be allowed. Group rooms only. + :param audio_only: When set to true, indicates that the participants in the room will only publish audio. No video tracks will be allowed. :param max_participant_duration: The maximum number of seconds a Participant can be connected to the room. The maximum possible value is 86400 seconds (24 hours). The default is 14400 seconds (4 hours). :param empty_room_timeout: Configures how long (in minutes) a room will remain active after last participant leaves. Valid values range from 1 to 60 minutes (no fractions). :param unused_room_timeout: Configures how long (in minutes) a room will remain active if no one joins. Valid values range from 1 to 60 minutes (no fractions). From 9f1414d97a6566d31a380dc884925847233f958a Mon Sep 17 00:00:00 2001 From: Twilio Date: Thu, 17 Oct 2024 14:11:00 +0000 Subject: [PATCH 40/87] Release 9.3.4 --- setup.py | 2 +- twilio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 911ec6d8a4..a81b74cc51 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name="twilio", - version="9.3.3", + version="9.3.4", description="Twilio API client and TwiML generator", author="Twilio", help_center="https://www.twilio.com/help/contact", diff --git a/twilio/__init__.py b/twilio/__init__.py index e5ba728ee2..a14d90732d 100644 --- a/twilio/__init__.py +++ b/twilio/__init__.py @@ -1,2 +1,2 @@ -__version_info__ = ("9", "3", "3") +__version_info__ = ("9", "3", "4") __version__ = ".".join(__version_info__) From 086bc6bb518fa77c6f042f7a52d1c15d03cc4bc7 Mon Sep 17 00:00:00 2001 From: Twilio Date: Thu, 24 Oct 2024 13:27:35 +0000 Subject: [PATCH 41/87] [Librarian] Regenerated @ 2e932f6c59e0f9fb6cb96952802e5ebedd83b6f0 1852557f82faade033dbd5bd0615c9e1aa4d9fae --- CHANGES.md | 6 + twilio/rest/conversations/v1/__init__.py | 14 + .../v1/conversation_with_participants.py | 243 ++++++++++++++++ .../rest/conversations/v1/service/__init__.py | 25 ++ .../service/conversation_with_participants.py | 264 ++++++++++++++++++ .../marketplace/v1/referral_conversion.py | 140 ++-------- twilio/rest/numbers/v1/__init__.py | 24 +- ...=> porting_webhook_configuration_fetch.py} | 26 +- 8 files changed, 612 insertions(+), 130 deletions(-) create mode 100644 twilio/rest/conversations/v1/conversation_with_participants.py create mode 100644 twilio/rest/conversations/v1/service/conversation_with_participants.py rename twilio/rest/numbers/v1/{webhook.py => porting_webhook_configuration_fetch.py} (77%) diff --git a/CHANGES.md b/CHANGES.md index bdadc9361c..a0c6db00a2 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,12 @@ twilio-python Changelog Here you can see the full list of changes between each twilio-python release. +[2024-10-24] Version 9.3.5 +-------------------------- +**Conversations** +- Expose ConversationWithParticipants resource that allows creating a conversation with participants + + [2024-10-17] Version 9.3.4 -------------------------- **Api** diff --git a/twilio/rest/conversations/v1/__init__.py b/twilio/rest/conversations/v1/__init__.py index 3296ba2b46..1ec6c22a7b 100644 --- a/twilio/rest/conversations/v1/__init__.py +++ b/twilio/rest/conversations/v1/__init__.py @@ -18,6 +18,9 @@ from twilio.rest.conversations.v1.address_configuration import AddressConfigurationList from twilio.rest.conversations.v1.configuration import ConfigurationList from twilio.rest.conversations.v1.conversation import ConversationList +from twilio.rest.conversations.v1.conversation_with_participants import ( + ConversationWithParticipantsList, +) from twilio.rest.conversations.v1.credential import CredentialList from twilio.rest.conversations.v1.participant_conversation import ( ParticipantConversationList, @@ -39,6 +42,9 @@ def __init__(self, domain: Domain): self._address_configurations: Optional[AddressConfigurationList] = None self._configuration: Optional[ConfigurationList] = None self._conversations: Optional[ConversationList] = None + self._conversation_with_participants: Optional[ + ConversationWithParticipantsList + ] = None self._credentials: Optional[CredentialList] = None self._participant_conversations: Optional[ParticipantConversationList] = None self._roles: Optional[RoleList] = None @@ -63,6 +69,14 @@ def conversations(self) -> ConversationList: self._conversations = ConversationList(self) return self._conversations + @property + def conversation_with_participants(self) -> ConversationWithParticipantsList: + if self._conversation_with_participants is None: + self._conversation_with_participants = ConversationWithParticipantsList( + self + ) + return self._conversation_with_participants + @property def credentials(self) -> CredentialList: if self._credentials is None: diff --git a/twilio/rest/conversations/v1/conversation_with_participants.py b/twilio/rest/conversations/v1/conversation_with_participants.py new file mode 100644 index 0000000000..402f7adde7 --- /dev/null +++ b/twilio/rest/conversations/v1/conversation_with_participants.py @@ -0,0 +1,243 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Conversations + 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 datetime import datetime +from typing import Any, Dict, List, Optional, Union +from twilio.base import deserialize, serialize, values + +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class ConversationWithParticipantsInstance(InstanceResource): + + class State(object): + INACTIVE = "inactive" + ACTIVE = "active" + CLOSED = "closed" + + class WebhookEnabledType(object): + TRUE = "true" + FALSE = "false" + + """ + :ivar account_sid: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. + :ivar chat_service_sid: The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. + :ivar messaging_service_sid: The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to. + :ivar sid: A 34 character string that uniquely identifies this resource. + :ivar friendly_name: The human-readable name of this conversation, limited to 256 characters. Optional. + :ivar unique_name: An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. + :ivar attributes: An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. + :ivar state: + :ivar date_created: The date that this resource was created. + :ivar date_updated: The date that this resource was last updated. + :ivar timers: Timer date values representing state update for this conversation. + :ivar links: Contains absolute URLs to access the [participants](https://www.twilio.com/docs/conversations/api/conversation-participant-resource), [messages](https://www.twilio.com/docs/conversations/api/conversation-message-resource) and [webhooks](https://www.twilio.com/docs/conversations/api/conversation-scoped-webhook-resource) of this conversation. + :ivar bindings: + :ivar url: An absolute API resource URL for this conversation. + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) + + self.account_sid: Optional[str] = payload.get("account_sid") + self.chat_service_sid: Optional[str] = payload.get("chat_service_sid") + self.messaging_service_sid: Optional[str] = payload.get("messaging_service_sid") + self.sid: Optional[str] = payload.get("sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.unique_name: Optional[str] = payload.get("unique_name") + self.attributes: Optional[str] = payload.get("attributes") + self.state: Optional["ConversationWithParticipantsInstance.State"] = ( + payload.get("state") + ) + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.timers: Optional[Dict[str, object]] = payload.get("timers") + self.links: Optional[Dict[str, object]] = payload.get("links") + self.bindings: Optional[Dict[str, object]] = payload.get("bindings") + self.url: Optional[str] = payload.get("url") + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "" + + +class ConversationWithParticipantsList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the ConversationWithParticipantsList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/ConversationWithParticipants" + + def create( + self, + x_twilio_webhook_enabled: Union[ + "ConversationWithParticipantsInstance.WebhookEnabledType", object + ] = values.unset, + friendly_name: Union[str, object] = values.unset, + unique_name: Union[str, object] = values.unset, + date_created: Union[datetime, object] = values.unset, + date_updated: Union[datetime, object] = values.unset, + messaging_service_sid: Union[str, object] = values.unset, + attributes: Union[str, object] = values.unset, + state: Union[ + "ConversationWithParticipantsInstance.State", object + ] = values.unset, + timers_inactive: Union[str, object] = values.unset, + timers_closed: Union[str, object] = values.unset, + bindings_email_address: Union[str, object] = values.unset, + bindings_email_name: Union[str, object] = values.unset, + participant: Union[List[str], object] = values.unset, + ) -> ConversationWithParticipantsInstance: + """ + Create the ConversationWithParticipantsInstance + + :param x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header + :param friendly_name: The human-readable name of this conversation, limited to 256 characters. Optional. + :param unique_name: An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. + :param date_created: The date that this resource was created. + :param date_updated: The date that this resource was last updated. + :param messaging_service_sid: The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to. + :param attributes: An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. + :param state: + :param timers_inactive: ISO8601 duration when conversation will be switched to `inactive` state. Minimum value for this timer is 1 minute. + :param timers_closed: ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. + :param bindings_email_address: The default email address that will be used when sending outbound emails in this conversation. + :param bindings_email_name: The default name that will be used when sending outbound emails in this conversation. + :param participant: The participant to be added to the conversation in JSON format. The parameters are as in [Participant Resource](https://www.twilio.com/docs/conversations/api/conversation-participant-resource). The maximum number of participants that can be added in a single request is 10. + + :returns: The created ConversationWithParticipantsInstance + """ + + data = values.of( + { + "FriendlyName": friendly_name, + "UniqueName": unique_name, + "DateCreated": serialize.iso8601_datetime(date_created), + "DateUpdated": serialize.iso8601_datetime(date_updated), + "MessagingServiceSid": messaging_service_sid, + "Attributes": attributes, + "State": state, + "Timers.Inactive": timers_inactive, + "Timers.Closed": timers_closed, + "Bindings.Email.Address": bindings_email_address, + "Bindings.Email.Name": bindings_email_name, + "Participant": serialize.map(participant, lambda e: e), + } + ) + headers = values.of( + { + "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, + "Content-Type": "application/x-www-form-urlencoded", + } + ) + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return ConversationWithParticipantsInstance(self._version, payload) + + async def create_async( + self, + x_twilio_webhook_enabled: Union[ + "ConversationWithParticipantsInstance.WebhookEnabledType", object + ] = values.unset, + friendly_name: Union[str, object] = values.unset, + unique_name: Union[str, object] = values.unset, + date_created: Union[datetime, object] = values.unset, + date_updated: Union[datetime, object] = values.unset, + messaging_service_sid: Union[str, object] = values.unset, + attributes: Union[str, object] = values.unset, + state: Union[ + "ConversationWithParticipantsInstance.State", object + ] = values.unset, + timers_inactive: Union[str, object] = values.unset, + timers_closed: Union[str, object] = values.unset, + bindings_email_address: Union[str, object] = values.unset, + bindings_email_name: Union[str, object] = values.unset, + participant: Union[List[str], object] = values.unset, + ) -> ConversationWithParticipantsInstance: + """ + Asynchronously create the ConversationWithParticipantsInstance + + :param x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header + :param friendly_name: The human-readable name of this conversation, limited to 256 characters. Optional. + :param unique_name: An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. + :param date_created: The date that this resource was created. + :param date_updated: The date that this resource was last updated. + :param messaging_service_sid: The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to. + :param attributes: An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. + :param state: + :param timers_inactive: ISO8601 duration when conversation will be switched to `inactive` state. Minimum value for this timer is 1 minute. + :param timers_closed: ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. + :param bindings_email_address: The default email address that will be used when sending outbound emails in this conversation. + :param bindings_email_name: The default name that will be used when sending outbound emails in this conversation. + :param participant: The participant to be added to the conversation in JSON format. The parameters are as in [Participant Resource](https://www.twilio.com/docs/conversations/api/conversation-participant-resource). The maximum number of participants that can be added in a single request is 10. + + :returns: The created ConversationWithParticipantsInstance + """ + + data = values.of( + { + "FriendlyName": friendly_name, + "UniqueName": unique_name, + "DateCreated": serialize.iso8601_datetime(date_created), + "DateUpdated": serialize.iso8601_datetime(date_updated), + "MessagingServiceSid": messaging_service_sid, + "Attributes": attributes, + "State": state, + "Timers.Inactive": timers_inactive, + "Timers.Closed": timers_closed, + "Bindings.Email.Address": bindings_email_address, + "Bindings.Email.Name": bindings_email_name, + "Participant": serialize.map(participant, lambda e: e), + } + ) + headers = values.of( + { + "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, + "Content-Type": "application/x-www-form-urlencoded", + } + ) + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return ConversationWithParticipantsInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/conversations/v1/service/__init__.py b/twilio/rest/conversations/v1/service/__init__.py index a06afa2f77..415c252290 100644 --- a/twilio/rest/conversations/v1/service/__init__.py +++ b/twilio/rest/conversations/v1/service/__init__.py @@ -23,6 +23,9 @@ from twilio.rest.conversations.v1.service.binding import BindingList from twilio.rest.conversations.v1.service.configuration import ConfigurationList from twilio.rest.conversations.v1.service.conversation import ConversationList +from twilio.rest.conversations.v1.service.conversation_with_participants import ( + ConversationWithParticipantsList, +) from twilio.rest.conversations.v1.service.participant_conversation import ( ParticipantConversationList, ) @@ -135,6 +138,13 @@ def conversations(self) -> ConversationList: """ return self._proxy.conversations + @property + def conversation_with_participants(self) -> ConversationWithParticipantsList: + """ + Access the conversation_with_participants + """ + return self._proxy.conversation_with_participants + @property def participant_conversations(self) -> ParticipantConversationList: """ @@ -186,6 +196,9 @@ def __init__(self, version: Version, sid: str): self._bindings: Optional[BindingList] = None self._configuration: Optional[ConfigurationList] = None self._conversations: Optional[ConversationList] = None + self._conversation_with_participants: Optional[ + ConversationWithParticipantsList + ] = None self._participant_conversations: Optional[ParticipantConversationList] = None self._roles: Optional[RoleList] = None self._users: Optional[UserList] = None @@ -288,6 +301,18 @@ def conversations(self) -> ConversationList: ) return self._conversations + @property + def conversation_with_participants(self) -> ConversationWithParticipantsList: + """ + Access the conversation_with_participants + """ + if self._conversation_with_participants is None: + self._conversation_with_participants = ConversationWithParticipantsList( + self._version, + self._solution["sid"], + ) + return self._conversation_with_participants + @property def participant_conversations(self) -> ParticipantConversationList: """ diff --git a/twilio/rest/conversations/v1/service/conversation_with_participants.py b/twilio/rest/conversations/v1/service/conversation_with_participants.py new file mode 100644 index 0000000000..123f159764 --- /dev/null +++ b/twilio/rest/conversations/v1/service/conversation_with_participants.py @@ -0,0 +1,264 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Conversations + 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 datetime import datetime +from typing import Any, Dict, List, Optional, Union +from twilio.base import deserialize, serialize, values + +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class ConversationWithParticipantsInstance(InstanceResource): + + class State(object): + INACTIVE = "inactive" + ACTIVE = "active" + CLOSED = "closed" + + class WebhookEnabledType(object): + TRUE = "true" + FALSE = "false" + + """ + :ivar account_sid: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. + :ivar chat_service_sid: The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. + :ivar messaging_service_sid: The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to. + :ivar sid: A 34 character string that uniquely identifies this resource. + :ivar friendly_name: The human-readable name of this conversation, limited to 256 characters. Optional. + :ivar unique_name: An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. + :ivar attributes: An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. + :ivar state: + :ivar date_created: The date that this resource was created. + :ivar date_updated: The date that this resource was last updated. + :ivar timers: Timer date values representing state update for this conversation. + :ivar links: Contains absolute URLs to access the [participants](https://www.twilio.com/docs/conversations/api/conversation-participant-resource), [messages](https://www.twilio.com/docs/conversations/api/conversation-message-resource) and [webhooks](https://www.twilio.com/docs/conversations/api/conversation-scoped-webhook-resource) of this conversation. + :ivar bindings: + :ivar url: An absolute API resource URL for this conversation. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], chat_service_sid: str + ): + super().__init__(version) + + self.account_sid: Optional[str] = payload.get("account_sid") + self.chat_service_sid: Optional[str] = payload.get("chat_service_sid") + self.messaging_service_sid: Optional[str] = payload.get("messaging_service_sid") + self.sid: Optional[str] = payload.get("sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.unique_name: Optional[str] = payload.get("unique_name") + self.attributes: Optional[str] = payload.get("attributes") + self.state: Optional["ConversationWithParticipantsInstance.State"] = ( + payload.get("state") + ) + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.timers: Optional[Dict[str, object]] = payload.get("timers") + self.links: Optional[Dict[str, object]] = payload.get("links") + self.bindings: Optional[Dict[str, object]] = payload.get("bindings") + self.url: Optional[str] = payload.get("url") + + self._solution = { + "chat_service_sid": chat_service_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 ConversationWithParticipantsList(ListResource): + + def __init__(self, version: Version, chat_service_sid: str): + """ + Initialize the ConversationWithParticipantsList + + :param version: Version that contains the resource + :param chat_service_sid: The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Conversation resource is associated with. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "chat_service_sid": chat_service_sid, + } + self._uri = "/Services/{chat_service_sid}/ConversationWithParticipants".format( + **self._solution + ) + + def create( + self, + x_twilio_webhook_enabled: Union[ + "ConversationWithParticipantsInstance.WebhookEnabledType", object + ] = values.unset, + friendly_name: Union[str, object] = values.unset, + unique_name: Union[str, object] = values.unset, + date_created: Union[datetime, object] = values.unset, + date_updated: Union[datetime, object] = values.unset, + messaging_service_sid: Union[str, object] = values.unset, + attributes: Union[str, object] = values.unset, + state: Union[ + "ConversationWithParticipantsInstance.State", object + ] = values.unset, + timers_inactive: Union[str, object] = values.unset, + timers_closed: Union[str, object] = values.unset, + bindings_email_address: Union[str, object] = values.unset, + bindings_email_name: Union[str, object] = values.unset, + participant: Union[List[str], object] = values.unset, + ) -> ConversationWithParticipantsInstance: + """ + Create the ConversationWithParticipantsInstance + + :param x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header + :param friendly_name: The human-readable name of this conversation, limited to 256 characters. Optional. + :param unique_name: An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. + :param date_created: The date that this resource was created. + :param date_updated: The date that this resource was last updated. + :param messaging_service_sid: The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to. + :param attributes: An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. + :param state: + :param timers_inactive: ISO8601 duration when conversation will be switched to `inactive` state. Minimum value for this timer is 1 minute. + :param timers_closed: ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. + :param bindings_email_address: The default email address that will be used when sending outbound emails in this conversation. + :param bindings_email_name: The default name that will be used when sending outbound emails in this conversation. + :param participant: The participant to be added to the conversation in JSON format. The parameters are as in [Participant Resource](https://www.twilio.com/docs/conversations/api/conversation-participant-resource). The maximum number of participants that can be added in a single request is 10. + + :returns: The created ConversationWithParticipantsInstance + """ + + data = values.of( + { + "FriendlyName": friendly_name, + "UniqueName": unique_name, + "DateCreated": serialize.iso8601_datetime(date_created), + "DateUpdated": serialize.iso8601_datetime(date_updated), + "MessagingServiceSid": messaging_service_sid, + "Attributes": attributes, + "State": state, + "Timers.Inactive": timers_inactive, + "Timers.Closed": timers_closed, + "Bindings.Email.Address": bindings_email_address, + "Bindings.Email.Name": bindings_email_name, + "Participant": serialize.map(participant, lambda e: e), + } + ) + headers = values.of( + { + "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, + "Content-Type": "application/x-www-form-urlencoded", + } + ) + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return ConversationWithParticipantsInstance( + self._version, payload, chat_service_sid=self._solution["chat_service_sid"] + ) + + async def create_async( + self, + x_twilio_webhook_enabled: Union[ + "ConversationWithParticipantsInstance.WebhookEnabledType", object + ] = values.unset, + friendly_name: Union[str, object] = values.unset, + unique_name: Union[str, object] = values.unset, + date_created: Union[datetime, object] = values.unset, + date_updated: Union[datetime, object] = values.unset, + messaging_service_sid: Union[str, object] = values.unset, + attributes: Union[str, object] = values.unset, + state: Union[ + "ConversationWithParticipantsInstance.State", object + ] = values.unset, + timers_inactive: Union[str, object] = values.unset, + timers_closed: Union[str, object] = values.unset, + bindings_email_address: Union[str, object] = values.unset, + bindings_email_name: Union[str, object] = values.unset, + participant: Union[List[str], object] = values.unset, + ) -> ConversationWithParticipantsInstance: + """ + Asynchronously create the ConversationWithParticipantsInstance + + :param x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header + :param friendly_name: The human-readable name of this conversation, limited to 256 characters. Optional. + :param unique_name: An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. + :param date_created: The date that this resource was created. + :param date_updated: The date that this resource was last updated. + :param messaging_service_sid: The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to. + :param attributes: An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. + :param state: + :param timers_inactive: ISO8601 duration when conversation will be switched to `inactive` state. Minimum value for this timer is 1 minute. + :param timers_closed: ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. + :param bindings_email_address: The default email address that will be used when sending outbound emails in this conversation. + :param bindings_email_name: The default name that will be used when sending outbound emails in this conversation. + :param participant: The participant to be added to the conversation in JSON format. The parameters are as in [Participant Resource](https://www.twilio.com/docs/conversations/api/conversation-participant-resource). The maximum number of participants that can be added in a single request is 10. + + :returns: The created ConversationWithParticipantsInstance + """ + + data = values.of( + { + "FriendlyName": friendly_name, + "UniqueName": unique_name, + "DateCreated": serialize.iso8601_datetime(date_created), + "DateUpdated": serialize.iso8601_datetime(date_updated), + "MessagingServiceSid": messaging_service_sid, + "Attributes": attributes, + "State": state, + "Timers.Inactive": timers_inactive, + "Timers.Closed": timers_closed, + "Bindings.Email.Address": bindings_email_address, + "Bindings.Email.Name": bindings_email_name, + "Participant": serialize.map(participant, lambda e: e), + } + ) + headers = values.of( + { + "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, + "Content-Type": "application/x-www-form-urlencoded", + } + ) + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return ConversationWithParticipantsInstance( + self._version, payload, chat_service_sid=self._solution["chat_service_sid"] + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/marketplace/v1/referral_conversion.py b/twilio/rest/marketplace/v1/referral_conversion.py index 62d6ad84fd..47bb191ed7 100644 --- a/twilio/rest/marketplace/v1/referral_conversion.py +++ b/twilio/rest/marketplace/v1/referral_conversion.py @@ -14,7 +14,7 @@ from typing import Any, Dict, Optional from twilio.base import values -from twilio.base.instance_context import InstanceContext + from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource from twilio.base.version import Version @@ -30,67 +30,40 @@ def __init__(self, version: Version, payload: Dict[str, Any]): self.converted_account_sid: Optional[str] = payload.get("converted_account_sid") - self._context: Optional[ReferralConversionContext] = None - - @property - def _proxy(self) -> "ReferralConversionContext": - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ReferralConversionContext for this ReferralConversionInstance - """ - if self._context is None: - self._context = ReferralConversionContext( - self._version, - ) - return self._context - - def create( - self, create_referral_conversion_request: CreateReferralConversionRequest - ) -> "ReferralConversionInstance": + def __repr__(self) -> str: """ - Create the ReferralConversionInstance - - :param create_referral_conversion_request: + Provide a friendly representation - :returns: The created ReferralConversionInstance + :returns: Machine friendly representation """ - return self._proxy.create( - create_referral_conversion_request, - ) - async def create_async( - self, create_referral_conversion_request: CreateReferralConversionRequest - ) -> "ReferralConversionInstance": - """ - Asynchronous coroutine to create the ReferralConversionInstance + return "" - :param create_referral_conversion_request: - :returns: The created ReferralConversionInstance - """ - return await self._proxy.create_async( - create_referral_conversion_request, - ) +class ReferralConversionList(ListResource): - def __repr__(self) -> str: + class CreateReferralConversionRequest(object): """ - Provide a friendly representation - - :returns: Machine friendly representation + :ivar referral_account_sid: """ - return "" + def __init__(self, payload: Dict[str, Any]): + self.referral_account_sid: Optional[str] = payload.get( + "referral_account_sid" + ) -class ReferralConversionContext(InstanceContext): + def to_dict(self): + return { + "referral_account_sid": self.referral_account_sid, + } def __init__(self, version: Version): """ - Initialize the ReferralConversionContext + Initialize the ReferralConversionList :param version: Version that contains the resource + """ super().__init__(version) @@ -106,13 +79,14 @@ def create( :returns: The created ReferralConversionInstance """ - data = values.of( - { - "CreateReferralConversionRequest": create_referral_conversion_request, - } - ) + data = create_referral_conversion_request.to_dict() - payload = self._version.create(method="POST", uri=self._uri, data=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) return ReferralConversionInstance(self._version, payload) @@ -120,75 +94,23 @@ async def create_async( self, create_referral_conversion_request: CreateReferralConversionRequest ) -> ReferralConversionInstance: """ - Asynchronous coroutine to create the ReferralConversionInstance + Asynchronously create the ReferralConversionInstance :param create_referral_conversion_request: :returns: The created ReferralConversionInstance """ - data = values.of( - { - "CreateReferralConversionRequest": create_referral_conversion_request, - } - ) + data = create_referral_conversion_request.to_dict() + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" payload = await self._version.create_async( - method="POST", uri=self._uri, data=data + method="POST", uri=self._uri, data=data, headers=headers ) return ReferralConversionInstance(self._version, payload) - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - - return "" - - -class ReferralConversionList(ListResource): - - class CreateReferralConversionRequest(object): - """ - :ivar referral_account_sid: - """ - - def __init__(self, payload: Dict[str, Any]): - - self.referral_account_sid: Optional[str] = payload.get( - "referral_account_sid" - ) - - def to_dict(self): - return { - "referral_account_sid": self.referral_account_sid, - } - - def __init__(self, version: Version): - """ - Initialize the ReferralConversionList - - :param version: Version that contains the resource - - """ - super().__init__(version) - - def get(self) -> ReferralConversionContext: - """ - Constructs a ReferralConversionContext - - """ - return ReferralConversionContext(self._version) - - def __call__(self) -> ReferralConversionContext: - """ - Constructs a ReferralConversionContext - - """ - return ReferralConversionContext(self._version) - 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 68f078a88d..043364c3d5 100644 --- a/twilio/rest/numbers/v1/__init__.py +++ b/twilio/rest/numbers/v1/__init__.py @@ -28,10 +28,12 @@ from twilio.rest.numbers.v1.porting_webhook_configuration_delete import ( PortingWebhookConfigurationDeleteList, ) +from twilio.rest.numbers.v1.porting_webhook_configuration_fetch import ( + PortingWebhookConfigurationFetchList, +) from twilio.rest.numbers.v1.signing_request_configuration import ( SigningRequestConfigurationList, ) -from twilio.rest.numbers.v1.webhook import WebhookList class V1(Version): @@ -56,10 +58,12 @@ def __init__(self, domain: Domain): self._porting_webhook_configurations_delete: Optional[ PortingWebhookConfigurationDeleteList ] = None + self._porting_webhook_configuration_fetch: Optional[ + PortingWebhookConfigurationFetchList + ] = None self._signing_request_configurations: Optional[ SigningRequestConfigurationList ] = None - self._webhook: Optional[WebhookList] = None @property def bulk_eligibilities(self) -> BulkEligibilityList: @@ -107,18 +111,22 @@ def porting_webhook_configurations_delete( ) return self._porting_webhook_configurations_delete + @property + def porting_webhook_configuration_fetch( + self, + ) -> PortingWebhookConfigurationFetchList: + if self._porting_webhook_configuration_fetch is None: + self._porting_webhook_configuration_fetch = ( + PortingWebhookConfigurationFetchList(self) + ) + return self._porting_webhook_configuration_fetch + @property def signing_request_configurations(self) -> SigningRequestConfigurationList: if self._signing_request_configurations is None: self._signing_request_configurations = SigningRequestConfigurationList(self) return self._signing_request_configurations - @property - def webhook(self) -> WebhookList: - if self._webhook is None: - self._webhook = WebhookList(self) - return self._webhook - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/numbers/v1/webhook.py b/twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py similarity index 77% rename from twilio/rest/numbers/v1/webhook.py rename to twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py index 88ca64e9e1..89b8064bdb 100644 --- a/twilio/rest/numbers/v1/webhook.py +++ b/twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py @@ -21,7 +21,7 @@ from twilio.base.version import Version -class WebhookInstance(InstanceResource): +class PortingWebhookConfigurationFetchInstance(InstanceResource): """ :ivar url: The URL of the webhook configuration request :ivar port_in_target_url: The complete webhook url that will be called when a notification event for port in request or port in phone number happens @@ -52,14 +52,14 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" -class WebhookList(ListResource): +class PortingWebhookConfigurationFetchList(ListResource): def __init__(self, version: Version): """ - Initialize the WebhookList + Initialize the PortingWebhookConfigurationFetchList :param version: Version that contains the resource @@ -68,25 +68,25 @@ def __init__(self, version: Version): self._uri = "/Porting/Configuration/Webhook" - def fetch(self) -> WebhookInstance: + def fetch(self) -> PortingWebhookConfigurationFetchInstance: """ - Asynchronously fetch the WebhookInstance + Asynchronously fetch the PortingWebhookConfigurationFetchInstance - :returns: The fetched WebhookInstance + :returns: The fetched PortingWebhookConfigurationFetchInstance """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) - return WebhookInstance(self._version, payload) + return PortingWebhookConfigurationFetchInstance(self._version, payload) - async def fetch_async(self) -> WebhookInstance: + async def fetch_async(self) -> PortingWebhookConfigurationFetchInstance: """ - Asynchronously fetch the WebhookInstance + Asynchronously fetch the PortingWebhookConfigurationFetchInstance - :returns: The fetched WebhookInstance + :returns: The fetched PortingWebhookConfigurationFetchInstance """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -94,7 +94,7 @@ async def fetch_async(self) -> WebhookInstance: method="GET", uri=self._uri, headers=headers ) - return WebhookInstance(self._version, payload) + return PortingWebhookConfigurationFetchInstance(self._version, payload) def __repr__(self) -> str: """ @@ -102,4 +102,4 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" From 19e54f9c1e3ed865326641f7cbfb94d9555e2a94 Mon Sep 17 00:00:00 2001 From: Twilio Date: Thu, 24 Oct 2024 13:34:35 +0000 Subject: [PATCH 42/87] Release 9.3.5 --- setup.py | 2 +- twilio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index a81b74cc51..2350dbfc2c 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name="twilio", - version="9.3.4", + version="9.3.5", description="Twilio API client and TwiML generator", author="Twilio", help_center="https://www.twilio.com/help/contact", diff --git a/twilio/__init__.py b/twilio/__init__.py index a14d90732d..03a9b11574 100644 --- a/twilio/__init__.py +++ b/twilio/__init__.py @@ -1,2 +1,2 @@ -__version_info__ = ("9", "3", "4") +__version_info__ = ("9", "3", "5") __version__ = ".".join(__version_info__) From efa28037b00092721feb27ee517df2063954d482 Mon Sep 17 00:00:00 2001 From: Shubham Date: Fri, 25 Oct 2024 17:11:20 +0530 Subject: [PATCH 43/87] chore: removing unavailable references from init files (#818) --- twilio/rest/autopilot/__init__.py | 25 --------------- twilio/rest/iam/__init__.py | 10 ------ twilio/rest/media/__init__.py | 35 -------------------- twilio/rest/oauth/__init__.py | 39 ----------------------- twilio/rest/preview/__init__.py | 9 ------ twilio/rest/preview_messaging/__init__.py | 13 -------- 6 files changed, 131 deletions(-) delete mode 100644 twilio/rest/autopilot/__init__.py delete mode 100644 twilio/rest/media/__init__.py delete mode 100644 twilio/rest/preview_messaging/__init__.py diff --git a/twilio/rest/autopilot/__init__.py b/twilio/rest/autopilot/__init__.py deleted file mode 100644 index f382325023..0000000000 --- a/twilio/rest/autopilot/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -from warnings import warn - -from twilio.rest.autopilot.AutopilotBase import AutopilotBase -from twilio.rest.autopilot.v1.assistant import AssistantList -from twilio.rest.autopilot.v1.restore_assistant import RestoreAssistantList - - -class Autopilot(AutopilotBase): - @property - def assistants(self) -> AssistantList: - warn( - "assistants is deprecated. Use v1.assistants instead.", - DeprecationWarning, - stacklevel=2, - ) - return self.v1.assistants - - @property - def restore_assistant(self) -> RestoreAssistantList: - warn( - "restore_assistant is deprecated. Use v1.restore_assistant instead.", - DeprecationWarning, - stacklevel=2, - ) - return self.v1.restore_assistant diff --git a/twilio/rest/iam/__init__.py b/twilio/rest/iam/__init__.py index f992caa578..994ecee62f 100644 --- a/twilio/rest/iam/__init__.py +++ b/twilio/rest/iam/__init__.py @@ -3,7 +3,6 @@ from twilio.rest.iam.IamBase import IamBase from twilio.rest.iam.v1.api_key import ApiKeyList from twilio.rest.iam.v1.get_api_keys import GetApiKeysList -from twilio.rest.iam.v1.new_api_key import NewApiKeyList class Iam(IamBase): @@ -24,12 +23,3 @@ def get_api_keys(self) -> GetApiKeysList: stacklevel=2, ) return self.v1.get_api_keys - - @property - def new_api_key(self) -> NewApiKeyList: - warn( - "new_api_key is deprecated. Use v1.new_api_key instead.", - DeprecationWarning, - stacklevel=2, - ) - return self.v1.new_api_key diff --git a/twilio/rest/media/__init__.py b/twilio/rest/media/__init__.py deleted file mode 100644 index ce6207e29a..0000000000 --- a/twilio/rest/media/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -from warnings import warn - -from twilio.rest.media.MediaBase import MediaBase -from twilio.rest.media.v1.media_processor import MediaProcessorList -from twilio.rest.media.v1.media_recording import MediaRecordingList -from twilio.rest.media.v1.player_streamer import PlayerStreamerList - - -class Media(MediaBase): - @property - def media_processor(self) -> MediaProcessorList: - warn( - "media_processor is deprecated. Use v1.media_processor instead.", - DeprecationWarning, - stacklevel=2, - ) - return self.v1.media_processor - - @property - def media_recording(self) -> MediaRecordingList: - warn( - "media_recording is deprecated. Use v1.media_recording instead.", - DeprecationWarning, - stacklevel=2, - ) - return self.v1.media_recording - - @property - def player_streamer(self) -> PlayerStreamerList: - warn( - "player_streamer is deprecated. Use v1.player_streamer instead.", - DeprecationWarning, - stacklevel=2, - ) - return self.v1.player_streamer diff --git a/twilio/rest/oauth/__init__.py b/twilio/rest/oauth/__init__.py index 709150e9e0..586cf6b4d9 100644 --- a/twilio/rest/oauth/__init__.py +++ b/twilio/rest/oauth/__init__.py @@ -1,40 +1,10 @@ from warnings import warn from twilio.rest.oauth.OauthBase import OauthBase -from twilio.rest.oauth.v1.device_code import DeviceCodeList -from twilio.rest.oauth.v1.oauth import OauthList -from twilio.rest.oauth.v1.openid_discovery import OpenidDiscoveryList from twilio.rest.oauth.v1.token import TokenList -from twilio.rest.oauth.v1.user_info import UserInfoList class Oauth(OauthBase): - @property - def oauth(self) -> OauthList: - warn( - "oauth is deprecated. Use v1.oauth instead.", - DeprecationWarning, - stacklevel=2, - ) - return self.v1.oauth - - @property - def device_code(self) -> DeviceCodeList: - warn( - "device_code is deprecated. Use v1.device_code instead.", - DeprecationWarning, - stacklevel=2, - ) - return self.v1.device_code - - @property - def openid_discovery(self) -> OpenidDiscoveryList: - warn( - "openid_discovery is deprecated. Use v1.openid_discovery instead.", - DeprecationWarning, - stacklevel=2, - ) - return self.v1.openid_discovery @property def token(self) -> TokenList: @@ -44,12 +14,3 @@ def token(self) -> TokenList: stacklevel=2, ) return self.v1.token - - @property - def user_info(self) -> UserInfoList: - warn( - "user_info is deprecated. Use v1.user_info instead.", - DeprecationWarning, - stacklevel=2, - ) - return self.v1.user_info diff --git a/twilio/rest/preview/__init__.py b/twilio/rest/preview/__init__.py index 79d870e134..501ae417d0 100644 --- a/twilio/rest/preview/__init__.py +++ b/twilio/rest/preview/__init__.py @@ -1,7 +1,6 @@ from warnings import warn from twilio.rest.preview.PreviewBase import PreviewBase -from twilio.rest.preview.deployed_devices.fleet import FleetList from twilio.rest.preview.hosted_numbers.authorization_document import ( AuthorizationDocumentList, ) @@ -15,14 +14,6 @@ class Preview(PreviewBase): - @property - def fleets(self) -> FleetList: - warn( - "fleets is deprecated. Use deployed_devices.fleets instead.", - DeprecationWarning, - stacklevel=2, - ) - return self.deployed_devices.fleets @property def authorization_documents(self) -> AuthorizationDocumentList: diff --git a/twilio/rest/preview_messaging/__init__.py b/twilio/rest/preview_messaging/__init__.py deleted file mode 100644 index 73bf67969d..0000000000 --- a/twilio/rest/preview_messaging/__init__.py +++ /dev/null @@ -1,13 +0,0 @@ -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 From 15ee3e665980b6dc6bd66fac56e58ff8adc12b33 Mon Sep 17 00:00:00 2001 From: Twilio Date: Fri, 25 Oct 2024 11:45:55 +0000 Subject: [PATCH 44/87] [Librarian] Regenerated @ 2e932f6c59e0f9fb6cb96952802e5ebedd83b6f0 1852557f82faade033dbd5bd0615c9e1aa4d9fae --- CHANGES.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index a0c6db00a2..f031545e18 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,12 @@ twilio-python Changelog Here you can see the full list of changes between each twilio-python release. +[2024-10-25] Version 9.3.6 +-------------------------- +**Library - Chore** +- [PR #818](https://github.com/twilio/twilio-python/pull/818): removing unavailable references from init files. Thanks to [@tiwarishubham635](https://github.com/tiwarishubham635)! + + [2024-10-24] Version 9.3.5 -------------------------- **Conversations** From 3fc2d25d6e7ceedf463f99ebceaaf56dde3de7bf Mon Sep 17 00:00:00 2001 From: Twilio Date: Fri, 25 Oct 2024 11:52:41 +0000 Subject: [PATCH 45/87] Release 9.3.6 --- setup.py | 2 +- twilio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 2350dbfc2c..152d6f98b5 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name="twilio", - version="9.3.5", + version="9.3.6", description="Twilio API client and TwiML generator", author="Twilio", help_center="https://www.twilio.com/help/contact", diff --git a/twilio/__init__.py b/twilio/__init__.py index 03a9b11574..5fe186e287 100644 --- a/twilio/__init__.py +++ b/twilio/__init__.py @@ -1,2 +1,2 @@ -__version_info__ = ("9", "3", "5") +__version_info__ = ("9", "3", "6") __version__ = ".".join(__version_info__) From 5aa42dc526d486140fd5c021a5e7da4e76318978 Mon Sep 17 00:00:00 2001 From: sbansla <104902068+sbansla@users.noreply.github.com> Date: Mon, 28 Oct 2024 17:32:59 +0530 Subject: [PATCH 46/87] chore: use older verison of aiohttp_retry (#819) * use older verison of aiohttp_retry --- requirements.txt | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index a29abc4d1e..3de95e70c9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,5 +2,5 @@ pygments>=2.7.4 # not directly required, pinned by Snyk to avoid a vulnerability requests>=2.31.0 PyJWT>=2.0.0, <3.0.0 aiohttp>=3.9.4 -aiohttp-retry>=2.8.3 +aiohttp-retry==2.8.3 certifi>=2023.7.22 # not directly required, pinned by Snyk to avoid a vulnerability diff --git a/setup.py b/setup.py index 152d6f98b5..b769d7ff4a 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,7 @@ "requests >= 2.0.0", "PyJWT >= 2.0.0, < 3.0.0", "aiohttp>=3.8.4", - "aiohttp-retry>=2.8.3", + "aiohttp-retry==2.8.3", ], packages=find_packages(exclude=["tests", "tests.*"]), include_package_data=True, From 4f1e7d2d02b811035c3872a72e2f9d1a05a4544e Mon Sep 17 00:00:00 2001 From: Twilio Date: Fri, 15 Nov 2024 07:13:32 +0000 Subject: [PATCH 47/87] [Librarian] Regenerated @ 51e40434baa37a97b298d416220c6de10d9698c4 1ac2fcf2e173acdee4491031f59034933467a82c --- CHANGES.md | 14 ++++++++++ .../v2010/account/usage/record/__init__.py | 2 ++ .../v2010/account/usage/record/all_time.py | 2 ++ .../api/v2010/account/usage/record/daily.py | 2 ++ .../v2010/account/usage/record/last_month.py | 2 ++ .../api/v2010/account/usage/record/monthly.py | 2 ++ .../v2010/account/usage/record/this_month.py | 2 ++ .../api/v2010/account/usage/record/today.py | 2 ++ .../api/v2010/account/usage/record/yearly.py | 2 ++ .../v2010/account/usage/record/yesterday.py | 2 ++ .../rest/api/v2010/account/usage/trigger.py | 2 ++ twilio/rest/content/v1/content/__init__.py | 1 + .../v1/conversation_with_participants.py | 4 +-- .../service/conversation_with_participants.py | 4 +-- .../rest/insights/v1/conference/__init__.py | 1 + twilio/rest/insights/v1/room/__init__.py | 3 +++ twilio/rest/insights/v1/room/participant.py | 3 +++ twilio/rest/numbers/v1/__init__.py | 24 ++++++----------- ...hook_configuration_fetch.py => webhook.py} | 26 +++++++++---------- 19 files changed, 67 insertions(+), 33 deletions(-) rename twilio/rest/numbers/v1/{porting_webhook_configuration_fetch.py => webhook.py} (77%) diff --git a/CHANGES.md b/CHANGES.md index f031545e18..c879894ab3 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,20 @@ twilio-python Changelog Here you can see the full list of changes between each twilio-python release. +[2024-11-15] Version 9.3.7 +-------------------------- +**Library - Chore** +- [PR #819](https://github.com/twilio/twilio-python/pull/819): use older verison of aiohttp_retry. Thanks to [@sbansla](https://github.com/sbansla)! + +**Api** +- Added `ivr-virtual-agent-custom-voices` and `ivr-virtual-agent-genai` to `usage_record` API. +- Add open-api file tag to realtime_transcriptions + +**Taskrouter** +- Add `api-tag` property to workers reservation +- Add `api-tag` property to task reservation + + [2024-10-25] Version 9.3.6 -------------------------- **Library - Chore** diff --git a/twilio/rest/api/v2010/account/usage/record/__init__.py b/twilio/rest/api/v2010/account/usage/record/__init__.py index 0afc8e3472..509b98e5a2 100644 --- a/twilio/rest/api/v2010/account/usage/record/__init__.py +++ b/twilio/rest/api/v2010/account/usage/record/__init__.py @@ -80,6 +80,8 @@ class Category(object): GROUP_ROOMS_PARTICIPANT_MINUTES = "group-rooms-participant-minutes" GROUP_ROOMS_RECORDED_MINUTES = "group-rooms-recorded-minutes" IMP_V1_USAGE = "imp-v1-usage" + IVR_VIRTUAL_AGENT_CUSTOM_VOICES = "ivr-virtual-agent-custom-voices" + IVR_VIRTUAL_AGENT_GENAI = "ivr-virtual-agent-genai" LOOKUPS = "lookups" MARKETPLACE = "marketplace" MARKETPLACE_ALGORITHMIA_NAMED_ENTITY_RECOGNITION = ( diff --git a/twilio/rest/api/v2010/account/usage/record/all_time.py b/twilio/rest/api/v2010/account/usage/record/all_time.py index 7c0b6f5ce4..f7da24250d 100644 --- a/twilio/rest/api/v2010/account/usage/record/all_time.py +++ b/twilio/rest/api/v2010/account/usage/record/all_time.py @@ -72,6 +72,8 @@ class Category(object): GROUP_ROOMS_PARTICIPANT_MINUTES = "group-rooms-participant-minutes" GROUP_ROOMS_RECORDED_MINUTES = "group-rooms-recorded-minutes" IMP_V1_USAGE = "imp-v1-usage" + IVR_VIRTUAL_AGENT_CUSTOM_VOICES = "ivr-virtual-agent-custom-voices" + IVR_VIRTUAL_AGENT_GENAI = "ivr-virtual-agent-genai" LOOKUPS = "lookups" MARKETPLACE = "marketplace" MARKETPLACE_ALGORITHMIA_NAMED_ENTITY_RECOGNITION = ( diff --git a/twilio/rest/api/v2010/account/usage/record/daily.py b/twilio/rest/api/v2010/account/usage/record/daily.py index a0acd62b2a..6eff180bae 100644 --- a/twilio/rest/api/v2010/account/usage/record/daily.py +++ b/twilio/rest/api/v2010/account/usage/record/daily.py @@ -72,6 +72,8 @@ class Category(object): GROUP_ROOMS_PARTICIPANT_MINUTES = "group-rooms-participant-minutes" GROUP_ROOMS_RECORDED_MINUTES = "group-rooms-recorded-minutes" IMP_V1_USAGE = "imp-v1-usage" + IVR_VIRTUAL_AGENT_CUSTOM_VOICES = "ivr-virtual-agent-custom-voices" + IVR_VIRTUAL_AGENT_GENAI = "ivr-virtual-agent-genai" LOOKUPS = "lookups" MARKETPLACE = "marketplace" MARKETPLACE_ALGORITHMIA_NAMED_ENTITY_RECOGNITION = ( diff --git a/twilio/rest/api/v2010/account/usage/record/last_month.py b/twilio/rest/api/v2010/account/usage/record/last_month.py index 21fa1e1b61..bcaacc4ae7 100644 --- a/twilio/rest/api/v2010/account/usage/record/last_month.py +++ b/twilio/rest/api/v2010/account/usage/record/last_month.py @@ -72,6 +72,8 @@ class Category(object): GROUP_ROOMS_PARTICIPANT_MINUTES = "group-rooms-participant-minutes" GROUP_ROOMS_RECORDED_MINUTES = "group-rooms-recorded-minutes" IMP_V1_USAGE = "imp-v1-usage" + IVR_VIRTUAL_AGENT_CUSTOM_VOICES = "ivr-virtual-agent-custom-voices" + IVR_VIRTUAL_AGENT_GENAI = "ivr-virtual-agent-genai" LOOKUPS = "lookups" MARKETPLACE = "marketplace" MARKETPLACE_ALGORITHMIA_NAMED_ENTITY_RECOGNITION = ( diff --git a/twilio/rest/api/v2010/account/usage/record/monthly.py b/twilio/rest/api/v2010/account/usage/record/monthly.py index 0eff14396a..3b606977cc 100644 --- a/twilio/rest/api/v2010/account/usage/record/monthly.py +++ b/twilio/rest/api/v2010/account/usage/record/monthly.py @@ -72,6 +72,8 @@ class Category(object): GROUP_ROOMS_PARTICIPANT_MINUTES = "group-rooms-participant-minutes" GROUP_ROOMS_RECORDED_MINUTES = "group-rooms-recorded-minutes" IMP_V1_USAGE = "imp-v1-usage" + IVR_VIRTUAL_AGENT_CUSTOM_VOICES = "ivr-virtual-agent-custom-voices" + IVR_VIRTUAL_AGENT_GENAI = "ivr-virtual-agent-genai" LOOKUPS = "lookups" MARKETPLACE = "marketplace" MARKETPLACE_ALGORITHMIA_NAMED_ENTITY_RECOGNITION = ( diff --git a/twilio/rest/api/v2010/account/usage/record/this_month.py b/twilio/rest/api/v2010/account/usage/record/this_month.py index 646b4a49d5..9b7fc8a51d 100644 --- a/twilio/rest/api/v2010/account/usage/record/this_month.py +++ b/twilio/rest/api/v2010/account/usage/record/this_month.py @@ -72,6 +72,8 @@ class Category(object): GROUP_ROOMS_PARTICIPANT_MINUTES = "group-rooms-participant-minutes" GROUP_ROOMS_RECORDED_MINUTES = "group-rooms-recorded-minutes" IMP_V1_USAGE = "imp-v1-usage" + IVR_VIRTUAL_AGENT_CUSTOM_VOICES = "ivr-virtual-agent-custom-voices" + IVR_VIRTUAL_AGENT_GENAI = "ivr-virtual-agent-genai" LOOKUPS = "lookups" MARKETPLACE = "marketplace" MARKETPLACE_ALGORITHMIA_NAMED_ENTITY_RECOGNITION = ( diff --git a/twilio/rest/api/v2010/account/usage/record/today.py b/twilio/rest/api/v2010/account/usage/record/today.py index 30de9d4cb7..fed8286f7d 100644 --- a/twilio/rest/api/v2010/account/usage/record/today.py +++ b/twilio/rest/api/v2010/account/usage/record/today.py @@ -72,6 +72,8 @@ class Category(object): GROUP_ROOMS_PARTICIPANT_MINUTES = "group-rooms-participant-minutes" GROUP_ROOMS_RECORDED_MINUTES = "group-rooms-recorded-minutes" IMP_V1_USAGE = "imp-v1-usage" + IVR_VIRTUAL_AGENT_CUSTOM_VOICES = "ivr-virtual-agent-custom-voices" + IVR_VIRTUAL_AGENT_GENAI = "ivr-virtual-agent-genai" LOOKUPS = "lookups" MARKETPLACE = "marketplace" MARKETPLACE_ALGORITHMIA_NAMED_ENTITY_RECOGNITION = ( diff --git a/twilio/rest/api/v2010/account/usage/record/yearly.py b/twilio/rest/api/v2010/account/usage/record/yearly.py index fbe9dd1f6f..e773670d27 100644 --- a/twilio/rest/api/v2010/account/usage/record/yearly.py +++ b/twilio/rest/api/v2010/account/usage/record/yearly.py @@ -72,6 +72,8 @@ class Category(object): GROUP_ROOMS_PARTICIPANT_MINUTES = "group-rooms-participant-minutes" GROUP_ROOMS_RECORDED_MINUTES = "group-rooms-recorded-minutes" IMP_V1_USAGE = "imp-v1-usage" + IVR_VIRTUAL_AGENT_CUSTOM_VOICES = "ivr-virtual-agent-custom-voices" + IVR_VIRTUAL_AGENT_GENAI = "ivr-virtual-agent-genai" LOOKUPS = "lookups" MARKETPLACE = "marketplace" MARKETPLACE_ALGORITHMIA_NAMED_ENTITY_RECOGNITION = ( diff --git a/twilio/rest/api/v2010/account/usage/record/yesterday.py b/twilio/rest/api/v2010/account/usage/record/yesterday.py index db5f9eb472..a0efe356e4 100644 --- a/twilio/rest/api/v2010/account/usage/record/yesterday.py +++ b/twilio/rest/api/v2010/account/usage/record/yesterday.py @@ -72,6 +72,8 @@ class Category(object): GROUP_ROOMS_PARTICIPANT_MINUTES = "group-rooms-participant-minutes" GROUP_ROOMS_RECORDED_MINUTES = "group-rooms-recorded-minutes" IMP_V1_USAGE = "imp-v1-usage" + IVR_VIRTUAL_AGENT_CUSTOM_VOICES = "ivr-virtual-agent-custom-voices" + IVR_VIRTUAL_AGENT_GENAI = "ivr-virtual-agent-genai" LOOKUPS = "lookups" MARKETPLACE = "marketplace" MARKETPLACE_ALGORITHMIA_NAMED_ENTITY_RECOGNITION = ( diff --git a/twilio/rest/api/v2010/account/usage/trigger.py b/twilio/rest/api/v2010/account/usage/trigger.py index c3a1b241ca..ba63beec11 100644 --- a/twilio/rest/api/v2010/account/usage/trigger.py +++ b/twilio/rest/api/v2010/account/usage/trigger.py @@ -83,6 +83,8 @@ class UsageCategory(object): GROUP_ROOMS_PARTICIPANT_MINUTES = "group-rooms-participant-minutes" GROUP_ROOMS_RECORDED_MINUTES = "group-rooms-recorded-minutes" IMP_V1_USAGE = "imp-v1-usage" + IVR_VIRTUAL_AGENT_CUSTOM_VOICES = "ivr-virtual-agent-custom-voices" + IVR_VIRTUAL_AGENT_GENAI = "ivr-virtual-agent-genai" LOOKUPS = "lookups" MARKETPLACE = "marketplace" MARKETPLACE_ALGORITHMIA_NAMED_ENTITY_RECOGNITION = ( diff --git a/twilio/rest/content/v1/content/__init__.py b/twilio/rest/content/v1/content/__init__.py index 3ddc8b926e..b5261516a6 100644 --- a/twilio/rest/content/v1/content/__init__.py +++ b/twilio/rest/content/v1/content/__init__.py @@ -34,6 +34,7 @@ class CallToActionActionType(object): PHONE_NUMBER = "PHONE_NUMBER" COPY_CODE = "COPY_CODE" VOICE_CALL = "VOICE_CALL" + VOICE_CALL_REQUEST = "VOICE_CALL_REQUEST" class CardActionType(object): URL = "URL" diff --git a/twilio/rest/conversations/v1/conversation_with_participants.py b/twilio/rest/conversations/v1/conversation_with_participants.py index 402f7adde7..b50c2da1a7 100644 --- a/twilio/rest/conversations/v1/conversation_with_participants.py +++ b/twilio/rest/conversations/v1/conversation_with_participants.py @@ -131,7 +131,7 @@ def create( :param timers_closed: ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. :param bindings_email_address: The default email address that will be used when sending outbound emails in this conversation. :param bindings_email_name: The default name that will be used when sending outbound emails in this conversation. - :param participant: The participant to be added to the conversation in JSON format. The parameters are as in [Participant Resource](https://www.twilio.com/docs/conversations/api/conversation-participant-resource). The maximum number of participants that can be added in a single request is 10. + :param participant: The participant to be added to the conversation in JSON format. The JSON object attributes are as parameters in [Participant Resource](https://www.twilio.com/docs/conversations/api/conversation-participant-resource). The maximum number of participants that can be added in a single request is 10. :returns: The created ConversationWithParticipantsInstance """ @@ -200,7 +200,7 @@ async def create_async( :param timers_closed: ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. :param bindings_email_address: The default email address that will be used when sending outbound emails in this conversation. :param bindings_email_name: The default name that will be used when sending outbound emails in this conversation. - :param participant: The participant to be added to the conversation in JSON format. The parameters are as in [Participant Resource](https://www.twilio.com/docs/conversations/api/conversation-participant-resource). The maximum number of participants that can be added in a single request is 10. + :param participant: The participant to be added to the conversation in JSON format. The JSON object attributes are as parameters in [Participant Resource](https://www.twilio.com/docs/conversations/api/conversation-participant-resource). The maximum number of participants that can be added in a single request is 10. :returns: The created ConversationWithParticipantsInstance """ diff --git a/twilio/rest/conversations/v1/service/conversation_with_participants.py b/twilio/rest/conversations/v1/service/conversation_with_participants.py index 123f159764..ef1495debb 100644 --- a/twilio/rest/conversations/v1/service/conversation_with_participants.py +++ b/twilio/rest/conversations/v1/service/conversation_with_participants.py @@ -148,7 +148,7 @@ def create( :param timers_closed: ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. :param bindings_email_address: The default email address that will be used when sending outbound emails in this conversation. :param bindings_email_name: The default name that will be used when sending outbound emails in this conversation. - :param participant: The participant to be added to the conversation in JSON format. The parameters are as in [Participant Resource](https://www.twilio.com/docs/conversations/api/conversation-participant-resource). The maximum number of participants that can be added in a single request is 10. + :param participant: The participant to be added to the conversation in JSON format. The JSON object attributes are as parameters in [Participant Resource](https://www.twilio.com/docs/conversations/api/conversation-participant-resource). The maximum number of participants that can be added in a single request is 10. :returns: The created ConversationWithParticipantsInstance """ @@ -219,7 +219,7 @@ async def create_async( :param timers_closed: ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. :param bindings_email_address: The default email address that will be used when sending outbound emails in this conversation. :param bindings_email_name: The default name that will be used when sending outbound emails in this conversation. - :param participant: The participant to be added to the conversation in JSON format. The parameters are as in [Participant Resource](https://www.twilio.com/docs/conversations/api/conversation-participant-resource). The maximum number of participants that can be added in a single request is 10. + :param participant: The participant to be added to the conversation in JSON format. The JSON object attributes are as parameters in [Participant Resource](https://www.twilio.com/docs/conversations/api/conversation-participant-resource). The maximum number of participants that can be added in a single request is 10. :returns: The created ConversationWithParticipantsInstance """ diff --git a/twilio/rest/insights/v1/conference/__init__.py b/twilio/rest/insights/v1/conference/__init__.py index 1ee8c09dc8..63b8abbf9a 100644 --- a/twilio/rest/insights/v1/conference/__init__.py +++ b/twilio/rest/insights/v1/conference/__init__.py @@ -70,6 +70,7 @@ class Tag(object): HIGH_LATENCY = "high_latency" LOW_MOS = "low_mos" DETECTED_SILENCE = "detected_silence" + NO_CONCURRENT_PARTICIPANTS = "no_concurrent_participants" """ :ivar conference_sid: The unique SID identifier of the Conference. diff --git a/twilio/rest/insights/v1/room/__init__.py b/twilio/rest/insights/v1/room/__init__.py index 7361018e23..abcc9f8c5b 100644 --- a/twilio/rest/insights/v1/room/__init__.py +++ b/twilio/rest/insights/v1/room/__init__.py @@ -29,6 +29,7 @@ class Codec(object): VP8 = "VP8" H264 = "H264" VP9 = "VP9" + OPUS = "opus" class CreatedMethod(object): SDK = "sdk" @@ -75,6 +76,8 @@ class TwilioRealm(object): IN1 = "in1" DE1 = "de1" GLL = "gll" + STAGE_US1 = "stage_us1" + DEV_US1 = "dev_us1" """ :ivar account_sid: Account SID associated with this room. diff --git a/twilio/rest/insights/v1/room/participant.py b/twilio/rest/insights/v1/room/participant.py index 0f6617f549..6c2b8448cf 100644 --- a/twilio/rest/insights/v1/room/participant.py +++ b/twilio/rest/insights/v1/room/participant.py @@ -28,6 +28,7 @@ class Codec(object): VP8 = "VP8" H264 = "H264" VP9 = "VP9" + OPUS = "opus" class EdgeLocation(object): ASHBURN = "ashburn" @@ -55,6 +56,8 @@ class TwilioRealm(object): IN1 = "in1" DE1 = "de1" GLL = "gll" + STAGE_US1 = "stage_us1" + DEV_US1 = "dev_us1" """ :ivar participant_sid: Unique identifier for the participant. diff --git a/twilio/rest/numbers/v1/__init__.py b/twilio/rest/numbers/v1/__init__.py index 043364c3d5..68f078a88d 100644 --- a/twilio/rest/numbers/v1/__init__.py +++ b/twilio/rest/numbers/v1/__init__.py @@ -28,12 +28,10 @@ from twilio.rest.numbers.v1.porting_webhook_configuration_delete import ( PortingWebhookConfigurationDeleteList, ) -from twilio.rest.numbers.v1.porting_webhook_configuration_fetch import ( - PortingWebhookConfigurationFetchList, -) from twilio.rest.numbers.v1.signing_request_configuration import ( SigningRequestConfigurationList, ) +from twilio.rest.numbers.v1.webhook import WebhookList class V1(Version): @@ -58,12 +56,10 @@ def __init__(self, domain: Domain): self._porting_webhook_configurations_delete: Optional[ PortingWebhookConfigurationDeleteList ] = None - self._porting_webhook_configuration_fetch: Optional[ - PortingWebhookConfigurationFetchList - ] = None self._signing_request_configurations: Optional[ SigningRequestConfigurationList ] = None + self._webhook: Optional[WebhookList] = None @property def bulk_eligibilities(self) -> BulkEligibilityList: @@ -111,22 +107,18 @@ def porting_webhook_configurations_delete( ) return self._porting_webhook_configurations_delete - @property - def porting_webhook_configuration_fetch( - self, - ) -> PortingWebhookConfigurationFetchList: - if self._porting_webhook_configuration_fetch is None: - self._porting_webhook_configuration_fetch = ( - PortingWebhookConfigurationFetchList(self) - ) - return self._porting_webhook_configuration_fetch - @property def signing_request_configurations(self) -> SigningRequestConfigurationList: if self._signing_request_configurations is None: self._signing_request_configurations = SigningRequestConfigurationList(self) return self._signing_request_configurations + @property + def webhook(self) -> WebhookList: + if self._webhook is None: + self._webhook = WebhookList(self) + return self._webhook + def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py b/twilio/rest/numbers/v1/webhook.py similarity index 77% rename from twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py rename to twilio/rest/numbers/v1/webhook.py index 89b8064bdb..88ca64e9e1 100644 --- a/twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py +++ b/twilio/rest/numbers/v1/webhook.py @@ -21,7 +21,7 @@ from twilio.base.version import Version -class PortingWebhookConfigurationFetchInstance(InstanceResource): +class WebhookInstance(InstanceResource): """ :ivar url: The URL of the webhook configuration request :ivar port_in_target_url: The complete webhook url that will be called when a notification event for port in request or port in phone number happens @@ -52,14 +52,14 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" -class PortingWebhookConfigurationFetchList(ListResource): +class WebhookList(ListResource): def __init__(self, version: Version): """ - Initialize the PortingWebhookConfigurationFetchList + Initialize the WebhookList :param version: Version that contains the resource @@ -68,25 +68,25 @@ def __init__(self, version: Version): self._uri = "/Porting/Configuration/Webhook" - def fetch(self) -> PortingWebhookConfigurationFetchInstance: + def fetch(self) -> WebhookInstance: """ - Asynchronously fetch the PortingWebhookConfigurationFetchInstance + Asynchronously fetch the WebhookInstance - :returns: The fetched PortingWebhookConfigurationFetchInstance + :returns: The fetched WebhookInstance """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) - return PortingWebhookConfigurationFetchInstance(self._version, payload) + return WebhookInstance(self._version, payload) - async def fetch_async(self) -> PortingWebhookConfigurationFetchInstance: + async def fetch_async(self) -> WebhookInstance: """ - Asynchronously fetch the PortingWebhookConfigurationFetchInstance + Asynchronously fetch the WebhookInstance - :returns: The fetched PortingWebhookConfigurationFetchInstance + :returns: The fetched WebhookInstance """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -94,7 +94,7 @@ async def fetch_async(self) -> PortingWebhookConfigurationFetchInstance: method="GET", uri=self._uri, headers=headers ) - return PortingWebhookConfigurationFetchInstance(self._version, payload) + return WebhookInstance(self._version, payload) def __repr__(self) -> str: """ @@ -102,4 +102,4 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" From ce5ce5d68511b26d60bb4a0f79a0597fe8b1adeb Mon Sep 17 00:00:00 2001 From: Twilio Date: Fri, 15 Nov 2024 07:18:24 +0000 Subject: [PATCH 48/87] Release 9.3.7 --- setup.py | 2 +- twilio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index b769d7ff4a..f46054d7e7 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name="twilio", - version="9.3.6", + version="9.3.7", description="Twilio API client and TwiML generator", author="Twilio", help_center="https://www.twilio.com/help/contact", diff --git a/twilio/__init__.py b/twilio/__init__.py index 5fe186e287..86740d01f9 100644 --- a/twilio/__init__.py +++ b/twilio/__init__.py @@ -1,2 +1,2 @@ -__version_info__ = ("9", "3", "6") +__version_info__ = ("9", "3", "7") __version__ = ".".join(__version_info__) From bae3eca0fb53619a3796badd083406d04b907767 Mon Sep 17 00:00:00 2001 From: Twilio Date: Thu, 5 Dec 2024 10:12:33 +0000 Subject: [PATCH 49/87] [Librarian] Regenerated @ 45fa5159053e1c1f62f6d613f3b67a9239b43a5f 2551818144b7f525e66740ded45831b930db82b8 --- CHANGES.md | 16 ++ .../api/v2010/account/call/transcription.py | 6 + twilio/rest/numbers/v1/__init__.py | 24 +- ...=> porting_webhook_configuration_fetch.py} | 26 +- twilio/rest/numbers/v2/hosted_number_order.py | 140 +++++++++- twilio/twiml/voice_response.py | 251 ++++++++++++++++++ 6 files changed, 439 insertions(+), 24 deletions(-) rename twilio/rest/numbers/v1/{webhook.py => porting_webhook_configuration_fetch.py} (77%) diff --git a/CHANGES.md b/CHANGES.md index c879894ab3..aa224e00fd 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,22 @@ twilio-python Changelog Here you can see the full list of changes between each twilio-python release. +[2024-12-05] Version 9.3.8 +-------------------------- +**Api** +- Add optional parameter `intelligence_service` to `transcription` +- Updated `phone_number_sid` to be populated for sip trunking terminating calls. + +**Numbers** +- Add Update Hosted Number Order V2 API endpoint +- Update Port in docs + +**Twiml** +- Add optional parameter `intelligence_service` to `` +- Add support for new `` and `` noun +- Add `events` attribute to `` verb + + [2024-11-15] Version 9.3.7 -------------------------- **Library - Chore** diff --git a/twilio/rest/api/v2010/account/call/transcription.py b/twilio/rest/api/v2010/account/call/transcription.py index d4aa87e3df..c649b8ad1b 100644 --- a/twilio/rest/api/v2010/account/call/transcription.py +++ b/twilio/rest/api/v2010/account/call/transcription.py @@ -261,6 +261,7 @@ def create( speech_model: Union[str, object] = values.unset, hints: Union[str, object] = values.unset, enable_automatic_punctuation: Union[bool, object] = values.unset, + intelligence_service: Union[str, object] = values.unset, ) -> TranscriptionInstance: """ Create the TranscriptionInstance @@ -278,6 +279,7 @@ def create( :param speech_model: Recognition model used by the transcription engine, among those supported by the provider :param hints: A Phrase contains words and phrase \\\"hints\\\" so that the speech recognition engine is more likely to recognize them. :param enable_automatic_punctuation: The provider will add punctuation to recognition result + :param intelligence_service: The SID or the unique name of the [IntelligentService](https://www.twilio.com/docs/voice/intelligence/api/service-resource) to process the transcription. :returns: The created TranscriptionInstance """ @@ -299,6 +301,7 @@ def create( "EnableAutomaticPunctuation": serialize.boolean_to_string( enable_automatic_punctuation ), + "IntelligenceService": intelligence_service, } ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -329,6 +332,7 @@ async def create_async( speech_model: Union[str, object] = values.unset, hints: Union[str, object] = values.unset, enable_automatic_punctuation: Union[bool, object] = values.unset, + intelligence_service: Union[str, object] = values.unset, ) -> TranscriptionInstance: """ Asynchronously create the TranscriptionInstance @@ -346,6 +350,7 @@ async def create_async( :param speech_model: Recognition model used by the transcription engine, among those supported by the provider :param hints: A Phrase contains words and phrase \\\"hints\\\" so that the speech recognition engine is more likely to recognize them. :param enable_automatic_punctuation: The provider will add punctuation to recognition result + :param intelligence_service: The SID or the unique name of the [IntelligentService](https://www.twilio.com/docs/voice/intelligence/api/service-resource) to process the transcription. :returns: The created TranscriptionInstance """ @@ -367,6 +372,7 @@ async def create_async( "EnableAutomaticPunctuation": serialize.boolean_to_string( enable_automatic_punctuation ), + "IntelligenceService": intelligence_service, } ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) diff --git a/twilio/rest/numbers/v1/__init__.py b/twilio/rest/numbers/v1/__init__.py index 68f078a88d..043364c3d5 100644 --- a/twilio/rest/numbers/v1/__init__.py +++ b/twilio/rest/numbers/v1/__init__.py @@ -28,10 +28,12 @@ from twilio.rest.numbers.v1.porting_webhook_configuration_delete import ( PortingWebhookConfigurationDeleteList, ) +from twilio.rest.numbers.v1.porting_webhook_configuration_fetch import ( + PortingWebhookConfigurationFetchList, +) from twilio.rest.numbers.v1.signing_request_configuration import ( SigningRequestConfigurationList, ) -from twilio.rest.numbers.v1.webhook import WebhookList class V1(Version): @@ -56,10 +58,12 @@ def __init__(self, domain: Domain): self._porting_webhook_configurations_delete: Optional[ PortingWebhookConfigurationDeleteList ] = None + self._porting_webhook_configuration_fetch: Optional[ + PortingWebhookConfigurationFetchList + ] = None self._signing_request_configurations: Optional[ SigningRequestConfigurationList ] = None - self._webhook: Optional[WebhookList] = None @property def bulk_eligibilities(self) -> BulkEligibilityList: @@ -107,18 +111,22 @@ def porting_webhook_configurations_delete( ) return self._porting_webhook_configurations_delete + @property + def porting_webhook_configuration_fetch( + self, + ) -> PortingWebhookConfigurationFetchList: + if self._porting_webhook_configuration_fetch is None: + self._porting_webhook_configuration_fetch = ( + PortingWebhookConfigurationFetchList(self) + ) + return self._porting_webhook_configuration_fetch + @property def signing_request_configurations(self) -> SigningRequestConfigurationList: if self._signing_request_configurations is None: self._signing_request_configurations = SigningRequestConfigurationList(self) return self._signing_request_configurations - @property - def webhook(self) -> WebhookList: - if self._webhook is None: - self._webhook = WebhookList(self) - return self._webhook - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/numbers/v1/webhook.py b/twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py similarity index 77% rename from twilio/rest/numbers/v1/webhook.py rename to twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py index 88ca64e9e1..89b8064bdb 100644 --- a/twilio/rest/numbers/v1/webhook.py +++ b/twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py @@ -21,7 +21,7 @@ from twilio.base.version import Version -class WebhookInstance(InstanceResource): +class PortingWebhookConfigurationFetchInstance(InstanceResource): """ :ivar url: The URL of the webhook configuration request :ivar port_in_target_url: The complete webhook url that will be called when a notification event for port in request or port in phone number happens @@ -52,14 +52,14 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" -class WebhookList(ListResource): +class PortingWebhookConfigurationFetchList(ListResource): def __init__(self, version: Version): """ - Initialize the WebhookList + Initialize the PortingWebhookConfigurationFetchList :param version: Version that contains the resource @@ -68,25 +68,25 @@ def __init__(self, version: Version): self._uri = "/Porting/Configuration/Webhook" - def fetch(self) -> WebhookInstance: + def fetch(self) -> PortingWebhookConfigurationFetchInstance: """ - Asynchronously fetch the WebhookInstance + Asynchronously fetch the PortingWebhookConfigurationFetchInstance - :returns: The fetched WebhookInstance + :returns: The fetched PortingWebhookConfigurationFetchInstance """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) - return WebhookInstance(self._version, payload) + return PortingWebhookConfigurationFetchInstance(self._version, payload) - async def fetch_async(self) -> WebhookInstance: + async def fetch_async(self) -> PortingWebhookConfigurationFetchInstance: """ - Asynchronously fetch the WebhookInstance + Asynchronously fetch the PortingWebhookConfigurationFetchInstance - :returns: The fetched WebhookInstance + :returns: The fetched PortingWebhookConfigurationFetchInstance """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -94,7 +94,7 @@ async def fetch_async(self) -> WebhookInstance: method="GET", uri=self._uri, headers=headers ) - return WebhookInstance(self._version, payload) + return PortingWebhookConfigurationFetchInstance(self._version, payload) def __repr__(self) -> str: """ @@ -102,4 +102,4 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" diff --git a/twilio/rest/numbers/v2/hosted_number_order.py b/twilio/rest/numbers/v2/hosted_number_order.py index b2660cfc30..0fab0fe34a 100644 --- a/twilio/rest/numbers/v2/hosted_number_order.py +++ b/twilio/rest/numbers/v2/hosted_number_order.py @@ -26,6 +26,7 @@ class HostedNumberOrderInstance(InstanceResource): class Status(object): RECEIVED = "received" + PENDING_VERIFICATION = "pending-verification" VERIFIED = "verified" PENDING_LOA = "pending-loa" CARRIER_PROCESSING = "carrier-processing" @@ -33,6 +34,9 @@ class Status(object): FAILED = "failed" ACTION_REQUIRED = "action-required" + class VerificationType(object): + PHONE_CALL = "phone-call" + """ :ivar sid: A 34 character string that uniquely identifies this HostedNumberOrder. :ivar account_sid: A 34 character string that uniquely identifies the account. @@ -53,6 +57,12 @@ class Status(object): :ivar contact_phone_number: The contact phone number of the person authorized to sign the Authorization Document. :ivar bulk_hosting_request_sid: A 34 character string that uniquely identifies the bulk hosting request associated with this HostedNumberOrder. :ivar next_step: The next step you need to take to complete the hosted number order and request it successfully. + :ivar verification_attempts: The number of attempts made to verify ownership via a call for the hosted phone number. + :ivar verification_call_sids: The Call SIDs that identify the calls placed to verify ownership. + :ivar verification_call_delay: The number of seconds to wait before initiating the ownership verification call. Can be a value between 0 and 60, inclusive. + :ivar verification_call_extension: The numerical extension to dial when making the ownership verification call. + :ivar verification_code: The digits the user must pass in the ownership verification call. + :ivar verification_type: """ def __init__( @@ -89,6 +99,22 @@ def __init__( "bulk_hosting_request_sid" ) self.next_step: Optional[str] = payload.get("next_step") + self.verification_attempts: Optional[int] = deserialize.integer( + payload.get("verification_attempts") + ) + self.verification_call_sids: Optional[List[str]] = payload.get( + "verification_call_sids" + ) + self.verification_call_delay: Optional[int] = deserialize.integer( + payload.get("verification_call_delay") + ) + self.verification_call_extension: Optional[str] = payload.get( + "verification_call_extension" + ) + self.verification_code: Optional[str] = payload.get("verification_code") + self.verification_type: Optional[ + "HostedNumberOrderInstance.VerificationType" + ] = payload.get("verification_type") self._solution = { "sid": sid or self.sid, @@ -146,6 +172,48 @@ async def fetch_async(self) -> "HostedNumberOrderInstance": """ return await self._proxy.fetch_async() + def update( + self, + status: "HostedNumberOrderInstance.Status", + verification_call_delay: Union[int, object] = values.unset, + verification_call_extension: Union[str, object] = values.unset, + ) -> "HostedNumberOrderInstance": + """ + Update the HostedNumberOrderInstance + + :param status: + :param verification_call_delay: The number of seconds to wait before initiating the ownership verification call. Can be a value between 0 and 60, inclusive. + :param verification_call_extension: The numerical extension to dial when making the ownership verification call. + + :returns: The updated HostedNumberOrderInstance + """ + return self._proxy.update( + status=status, + verification_call_delay=verification_call_delay, + verification_call_extension=verification_call_extension, + ) + + async def update_async( + self, + status: "HostedNumberOrderInstance.Status", + verification_call_delay: Union[int, object] = values.unset, + verification_call_extension: Union[str, object] = values.unset, + ) -> "HostedNumberOrderInstance": + """ + Asynchronous coroutine to update the HostedNumberOrderInstance + + :param status: + :param verification_call_delay: The number of seconds to wait before initiating the ownership verification call. Can be a value between 0 and 60, inclusive. + :param verification_call_extension: The numerical extension to dial when making the ownership verification call. + + :returns: The updated HostedNumberOrderInstance + """ + return await self._proxy.update_async( + status=status, + verification_call_delay=verification_call_delay, + verification_call_extension=verification_call_extension, + ) + def __repr__(self) -> str: """ Provide a friendly representation @@ -163,7 +231,7 @@ def __init__(self, version: Version, sid: str): Initialize the HostedNumberOrderContext :param version: Version that contains the resource - :param sid: A 34 character string that uniquely identifies this HostedNumberOrder. + :param sid: The SID of the HostedNumberOrder resource to update. """ super().__init__(version) @@ -235,6 +303,72 @@ async def fetch_async(self) -> HostedNumberOrderInstance: sid=self._solution["sid"], ) + def update( + self, + status: "HostedNumberOrderInstance.Status", + verification_call_delay: Union[int, object] = values.unset, + verification_call_extension: Union[str, object] = values.unset, + ) -> HostedNumberOrderInstance: + """ + Update the HostedNumberOrderInstance + + :param status: + :param verification_call_delay: The number of seconds to wait before initiating the ownership verification call. Can be a value between 0 and 60, inclusive. + :param verification_call_extension: The numerical extension to dial when making the ownership verification call. + + :returns: The updated HostedNumberOrderInstance + """ + data = values.of( + { + "Status": status, + "VerificationCallDelay": verification_call_delay, + "VerificationCallExtension": verification_call_extension, + } + ) + + payload = self._version.update( + method="POST", + uri=self._uri, + data=data, + ) + + return HostedNumberOrderInstance( + self._version, payload, sid=self._solution["sid"] + ) + + async def update_async( + self, + status: "HostedNumberOrderInstance.Status", + verification_call_delay: Union[int, object] = values.unset, + verification_call_extension: Union[str, object] = values.unset, + ) -> HostedNumberOrderInstance: + """ + Asynchronous coroutine to update the HostedNumberOrderInstance + + :param status: + :param verification_call_delay: The number of seconds to wait before initiating the ownership verification call. Can be a value between 0 and 60, inclusive. + :param verification_call_extension: The numerical extension to dial when making the ownership verification call. + + :returns: The updated HostedNumberOrderInstance + """ + data = values.of( + { + "Status": status, + "VerificationCallDelay": verification_call_delay, + "VerificationCallExtension": verification_call_extension, + } + ) + + payload = await self._version.update_async( + method="POST", + uri=self._uri, + data=data, + ) + + return HostedNumberOrderInstance( + self._version, payload, sid=self._solution["sid"] + ) + def __repr__(self) -> str: """ Provide a friendly representation @@ -698,7 +832,7 @@ def get(self, sid: str) -> HostedNumberOrderContext: """ Constructs a HostedNumberOrderContext - :param sid: A 34 character string that uniquely identifies this HostedNumberOrder. + :param sid: The SID of the HostedNumberOrder resource to update. """ return HostedNumberOrderContext(self._version, sid=sid) @@ -706,7 +840,7 @@ def __call__(self, sid: str) -> HostedNumberOrderContext: """ Constructs a HostedNumberOrderContext - :param sid: A 34 character string that uniquely identifies this HostedNumberOrder. + :param sid: The SID of the HostedNumberOrder resource to update. """ return HostedNumberOrderContext(self._version, sid=sid) diff --git a/twilio/twiml/voice_response.py b/twilio/twiml/voice_response.py index c6d453e143..6f3d17e92c 100644 --- a/twilio/twiml/voice_response.py +++ b/twilio/twiml/voice_response.py @@ -50,6 +50,7 @@ def dial( sequential=None, refer_url=None, refer_method=None, + events=None, **kwargs ): """ @@ -73,6 +74,7 @@ def dial( :param sequential: Used to determine if child TwiML nouns should be dialed in order, one after the other (sequential) or dial all at once (parallel). Default is false, parallel :param refer_url: Webhook that will receive future SIP REFER requests :param refer_method: The HTTP method to use for the refer Webhook + :param events: Subscription to events :param kwargs: additional attributes :returns: element @@ -97,6 +99,7 @@ def dial( sequential=sequential, refer_url=refer_url, refer_method=refer_method, + events=events, **kwargs ) ) @@ -678,6 +681,7 @@ def transcription( speech_model=None, hints=None, enable_automatic_punctuation=None, + intelligence_service=None, **kwargs ): """ @@ -696,6 +700,7 @@ def transcription( :param speech_model: Speech Model used by the transcription engine :param hints: Hints to be provided to the transcription engine :param enable_automatic_punctuation: Enable Automatic Punctuation + :param intelligence_service: The SID or the unique name of the Intelligence Service to be used :param kwargs: additional attributes :returns: element @@ -715,6 +720,7 @@ def transcription( speech_model=speech_model, hints=hints, enable_automatic_punctuation=enable_automatic_punctuation, + intelligence_service=intelligence_service, **kwargs ) ) @@ -897,6 +903,7 @@ def transcription( speech_model=None, hints=None, enable_automatic_punctuation=None, + intelligence_service=None, **kwargs ): """ @@ -915,6 +922,7 @@ def transcription( :param speech_model: Speech Model used by the transcription engine :param hints: Hints to be provided to the transcription engine :param enable_automatic_punctuation: Enable Automatic Punctuation + :param intelligence_service: The SID or the unique name of the Intelligence Service to be used :param kwargs: additional attributes :returns: element @@ -934,6 +942,7 @@ def transcription( speech_model=speech_model, hints=hints, enable_automatic_punctuation=enable_automatic_punctuation, + intelligence_service=intelligence_service, **kwargs ) ) @@ -2725,6 +2734,248 @@ def conversation( ) ) + def conversation_relay( + self, + url=None, + language=None, + tts_language=None, + transcription_language=None, + tts_provider=None, + voice=None, + transcription_provider=None, + speech_model=None, + profanity_filter=None, + dtmf_detection=None, + welcome_greeting=None, + partial_prompts=None, + interruptible=None, + interrupt_by_dtmf=None, + welcome_greeting_interruptible=None, + debug=None, + **kwargs + ): + """ + Create a element + + :param url: URL of the remote service where the session is connected to + :param language: Language to be used for both text-to-speech and transcription + :param tts_language: Language to be used for text-to-speech + :param transcription_language: Language to be used for transcription + :param tts_provider: Provider to be used for text-to-speech + :param voice: Voice to be used for text-to-speech + :param transcription_provider: Provider to be used for transcription + :param speech_model: Speech model to be used for transcription + :param profanity_filter: Whether profanities should be filtered out of the speech transcription + :param dtmf_detection: Whether DTMF tones should be detected and reported in speech transcription + :param welcome_greeting: The sentence to be played automatically when the session is connected + :param partial_prompts: Whether partial prompts should be reported to WebSocket server before the caller finishes speaking + :param interruptible: Whether caller's speaking can interrupt the play of text-to-speech + :param interrupt_by_dtmf: Whether DTMF tone can interrupt the play of text-to-speech + :param welcome_greeting_interruptible: Whether caller's speaking can interrupt the welcome greeting + :param debug: Whether debugging on the session is enabled + :param kwargs: additional attributes + + :returns: element + """ + return self.nest( + ConversationRelay( + url=url, + language=language, + tts_language=tts_language, + transcription_language=transcription_language, + tts_provider=tts_provider, + voice=voice, + transcription_provider=transcription_provider, + speech_model=speech_model, + profanity_filter=profanity_filter, + dtmf_detection=dtmf_detection, + welcome_greeting=welcome_greeting, + partial_prompts=partial_prompts, + interruptible=interruptible, + interrupt_by_dtmf=interrupt_by_dtmf, + welcome_greeting_interruptible=welcome_greeting_interruptible, + debug=debug, + **kwargs + ) + ) + + def assistant( + self, + id=None, + language=None, + tts_language=None, + transcription_language=None, + tts_provider=None, + voice=None, + transcription_provider=None, + speech_model=None, + profanity_filter=None, + dtmf_detection=None, + welcome_greeting=None, + partial_prompts=None, + interruptible=None, + interrupt_by_dtmf=None, + welcome_greeting_interruptible=None, + debug=None, + **kwargs + ): + """ + Create a element + + :param id: The assistant ID of the AI Assistant + :param language: Language to be used for both text-to-speech and transcription + :param tts_language: Language to be used for text-to-speech + :param transcription_language: Language to be used for transcription + :param tts_provider: Provider to be used for text-to-speech + :param voice: Voice to be used for text-to-speech + :param transcription_provider: Provider to be used for transcription + :param speech_model: Speech model to be used for transcription + :param profanity_filter: Whether profanities should be filtered out of the speech transcription + :param dtmf_detection: Whether DTMF tones should be detected and reported in speech transcription + :param welcome_greeting: The sentence to be played automatically when the session is connected + :param partial_prompts: Whether partial prompts should be reported to WebSocket server before the caller finishes speaking + :param interruptible: Whether caller's speaking can interrupt the play of text-to-speech + :param interrupt_by_dtmf: Whether DTMF tone can interrupt the play of text-to-speech + :param welcome_greeting_interruptible: Whether caller's speaking can interrupt the welcome greeting + :param debug: Whether debugging on the session is enabled + :param kwargs: additional attributes + + :returns: element + """ + return self.nest( + Assistant( + id=id, + language=language, + tts_language=tts_language, + transcription_language=transcription_language, + tts_provider=tts_provider, + voice=voice, + transcription_provider=transcription_provider, + speech_model=speech_model, + profanity_filter=profanity_filter, + dtmf_detection=dtmf_detection, + welcome_greeting=welcome_greeting, + partial_prompts=partial_prompts, + interruptible=interruptible, + interrupt_by_dtmf=interrupt_by_dtmf, + welcome_greeting_interruptible=welcome_greeting_interruptible, + debug=debug, + **kwargs + ) + ) + + +class Assistant(TwiML): + """ TwiML Noun""" + + def __init__(self, **kwargs): + super(Assistant, self).__init__(**kwargs) + self.name = "Assistant" + + def language( + self, + code=None, + tts_provider=None, + voice=None, + transcription_provider=None, + speech_model=None, + **kwargs + ): + """ + Create a element + + :param code: Language code of this language setting is for + :param tts_provider: Provider to be used for text-to-speech of this language + :param voice: Voice to be used for text-to-speech of this language + :param transcription_provider: Provider to be used for transcription of this language + :param speech_model: Speech model to be used for transcription of this language + :param kwargs: additional attributes + + :returns: element + """ + return self.nest( + Language( + code=code, + tts_provider=tts_provider, + voice=voice, + transcription_provider=transcription_provider, + speech_model=speech_model, + **kwargs + ) + ) + + def parameter(self, name=None, value=None, **kwargs): + """ + Create a element + + :param name: The name of the custom parameter + :param value: The value of the custom parameter + :param kwargs: additional attributes + + :returns: element + """ + return self.nest(Parameter(name=name, value=value, **kwargs)) + + +class Language(TwiML): + """ TwiML Noun""" + + def __init__(self, **kwargs): + super(Language, self).__init__(**kwargs) + self.name = "Language" + + +class ConversationRelay(TwiML): + """ TwiML Noun""" + + def __init__(self, **kwargs): + super(ConversationRelay, self).__init__(**kwargs) + self.name = "ConversationRelay" + + def language( + self, + code=None, + tts_provider=None, + voice=None, + transcription_provider=None, + speech_model=None, + **kwargs + ): + """ + Create a element + + :param code: Language code of this language setting is for + :param tts_provider: Provider to be used for text-to-speech of this language + :param voice: Voice to be used for text-to-speech of this language + :param transcription_provider: Provider to be used for transcription of this language + :param speech_model: Speech model to be used for transcription of this language + :param kwargs: additional attributes + + :returns: element + """ + return self.nest( + Language( + code=code, + tts_provider=tts_provider, + voice=voice, + transcription_provider=transcription_provider, + speech_model=speech_model, + **kwargs + ) + ) + + def parameter(self, name=None, value=None, **kwargs): + """ + Create a element + + :param name: The name of the custom parameter + :param value: The value of the custom parameter + :param kwargs: additional attributes + + :returns: element + """ + return self.nest(Parameter(name=name, value=value, **kwargs)) + class Conversation(TwiML): """ TwiML Noun""" From fb5388940759d6e7db9cbfcd05b2cd91d883bff6 Mon Sep 17 00:00:00 2001 From: Twilio Date: Thu, 5 Dec 2024 10:17:17 +0000 Subject: [PATCH 50/87] Release 9.3.8 --- setup.py | 2 +- twilio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index f46054d7e7..016e3b95ca 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name="twilio", - version="9.3.7", + version="9.3.8", description="Twilio API client and TwiML generator", author="Twilio", help_center="https://www.twilio.com/help/contact", diff --git a/twilio/__init__.py b/twilio/__init__.py index 86740d01f9..a574bfeb0c 100644 --- a/twilio/__init__.py +++ b/twilio/__init__.py @@ -1,2 +1,2 @@ -__version_info__ = ("9", "3", "7") +__version_info__ = ("9", "3", "8") __version__ = ".".join(__version_info__) From 6e78c789cfa31d79e5f2108e8e4a9bddf12decc2 Mon Sep 17 00:00:00 2001 From: Athira Sabu <102021496+AsabuHere@users.noreply.github.com> Date: Thu, 12 Dec 2024 14:05:37 +0530 Subject: [PATCH 51/87] feat: Organizations Api uptake for twilio-python (#815) * feat: oauth sdk implementation and organization api uptake (#799) --- twilio/auth_strategy/__init__.py | 0 twilio/auth_strategy/auth_strategy.py | 19 + twilio/auth_strategy/auth_type.py | 12 + twilio/auth_strategy/no_auth_strategy.py | 13 + twilio/auth_strategy/token_auth_strategy.py | 53 + twilio/base/client_base.py | 57 +- twilio/base/page.py | 2 + twilio/base/version.py | 3 - twilio/credential/__init__.py | 0 twilio/credential/credential_provider.py | 13 + twilio/credential/orgs_credential_provider.py | 28 + twilio/http/http_client.py | 6 +- twilio/http/orgs_token_manager.py | 41 + twilio/http/token_manager.py | 7 + twilio/rest/__init__.py | 17 + twilio/rest/preview_iam/PreviewIamBase.py | 47 + twilio/rest/preview_iam/__init__.py | 25 + twilio/rest/preview_iam/v1/__init__.py | 51 + twilio/rest/preview_iam/v1/authorize.py | 126 ++ twilio/rest/preview_iam/v1/token.py | 162 +++ .../rest/preview_iam/versionless/__init__.py | 43 + .../versionless/organization/__init__.py | 128 ++ .../versionless/organization/account.py | 438 +++++++ .../organization/role_assignment.py | 574 +++++++++ .../versionless/organization/user.py | 1050 +++++++++++++++++ 25 files changed, 2899 insertions(+), 16 deletions(-) create mode 100644 twilio/auth_strategy/__init__.py create mode 100644 twilio/auth_strategy/auth_strategy.py create mode 100644 twilio/auth_strategy/auth_type.py create mode 100644 twilio/auth_strategy/no_auth_strategy.py create mode 100644 twilio/auth_strategy/token_auth_strategy.py create mode 100644 twilio/credential/__init__.py create mode 100644 twilio/credential/credential_provider.py create mode 100644 twilio/credential/orgs_credential_provider.py create mode 100644 twilio/http/orgs_token_manager.py create mode 100644 twilio/http/token_manager.py create mode 100644 twilio/rest/preview_iam/PreviewIamBase.py create mode 100644 twilio/rest/preview_iam/__init__.py create mode 100644 twilio/rest/preview_iam/v1/__init__.py create mode 100644 twilio/rest/preview_iam/v1/authorize.py create mode 100644 twilio/rest/preview_iam/v1/token.py create mode 100644 twilio/rest/preview_iam/versionless/__init__.py create mode 100644 twilio/rest/preview_iam/versionless/organization/__init__.py create mode 100644 twilio/rest/preview_iam/versionless/organization/account.py create mode 100644 twilio/rest/preview_iam/versionless/organization/role_assignment.py create mode 100644 twilio/rest/preview_iam/versionless/organization/user.py diff --git a/twilio/auth_strategy/__init__.py b/twilio/auth_strategy/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/twilio/auth_strategy/auth_strategy.py b/twilio/auth_strategy/auth_strategy.py new file mode 100644 index 0000000000..223cbff08f --- /dev/null +++ b/twilio/auth_strategy/auth_strategy.py @@ -0,0 +1,19 @@ +from twilio.auth_strategy.auth_type import AuthType +from abc import abstractmethod + + +class AuthStrategy(object): + def __init__(self, auth_type: AuthType): + self._auth_type = auth_type + + @property + def auth_type(self) -> AuthType: + return self._auth_type + + @abstractmethod + def get_auth_string(self) -> str: + """Return the authentication string.""" + + @abstractmethod + def requires_authentication(self) -> bool: + """Return True if authentication is required, else False.""" diff --git a/twilio/auth_strategy/auth_type.py b/twilio/auth_strategy/auth_type.py new file mode 100644 index 0000000000..61886f925d --- /dev/null +++ b/twilio/auth_strategy/auth_type.py @@ -0,0 +1,12 @@ +from enum import Enum + + +class AuthType(Enum): + ORGS_TOKEN = "orgs_stoken" + NO_AUTH = "noauth" + BASIC = "basic" + API_KEY = "api_key" + CLIENT_CREDENTIALS = "client_credentials" + + def __str__(self): + return self.value diff --git a/twilio/auth_strategy/no_auth_strategy.py b/twilio/auth_strategy/no_auth_strategy.py new file mode 100644 index 0000000000..a5bfd6d27f --- /dev/null +++ b/twilio/auth_strategy/no_auth_strategy.py @@ -0,0 +1,13 @@ +from auth_type import AuthType +from twilio.auth_strategy.auth_strategy import AuthStrategy + + +class NoAuthStrategy(AuthStrategy): + def __init__(self): + super().__init__(AuthType.NO_AUTH) + + def get_auth_string(self) -> str: + return "" + + def requires_authentication(self) -> bool: + return False diff --git a/twilio/auth_strategy/token_auth_strategy.py b/twilio/auth_strategy/token_auth_strategy.py new file mode 100644 index 0000000000..ee51f05a43 --- /dev/null +++ b/twilio/auth_strategy/token_auth_strategy.py @@ -0,0 +1,53 @@ +import jwt +import threading +import logging +from datetime import datetime + +from twilio.auth_strategy.auth_type import AuthType +from twilio.auth_strategy.auth_strategy import AuthStrategy +from twilio.http.token_manager import TokenManager + + +class TokenAuthStrategy(AuthStrategy): + def __init__(self, token_manager: TokenManager): + super().__init__(AuthType.ORGS_TOKEN) + self.token_manager = token_manager + self.token = None + self.lock = threading.Lock() + logging.basicConfig(level=logging.INFO) + self.logger = logging.getLogger(__name__) + + def get_auth_string(self) -> str: + self.fetch_token() + return f"Bearer {self.token}" + + def requires_authentication(self) -> bool: + return True + + def fetch_token(self): + if self.token is None or self.token == "" or self.is_token_expired(self.token): + with self.lock: + if ( + self.token is None + or self.token == "" + or self.is_token_expired(self.token) + ): + self.logger.info("New token fetched for accessing organization API") + self.token = self.token_manager.fetch_access_token() + + def is_token_expired(self, token): + try: + decoded = jwt.decode(token, options={"verify_signature": False}) + exp = decoded.get("exp") + + if exp is None: + return True # No expiration time present, consider it expired + + # Check if the expiration time has passed + return datetime.fromtimestamp(exp) < datetime.utcnow() + + except jwt.DecodeError: + return True # Token is invalid + except Exception as e: + print(f"An error occurred: {e}") + return True diff --git a/twilio/base/client_base.py b/twilio/base/client_base.py index 5f17c75406..b16f85bf5b 100644 --- a/twilio/base/client_base.py +++ b/twilio/base/client_base.py @@ -4,10 +4,10 @@ from urllib.parse import urlparse, urlunparse from twilio import __version__ -from twilio.base.exceptions import TwilioException from twilio.http import HttpClient from twilio.http.http_client import TwilioHttpClient from twilio.http.response import Response +from twilio.credential.credential_provider import CredentialProvider class ClientBase(object): @@ -23,6 +23,7 @@ def __init__( environment: Optional[MutableMapping[str, str]] = None, edge: Optional[str] = None, user_agent_extensions: Optional[List[str]] = None, + credential_provider: Optional[CredentialProvider] = None, ): """ Initializes the Twilio Client @@ -35,7 +36,9 @@ def __init__( :param environment: Environment to look for auth details, defaults to os.environ :param edge: Twilio Edge to make requests to, defaults to None :param user_agent_extensions: Additions to the user agent string + :param credential_provider: credential provider for authentication method that needs to be used """ + environment = environment or os.environ self.username = username or environment.get("TWILIO_ACCOUNT_SID") @@ -48,9 +51,8 @@ def __init__( """ :type : str """ self.user_agent_extensions = user_agent_extensions or [] """ :type : list[str] """ - - if not self.username or not self.password: - raise TwilioException("Credentials are required to create a TwilioClient") + self.credential_provider = credential_provider or None + """ :type : CredentialProvider """ self.account_sid = account_sid or self.username """ :type : str """ @@ -85,15 +87,27 @@ def request( :returns: Response from the Twilio API """ - auth = self.get_auth(auth) headers = self.get_headers(method, headers) - uri = self.get_hostname(uri) + if self.credential_provider: + + auth_strategy = self.credential_provider.to_auth_strategy() + headers["Authorization"] = auth_strategy.get_auth_string() + elif self.username is not None and self.password is not None: + auth = self.get_auth(auth) + else: + auth = None + + if method == "DELETE": + del headers["Accept"] + + uri = self.get_hostname(uri) + filtered_data = self.copy_non_none_values(data) return self.http_client.request( method, uri, params=params, - data=data, + data=filtered_data, headers=headers, auth=auth, timeout=timeout, @@ -132,21 +146,44 @@ async def request_async( "http_client must be asynchronous to support async API requests" ) - auth = self.get_auth(auth) headers = self.get_headers(method, headers) - uri = self.get_hostname(uri) + if method == "DELETE": + del headers["Accept"] + + if self.credential_provider: + auth_strategy = self.credential_provider.to_auth_strategy() + headers["Authorization"] = auth_strategy.get_auth_string() + elif self.username is not None and self.password is not None: + auth = self.get_auth(auth) + else: + auth = None + uri = self.get_hostname(uri) + filtered_data = self.copy_non_none_values(data) return await self.http_client.request( method, uri, params=params, - data=data, + data=filtered_data, headers=headers, auth=auth, timeout=timeout, allow_redirects=allow_redirects, ) + def copy_non_none_values(self, data): + if isinstance(data, dict): + return { + k: self.copy_non_none_values(v) + for k, v in data.items() + if v is not None + } + elif isinstance(data, list): + return [ + self.copy_non_none_values(item) for item in data if item is not None + ] + return data + def get_auth(self, auth: Optional[Tuple[str, str]]) -> Tuple[str, str]: """ Get the request authentication object diff --git a/twilio/base/page.py b/twilio/base/page.py index 2238528da9..b5b2da7b26 100644 --- a/twilio/base/page.py +++ b/twilio/base/page.py @@ -77,6 +77,8 @@ def load_page(self, payload: Dict[str, Any]): key = keys - self.META_KEYS if len(key) == 1: return payload[key.pop()] + if "Resources" in payload: + return payload["Resources"] raise TwilioException("Page Records can not be deserialized") diff --git a/twilio/base/version.py b/twilio/base/version.py index 64cc601faa..ed7e86f499 100644 --- a/twilio/base/version.py +++ b/twilio/base/version.py @@ -164,7 +164,6 @@ async def fetch_async( timeout=timeout, allow_redirects=allow_redirects, ) - return self._parse_fetch(method, uri, response) def _parse_update(self, method: str, uri: str, response: Response) -> Any: @@ -461,7 +460,6 @@ def create( timeout=timeout, allow_redirects=allow_redirects, ) - return self._parse_create(method, uri, response) async def create_async( @@ -488,5 +486,4 @@ async def create_async( timeout=timeout, allow_redirects=allow_redirects, ) - return self._parse_create(method, uri, response) diff --git a/twilio/credential/__init__.py b/twilio/credential/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/twilio/credential/credential_provider.py b/twilio/credential/credential_provider.py new file mode 100644 index 0000000000..72aafeed47 --- /dev/null +++ b/twilio/credential/credential_provider.py @@ -0,0 +1,13 @@ +from twilio.auth_strategy.auth_type import AuthType + + +class CredentialProvider: + def __init__(self, auth_type: AuthType): + self._auth_type = auth_type + + @property + def auth_type(self) -> AuthType: + return self._auth_type + + def to_auth_strategy(self): + raise NotImplementedError("Subclasses must implement this method") diff --git a/twilio/credential/orgs_credential_provider.py b/twilio/credential/orgs_credential_provider.py new file mode 100644 index 0000000000..e623f52322 --- /dev/null +++ b/twilio/credential/orgs_credential_provider.py @@ -0,0 +1,28 @@ +from twilio.http.orgs_token_manager import OrgTokenManager +from twilio.base.exceptions import TwilioException +from twilio.credential.credential_provider import CredentialProvider +from twilio.auth_strategy.auth_type import AuthType +from twilio.auth_strategy.token_auth_strategy import TokenAuthStrategy + + +class OrgsCredentialProvider(CredentialProvider): + def __init__(self, client_id: str, client_secret: str, token_manager=None): + super().__init__(AuthType.CLIENT_CREDENTIALS) + + if client_id is None or client_secret is None: + raise TwilioException("Client id and Client secret are mandatory") + + self.grant_type = "client_credentials" + self.client_id = client_id + self.client_secret = client_secret + self.token_manager = token_manager + self.auth_strategy = None + + def to_auth_strategy(self): + if self.token_manager is None: + self.token_manager = OrgTokenManager( + self.grant_type, self.client_id, self.client_secret + ) + if self.auth_strategy is None: + self.auth_strategy = TokenAuthStrategy(self.token_manager) + return self.auth_strategy diff --git a/twilio/http/http_client.py b/twilio/http/http_client.py index 9d329c6aa7..e15be86354 100644 --- a/twilio/http/http_client.py +++ b/twilio/http/http_client.py @@ -88,10 +88,11 @@ def request( } if headers and headers.get("Content-Type") == "application/json": kwargs["json"] = data + elif headers and headers.get("Content-Type") == "application/scim+json": + kwargs["json"] = data else: kwargs["data"] = data self.log_request(kwargs) - self._test_only_last_response = None session = self.session or Session() request = Request(**kwargs) @@ -102,12 +103,11 @@ def request( settings = session.merge_environment_settings( prepped_request.url, self.proxy, None, None, None ) - response = session.send( prepped_request, allow_redirects=allow_redirects, timeout=timeout, - **settings + **settings, ) self.log_response(response.status_code, response) diff --git a/twilio/http/orgs_token_manager.py b/twilio/http/orgs_token_manager.py new file mode 100644 index 0000000000..767ed270af --- /dev/null +++ b/twilio/http/orgs_token_manager.py @@ -0,0 +1,41 @@ +from twilio.http.token_manager import TokenManager +from twilio.rest import Client + + +class OrgTokenManager(TokenManager): + """ + Orgs Token Manager + """ + + def __init__( + self, + grant_type: str, + client_id: str, + client_secret: str, + code: str = None, + redirect_uri: str = None, + audience: str = None, + refreshToken: str = None, + scope: str = None, + ): + self.grant_type = grant_type + self.client_id = client_id + self.client_secret = client_secret + self.code = code + self.redirect_uri = redirect_uri + self.audience = audience + self.refreshToken = refreshToken + self.scope = scope + self.client = Client() + + def fetch_access_token(self): + token_instance = self.client.preview_iam.v1.token.create( + grant_type=self.grant_type, + client_id=self.client_id, + client_secret=self.client_secret, + code=self.code, + redirect_uri=self.redirect_uri, + audience=self.audience, + scope=self.scope, + ) + return token_instance.access_token diff --git a/twilio/http/token_manager.py b/twilio/http/token_manager.py new file mode 100644 index 0000000000..28cc731019 --- /dev/null +++ b/twilio/http/token_manager.py @@ -0,0 +1,7 @@ +from twilio.base.version import Version + + +class TokenManager: + + def fetch_access_token(self, version: Version): + pass diff --git a/twilio/rest/__init__.py b/twilio/rest/__init__.py index 5c8f3ebcfe..7874236a26 100644 --- a/twilio/rest/__init__.py +++ b/twilio/rest/__init__.py @@ -96,6 +96,7 @@ def __init__( environment=None, edge=None, user_agent_extensions=None, + credential_provider=None, ): """ Initializes the Twilio Client @@ -121,6 +122,7 @@ def __init__( environment, edge, user_agent_extensions, + credential_provider, ) # Domains @@ -135,6 +137,7 @@ def __init__( self._flex_api: Optional["FlexApi"] = None self._frontline_api: Optional["FrontlineApi"] = None self._iam: Optional["Iam"] = None + self._preview_iam: Optional["PreviewIam"] = None self._insights: Optional["Insights"] = None self._intelligence: Optional["Intelligence"] = None self._ip_messaging: Optional["IpMessaging"] = None @@ -147,6 +150,7 @@ def __init__( self._numbers: Optional["Numbers"] = None self._oauth: Optional["Oauth"] = None self._preview: Optional["Preview"] = None + self._preview_iam: Optional["PreviewIam"] = None self._pricing: Optional["Pricing"] = None self._proxy: Optional["Proxy"] = None self._routes: Optional["Routes"] = None @@ -396,6 +400,19 @@ def microvisor(self) -> "Microvisor": self._microvisor = Microvisor(self) return self._microvisor + @property + def preview_iam(self) -> "PreviewIam": + """ + Access the PreviewIam Twilio Domain + + :returns: PreviewIam Twilio Domain + """ + if self._preview_iam is None: + from twilio.rest.preview_iam import PreviewIam + + self._preview_iam = PreviewIam(self) + return self._preview_iam + @property def monitor(self) -> "Monitor": """ diff --git a/twilio/rest/preview_iam/PreviewIamBase.py b/twilio/rest/preview_iam/PreviewIamBase.py new file mode 100644 index 0000000000..d8735295d7 --- /dev/null +++ b/twilio/rest/preview_iam/PreviewIamBase.py @@ -0,0 +1,47 @@ +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 twilio.base.domain import Domain +from typing import Optional +from twilio.rest import Client + +from twilio.rest.preview_iam.v1 import V1 +from twilio.rest.preview_iam.versionless import Versionless + + +class PreviewIamBase(Domain): + def __init__(self, twilio: Client): + """ + Initialize the PreviewIam Domain + + :returns: Domain for PreviewIam + """ + super().__init__(twilio, "https://preview-iam.twilio.com") + self._versionless: Optional[Versionless] = None + self._v1: Optional[V1] = None + + @property + def versionless(self) -> Versionless: + """ + :returns: Versionless of PreviewIam + """ + if self._versionless is None: + self._versionless = Versionless(self) + return self._versionless + + @property + def v1(self) -> V1: + """ + :returns: V1 of PreviewIam + """ + if self._v1 is None: + self._v1 = V1(self) + return self._v1 diff --git a/twilio/rest/preview_iam/__init__.py b/twilio/rest/preview_iam/__init__.py new file mode 100644 index 0000000000..9103436220 --- /dev/null +++ b/twilio/rest/preview_iam/__init__.py @@ -0,0 +1,25 @@ +from twilio.rest.preview_iam.PreviewIamBase import PreviewIamBase + +from twilio.rest.preview_iam.v1.authorize import ( + AuthorizeList, +) +from twilio.rest.preview_iam.v1.token import ( + TokenList, +) +from twilio.rest.preview_iam.versionless.organization import ( + OrganizationList, +) + + +class PreviewIam(PreviewIamBase): + @property + def organization(self) -> OrganizationList: + return self.versionless.organization + + @property + def authorize(self) -> AuthorizeList: + return self.v1.authorize + + @property + def token(self) -> TokenList: + return self.v1.token diff --git a/twilio/rest/preview_iam/v1/__init__.py b/twilio/rest/preview_iam/v1/__init__.py new file mode 100644 index 0000000000..2243277793 --- /dev/null +++ b/twilio/rest/preview_iam/v1/__init__.py @@ -0,0 +1,51 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Organization Public API + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + 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_iam.v1.authorize import AuthorizeList +from twilio.rest.preview_iam.v1.token import TokenList + + +class V1(Version): + + def __init__(self, domain: Domain): + """ + Initialize the V1 version of PreviewIam + + :param domain: The Twilio.preview_iam domain + """ + super().__init__(domain, "v1") + self._authorize: Optional[AuthorizeList] = None + self._token: Optional[TokenList] = None + + @property + def authorize(self) -> AuthorizeList: + if self._authorize is None: + self._authorize = AuthorizeList(self) + return self._authorize + + @property + def token(self) -> TokenList: + if self._token is None: + self._token = TokenList(self) + return self._token + + def __repr__(self) -> str: + """ + Provide a friendly representation + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/preview_iam/v1/authorize.py b/twilio/rest/preview_iam/v1/authorize.py new file mode 100644 index 0000000000..051f13a8e6 --- /dev/null +++ b/twilio/rest/preview_iam/v1/authorize.py @@ -0,0 +1,126 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Organization Public API + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + 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, Union +from twilio.base import values + +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class AuthorizeInstance(InstanceResource): + """ + :ivar redirect_to: The callback URL + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) + + self.redirect_to: Optional[str] = payload.get("redirect_to") + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "" + + +class AuthorizeList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the AuthorizeList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/authorize" + + def fetch( + self, + response_type: Union[str, object] = values.unset, + client_id: Union[str, object] = values.unset, + redirect_uri: Union[str, object] = values.unset, + scope: Union[str, object] = values.unset, + state: Union[str, object] = values.unset, + ) -> AuthorizeInstance: + """ + Asynchronously fetch the AuthorizeInstance + + :param response_type: Response Type:param client_id: The Client Identifier:param redirect_uri: The url to which response will be redirected to:param scope: The scope of the access request:param state: An opaque value which can be used to maintain state between the request and callback + :returns: The fetched AuthorizeInstance + """ + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + params = values.of( + { + "response_type": response_type, + "client_id": client_id, + "redirect_uri": redirect_uri, + "scope": scope, + "state": state, + } + ) + + payload = self._version.fetch( + method="GET", uri=self._uri, headers=headers, params=params + ) + + return AuthorizeInstance(self._version, payload) + + async def fetch_async( + self, + response_type: Union[str, object] = values.unset, + client_id: Union[str, object] = values.unset, + redirect_uri: Union[str, object] = values.unset, + scope: Union[str, object] = values.unset, + state: Union[str, object] = values.unset, + ) -> AuthorizeInstance: + """ + Asynchronously fetch the AuthorizeInstance + + :param response_type: Response Type:param client_id: The Client Identifier:param redirect_uri: The url to which response will be redirected to:param scope: The scope of the access request:param state: An opaque value which can be used to maintain state between the request and callback + :returns: The fetched AuthorizeInstance + """ + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + params = values.of( + { + "response_type": response_type, + "client_id": client_id, + "redirect_uri": redirect_uri, + "scope": scope, + "state": state, + } + ) + + payload = await self._version.fetch_async( + method="GET", uri=self._uri, headers=headers, params=params + ) + + return AuthorizeInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/preview_iam/v1/token.py b/twilio/rest/preview_iam/v1/token.py new file mode 100644 index 0000000000..81eed237f7 --- /dev/null +++ b/twilio/rest/preview_iam/v1/token.py @@ -0,0 +1,162 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Organization Public API + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + 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, Union +from twilio.base import values + +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class TokenInstance(InstanceResource): + """ + :ivar access_token: Token which carries the necessary information to access a Twilio resource directly. + :ivar refresh_token: Token which carries the information necessary to get a new access token. + :ivar id_token: Token which carries the information necessary of user profile. + :ivar token_type: Token type + :ivar expires_in: + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) + + self.access_token: Optional[str] = payload.get("access_token") + self.refresh_token: Optional[str] = payload.get("refresh_token") + self.id_token: Optional[str] = payload.get("id_token") + self.token_type: Optional[str] = payload.get("token_type") + self.expires_in: Optional[int] = payload.get("expires_in") + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "" + + +class TokenList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the TokenList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/token" + + def create( + self, + grant_type: str, + client_id: str, + client_secret: Union[str, object] = values.unset, + code: Union[str, object] = values.unset, + redirect_uri: Union[str, object] = values.unset, + audience: Union[str, object] = values.unset, + refresh_token: Union[str, object] = values.unset, + scope: Union[str, object] = values.unset, + ) -> TokenInstance: + """ + Create the TokenInstance + + :param grant_type: Grant type is a credential representing resource owner's authorization which can be used by client to obtain access token. + :param client_id: A 34 character string that uniquely identifies this OAuth App. + :param client_secret: The credential for confidential OAuth App. + :param code: JWT token related to the authorization code grant type. + :param redirect_uri: The redirect uri + :param audience: The targeted audience uri + :param refresh_token: JWT token related to refresh access token. + :param scope: The scope of token + + :returns: The created TokenInstance + """ + + data = values.of( + { + "grant_type": grant_type, + "client_id": client_id, + "client_secret": client_secret, + "code": code, + "redirect_uri": redirect_uri, + "audience": audience, + "refresh_token": refresh_token, + "scope": scope, + } + ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return TokenInstance(self._version, payload) + + async def create_async( + self, + grant_type: str, + client_id: str, + client_secret: Union[str, object] = values.unset, + code: Union[str, object] = values.unset, + redirect_uri: Union[str, object] = values.unset, + audience: Union[str, object] = values.unset, + refresh_token: Union[str, object] = values.unset, + scope: Union[str, object] = values.unset, + ) -> TokenInstance: + """ + Asynchronously create the TokenInstance + + :param grant_type: Grant type is a credential representing resource owner's authorization which can be used by client to obtain access token. + :param client_id: A 34 character string that uniquely identifies this OAuth App. + :param client_secret: The credential for confidential OAuth App. + :param code: JWT token related to the authorization code grant type. + :param redirect_uri: The redirect uri + :param audience: The targeted audience uri + :param refresh_token: JWT token related to refresh access token. + :param scope: The scope of token + + :returns: The created TokenInstance + """ + + data = values.of( + { + "grant_type": grant_type, + "client_id": client_id, + "client_secret": client_secret, + "code": code, + "redirect_uri": redirect_uri, + "audience": audience, + "refresh_token": refresh_token, + "scope": scope, + } + ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return TokenInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/preview_iam/versionless/__init__.py b/twilio/rest/preview_iam/versionless/__init__.py new file mode 100644 index 0000000000..7d6d210f14 --- /dev/null +++ b/twilio/rest/preview_iam/versionless/__init__.py @@ -0,0 +1,43 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Organization Public API + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + 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_iam.versionless.organization import OrganizationList + + +class Versionless(Version): + + def __init__(self, domain: Domain): + """ + Initialize the Versionless version of PreviewIam + + :param domain: The Twilio.preview_iam domain + """ + super().__init__(domain, "Organizations") + self._organization: Optional[OrganizationList] = None + + @property + def organization(self) -> OrganizationList: + if self._organization is None: + self._organization = OrganizationList(self) + return self._organization + + def __repr__(self) -> str: + """ + Provide a friendly representation + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/preview_iam/versionless/organization/__init__.py b/twilio/rest/preview_iam/versionless/organization/__init__.py new file mode 100644 index 0000000000..ce6e70e978 --- /dev/null +++ b/twilio/rest/preview_iam/versionless/organization/__init__.py @@ -0,0 +1,128 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Organization Public API + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + 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.instance_context import InstanceContext + +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + +from twilio.rest.preview_iam.versionless.organization.account import AccountList +from twilio.rest.preview_iam.versionless.organization.role_assignment import ( + RoleAssignmentList, +) +from twilio.rest.preview_iam.versionless.organization.user import UserList + + +class OrganizationContext(InstanceContext): + + def __init__(self, version: Version, organization_sid: str): + """ + Initialize the OrganizationContext + + :param version: Version that contains the resource + :param organization_sid: + """ + super().__init__(version) + + # Path Solution + self._solution = { + "organization_sid": organization_sid, + } + self._uri = "/{organization_sid}".format(**self._solution) + + self._accounts: Optional[AccountList] = None + self._role_assignments: Optional[RoleAssignmentList] = None + self._users: Optional[UserList] = None + + @property + def accounts(self) -> AccountList: + """ + Access the accounts + """ + if self._accounts is None: + self._accounts = AccountList( + self._version, + self._solution["organization_sid"], + ) + return self._accounts + + @property + def role_assignments(self) -> RoleAssignmentList: + """ + Access the role_assignments + """ + if self._role_assignments is None: + self._role_assignments = RoleAssignmentList( + self._version, + self._solution["organization_sid"], + ) + return self._role_assignments + + @property + def users(self) -> UserList: + """ + Access the users + """ + if self._users is None: + self._users = UserList( + self._version, + self._solution["organization_sid"], + ) + return self._users + + 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 OrganizationList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the OrganizationList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + def get(self, organization_sid: str) -> OrganizationContext: + """ + Constructs a OrganizationContext + + :param organization_sid: + """ + return OrganizationContext(self._version, organization_sid=organization_sid) + + def __call__(self, organization_sid: str) -> OrganizationContext: + """ + Constructs a OrganizationContext + + :param organization_sid: + """ + return OrganizationContext(self._version, organization_sid=organization_sid) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/preview_iam/versionless/organization/account.py b/twilio/rest/preview_iam/versionless/organization/account.py new file mode 100644 index 0000000000..f1c8019860 --- /dev/null +++ b/twilio/rest/preview_iam/versionless/organization/account.py @@ -0,0 +1,438 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Organization Public API + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + 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, List, Optional, Union, Iterator, AsyncIterator +from twilio.base import deserialize, values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version +from twilio.base.page import Page + + +class AccountInstance(InstanceResource): + """ + :ivar account_sid: Twilio account sid + :ivar friendly_name: Account friendly name + :ivar status: Account status + :ivar owner_sid: Twilio account sid + :ivar date_created: The date and time when the account was created in the system + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + organization_sid: str, + account_sid: Optional[str] = None, + ): + super().__init__(version) + + self.account_sid: Optional[str] = payload.get("account_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.status: Optional[str] = payload.get("status") + self.owner_sid: Optional[str] = payload.get("owner_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + + self._solution = { + "organization_sid": organization_sid, + "account_sid": account_sid or self.account_sid, + } + self._context: Optional[AccountContext] = None + + @property + def _proxy(self) -> "AccountContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: AccountContext for this AccountInstance + """ + if self._context is None: + self._context = AccountContext( + self._version, + organization_sid=self._solution["organization_sid"], + account_sid=self._solution["account_sid"], + ) + return self._context + + def fetch(self) -> "AccountInstance": + """ + Fetch the AccountInstance + + + :returns: The fetched AccountInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "AccountInstance": + """ + Asynchronous coroutine to fetch the AccountInstance + + + :returns: The fetched AccountInstance + """ + return await self._proxy.fetch_async() + + 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 AccountContext(InstanceContext): + + def __init__(self, version: Version, organization_sid: str, account_sid: str): + """ + Initialize the AccountContext + + :param version: Version that contains the resource + :param organization_sid: + :param account_sid: + """ + super().__init__(version) + + # Path Solution + self._solution = { + "organization_sid": organization_sid, + "account_sid": account_sid, + } + self._uri = "/{organization_sid}/Accounts/{account_sid}".format( + **self._solution + ) + + def fetch(self) -> AccountInstance: + """ + Fetch the AccountInstance + + + :returns: The fetched AccountInstance + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) + + return AccountInstance( + self._version, + payload, + organization_sid=self._solution["organization_sid"], + account_sid=self._solution["account_sid"], + ) + + async def fetch_async(self) -> AccountInstance: + """ + Asynchronous coroutine to fetch the AccountInstance + + + :returns: The fetched AccountInstance + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = await self._version.fetch_async( + method="GET", uri=self._uri, headers=headers + ) + + return AccountInstance( + self._version, + payload, + organization_sid=self._solution["organization_sid"], + account_sid=self._solution["account_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 AccountPage(Page): + + def get_instance(self, payload: Dict[str, Any]) -> AccountInstance: + """ + Build an instance of AccountInstance + + :param payload: Payload response from the API + """ + return AccountInstance( + self._version, payload, organization_sid=self._solution["organization_sid"] + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class AccountList(ListResource): + + def __init__(self, version: Version, organization_sid: str): + """ + Initialize the AccountList + + :param version: Version that contains the resource + :param organization_sid: + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "organization_sid": organization_sid, + } + self._uri = "/{organization_sid}/Accounts".format(**self._solution) + + def stream( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[AccountInstance]: + """ + Streams AccountInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = self.page(page_size=limits["page_size"]) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[AccountInstance]: + """ + Asynchronously streams AccountInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = await self.page_async(page_size=limits["page_size"]) + + return self._version.stream_async(page, limits["limit"]) + + def list( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[AccountInstance]: + """ + Lists AccountInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return list( + self.stream( + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[AccountInstance]: + """ + Asynchronously lists AccountInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return [ + record + async for record in await self.stream_async( + limit=limit, + page_size=page_size, + ) + ] + + def page( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> AccountPage: + """ + Retrieve a single page of AccountInstance records from the API. + Request is executed immediately + + :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 + + :returns: Page of AccountInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) + return AccountPage(self._version, response, self._solution) + + async def page_async( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> AccountPage: + """ + Asynchronously retrieve a single page of AccountInstance records from the API. + Request is executed immediately + + :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 + + :returns: Page of AccountInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = await self._version.page_async( + method="GET", uri=self._uri, params=data, headers=headers + ) + return AccountPage(self._version, response, self._solution) + + def get_page(self, target_url: str) -> AccountPage: + """ + Retrieve a specific page of AccountInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of AccountInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return AccountPage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> AccountPage: + """ + Asynchronously retrieve a specific page of AccountInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of AccountInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return AccountPage(self._version, response, self._solution) + + def get(self, account_sid: str) -> AccountContext: + """ + Constructs a AccountContext + + :param account_sid: + """ + return AccountContext( + self._version, + organization_sid=self._solution["organization_sid"], + account_sid=account_sid, + ) + + def __call__(self, account_sid: str) -> AccountContext: + """ + Constructs a AccountContext + + :param account_sid: + """ + return AccountContext( + self._version, + organization_sid=self._solution["organization_sid"], + account_sid=account_sid, + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/preview_iam/versionless/organization/role_assignment.py b/twilio/rest/preview_iam/versionless/organization/role_assignment.py new file mode 100644 index 0000000000..9d356f2c7c --- /dev/null +++ b/twilio/rest/preview_iam/versionless/organization/role_assignment.py @@ -0,0 +1,574 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Organization Public API + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + 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, Union, Iterator, AsyncIterator +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version +from twilio.base.page import Page + + +class RoleAssignmentInstance(InstanceResource): + + class PublicApiCreateRoleAssignmentRequest(object): + """ + :ivar role_sid: Twilio Role Sid representing assigned role + :ivar scope: Twilio Sid representing scope of this assignment + :ivar identity: Twilio Sid representing identity of this assignment + """ + + def __init__(self, payload: Dict[str, Any]): + + self.role_sid: Optional[str] = payload.get("role_sid") + self.scope: Optional[str] = payload.get("scope") + self.identity: Optional[str] = payload.get("identity") + + def to_dict(self): + return { + "role_sid": self.role_sid, + "scope": self.scope, + "identity": self.identity, + } + + """ + :ivar sid: Twilio Role Assignment Sid representing this role assignment + :ivar role_sid: Twilio Role Sid representing assigned role + :ivar scope: Twilio Sid representing identity of this assignment + :ivar identity: Twilio Sid representing scope of this assignment + :ivar code: Twilio-specific error code + :ivar message: Error message + :ivar more_info: Link to Error Code References + :ivar status: HTTP response status code + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + organization_sid: str, + sid: Optional[str] = None, + ): + super().__init__(version) + + self.sid: Optional[str] = payload.get("sid") + self.role_sid: Optional[str] = payload.get("role_sid") + self.scope: Optional[str] = payload.get("scope") + self.identity: Optional[str] = payload.get("identity") + self.code: Optional[int] = payload.get("code") + self.message: Optional[str] = payload.get("message") + self.more_info: Optional[str] = payload.get("moreInfo") + self.status: Optional[int] = payload.get("status") + + self._solution = { + "organization_sid": organization_sid, + "sid": sid or self.sid, + } + self._context: Optional[RoleAssignmentContext] = None + + @property + def _proxy(self) -> "RoleAssignmentContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: RoleAssignmentContext for this RoleAssignmentInstance + """ + if self._context is None: + self._context = RoleAssignmentContext( + self._version, + organization_sid=self._solution["organization_sid"], + sid=self._solution["sid"], + ) + return self._context + + def delete(self) -> bool: + """ + Deletes the RoleAssignmentInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the RoleAssignmentInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + 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 RoleAssignmentContext(InstanceContext): + + class PublicApiCreateRoleAssignmentRequest(object): + """ + :ivar role_sid: Twilio Role Sid representing assigned role + :ivar scope: Twilio Sid representing scope of this assignment + :ivar identity: Twilio Sid representing identity of this assignment + """ + + def __init__(self, payload: Dict[str, Any]): + + self.role_sid: Optional[str] = payload.get("role_sid") + self.scope: Optional[str] = payload.get("scope") + self.identity: Optional[str] = payload.get("identity") + + def to_dict(self): + return { + "role_sid": self.role_sid, + "scope": self.scope, + "identity": self.identity, + } + + def __init__(self, version: Version, organization_sid: str, sid: str): + """ + Initialize the RoleAssignmentContext + + :param version: Version that contains the resource + :param organization_sid: + :param sid: + """ + super().__init__(version) + + # Path Solution + self._solution = { + "organization_sid": organization_sid, + "sid": sid, + } + self._uri = "/{organization_sid}/RoleAssignments/{sid}".format(**self._solution) + + def delete(self) -> bool: + """ + Deletes the RoleAssignmentInstance + + + :returns: True if delete succeeds, False otherwise + """ + + headers = values.of({}) + + headers["Accept"] = "application/scim+json" + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the RoleAssignmentInstance + + + :returns: True if delete succeeds, False otherwise + """ + + headers = values.of({}) + + headers["Accept"] = "application/scim+json" + + return await self._version.delete_async( + method="DELETE", uri=self._uri, headers=headers + ) + + 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 RoleAssignmentPage(Page): + + def get_instance(self, payload: Dict[str, Any]) -> RoleAssignmentInstance: + """ + Build an instance of RoleAssignmentInstance + + :param payload: Payload response from the API + """ + return RoleAssignmentInstance( + self._version, payload, organization_sid=self._solution["organization_sid"] + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class RoleAssignmentList(ListResource): + + class PublicApiCreateRoleAssignmentRequest(object): + """ + :ivar role_sid: Twilio Role Sid representing assigned role + :ivar scope: Twilio Sid representing scope of this assignment + :ivar identity: Twilio Sid representing identity of this assignment + """ + + def __init__(self, payload: Dict[str, Any]): + + self.role_sid: Optional[str] = payload.get("role_sid") + self.scope: Optional[str] = payload.get("scope") + self.identity: Optional[str] = payload.get("identity") + + def to_dict(self): + return { + "role_sid": self.role_sid, + "scope": self.scope, + "identity": self.identity, + } + + def __init__(self, version: Version, organization_sid: str): + """ + Initialize the RoleAssignmentList + + :param version: Version that contains the resource + :param organization_sid: + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "organization_sid": organization_sid, + } + self._uri = "/{organization_sid}/RoleAssignments".format(**self._solution) + + def create( + self, + public_api_create_role_assignment_request: PublicApiCreateRoleAssignmentRequest, + ) -> RoleAssignmentInstance: + """ + Create the RoleAssignmentInstance + + :param public_api_create_role_assignment_request: + + :returns: The created RoleAssignmentInstance + """ + data = public_api_create_role_assignment_request.to_dict() + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return RoleAssignmentInstance( + self._version, payload, organization_sid=self._solution["organization_sid"] + ) + + async def create_async( + self, + public_api_create_role_assignment_request: PublicApiCreateRoleAssignmentRequest, + ) -> RoleAssignmentInstance: + """ + Asynchronously create the RoleAssignmentInstance + + :param public_api_create_role_assignment_request: + + :returns: The created RoleAssignmentInstance + """ + data = public_api_create_role_assignment_request.to_dict() + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return RoleAssignmentInstance( + self._version, payload, organization_sid=self._solution["organization_sid"] + ) + + def stream( + self, + identity: Union[str, object] = values.unset, + scope: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[RoleAssignmentInstance]: + """ + Streams RoleAssignmentInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param str identity: + :param str scope: + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = self.page(identity=identity, scope=scope, page_size=limits["page_size"]) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + identity: Union[str, object] = values.unset, + scope: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[RoleAssignmentInstance]: + """ + Asynchronously streams RoleAssignmentInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param str identity: + :param str scope: + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = await self.page_async( + identity=identity, scope=scope, page_size=limits["page_size"] + ) + + return self._version.stream_async(page, limits["limit"]) + + def list( + self, + identity: Union[str, object] = values.unset, + scope: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[RoleAssignmentInstance]: + """ + Lists RoleAssignmentInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str identity: + :param str scope: + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return list( + self.stream( + identity=identity, + scope=scope, + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + identity: Union[str, object] = values.unset, + scope: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[RoleAssignmentInstance]: + """ + Asynchronously lists RoleAssignmentInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str identity: + :param str scope: + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return [ + record + async for record in await self.stream_async( + identity=identity, + scope=scope, + limit=limit, + page_size=page_size, + ) + ] + + def page( + self, + identity: Union[str, object] = values.unset, + scope: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> RoleAssignmentPage: + """ + Retrieve a single page of RoleAssignmentInstance records from the API. + Request is executed immediately + + :param identity: + :param scope: + :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 + + :returns: Page of RoleAssignmentInstance + """ + data = values.of( + { + "Identity": identity, + "Scope": scope, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) + return RoleAssignmentPage(self._version, response, self._solution) + + async def page_async( + self, + identity: Union[str, object] = values.unset, + scope: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> RoleAssignmentPage: + """ + Asynchronously retrieve a single page of RoleAssignmentInstance records from the API. + Request is executed immediately + + :param identity: + :param scope: + :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 + + :returns: Page of RoleAssignmentInstance + """ + data = values.of( + { + "Identity": identity, + "Scope": scope, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = await self._version.page_async( + method="GET", uri=self._uri, params=data, headers=headers + ) + return RoleAssignmentPage(self._version, response, self._solution) + + def get_page(self, target_url: str) -> RoleAssignmentPage: + """ + Retrieve a specific page of RoleAssignmentInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of RoleAssignmentInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return RoleAssignmentPage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> RoleAssignmentPage: + """ + Asynchronously retrieve a specific page of RoleAssignmentInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of RoleAssignmentInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return RoleAssignmentPage(self._version, response, self._solution) + + def get(self, sid: str) -> RoleAssignmentContext: + """ + Constructs a RoleAssignmentContext + + :param sid: + """ + return RoleAssignmentContext( + self._version, organization_sid=self._solution["organization_sid"], sid=sid + ) + + def __call__(self, sid: str) -> RoleAssignmentContext: + """ + Constructs a RoleAssignmentContext + + :param sid: + """ + return RoleAssignmentContext( + self._version, organization_sid=self._solution["organization_sid"], sid=sid + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/preview_iam/versionless/organization/user.py b/twilio/rest/preview_iam/versionless/organization/user.py new file mode 100644 index 0000000000..166f76b421 --- /dev/null +++ b/twilio/rest/preview_iam/versionless/organization/user.py @@ -0,0 +1,1050 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Organization Public API + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + 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, List, Optional, Union, Iterator, AsyncIterator +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version +from twilio.base.page import Page + + +class UserInstance(InstanceResource): + + class ScimEmailAddress(object): + """ + :ivar primary: Indicates if this email address is the primary one + :ivar value: The actual email address value + :ivar type: The type of email address (e.g., work, home, etc.) + """ + + def __init__(self, payload: Dict[str, Any]): + + self.primary: Optional[bool] = payload.get("primary") + self.value: Optional[str] = payload.get("value") + self.type: Optional[str] = payload.get("type") + + def to_dict(self): + return { + "primary": self.primary, + "value": self.value, + "type": self.type, + } + + class ScimMeta(object): + """ + :ivar resource_type: Indicates the type of the resource + :ivar created: The date and time when the resource was created in the system + :ivar last_modified: The date and time when the resource was last modified + :ivar version: A version identifier for the resource. This can be used to manage resource versioning and concurrency control. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.resource_type: Optional[str] = payload.get("resource_type") + self.created: Optional[datetime] = payload.get("created") + self.last_modified: Optional[datetime] = payload.get("last_modified") + self.version: Optional[str] = payload.get("version") + + def to_dict(self): + return { + "resource_type": self.resource_type, + "created": self.created, + "last_modified": self.last_modified, + "version": self.version, + } + + class ScimName(object): + """ + :ivar given_name: The user's first or given name + :ivar family_name: The user's last or family name + """ + + def __init__(self, payload: Dict[str, Any]): + + self.given_name: Optional[str] = payload.get("given_name") + self.family_name: Optional[str] = payload.get("family_name") + + def to_dict(self): + return { + "given_name": self.given_name, + "family_name": self.family_name, + } + + class ScimUser(object): + """ + :ivar id: Unique Twilio user sid + :ivar external_id: External unique resource id defined by provisioning client + :ivar user_name: Unique username, MUST be same as primary email address + :ivar display_name: User friendly display name + :ivar name: + :ivar emails: Email address list of the user. Primary email must be defined if there are more than 1 email. Primary email must match the username. + :ivar active: Indicates whether the user is active + :ivar locale: User's locale + :ivar timezone: User's time zone + :ivar schemas: An array of URIs that indicate the schemas supported for this user resource + :ivar meta: + :ivar detail: A human-readable description of the error + :ivar scim_type: A scimType error code as defined in RFC7644 + :ivar status: Http status code + :ivar code: Twilio-specific error code + :ivar more_info: Link to Error Code References + """ + + def __init__(self, payload: Dict[str, Any]): + + self.id: Optional[str] = payload.get("id") + self.external_id: Optional[str] = payload.get("external_id") + self.user_name: Optional[str] = payload.get("user_name") + self.display_name: Optional[str] = payload.get("display_name") + self.name: Optional[UserList.ScimName] = payload.get("name") + self.emails: Optional[List[UserList.ScimEmailAddress]] = payload.get( + "emails" + ) + self.active: Optional[bool] = payload.get("active") + self.locale: Optional[str] = payload.get("locale") + self.timezone: Optional[str] = payload.get("timezone") + self.schemas: Optional[List[str]] = payload.get("schemas") + self.meta: Optional[UserList.ScimMeta] = payload.get("meta") + self.detail: Optional[str] = payload.get("detail") + self.scim_type: Optional[str] = payload.get("scim_type") + self.status: Optional[str] = payload.get("status") + self.code: Optional[int] = payload.get("code") + self.more_info: Optional[str] = payload.get("more_info") + + def to_dict(self): + return { + "id": self.id, + "externalId": self.external_id, + "userName": self.user_name, + "displayName": self.display_name, + "name": self.name.to_dict() if self.name is not None else None, + "emails": ( + [emails.to_dict() for emails in self.emails] + if self.emails is not None + else None + ), + "active": self.active, + "locale": self.locale, + "timezone": self.timezone, + "schemas": self.schemas, + "meta": self.meta.to_dict() if self.meta is not None else None, + "detail": self.detail, + "scimType": self.scim_type, + "status": self.status, + "code": self.code, + "moreInfo": self.more_info, + } + + """ + :ivar id: Unique Twilio user sid + :ivar external_id: External unique resource id defined by provisioning client + :ivar user_name: Unique username, MUST be same as primary email address + :ivar display_name: User friendly display name + :ivar name: + :ivar emails: Email address list of the user. Primary email must be defined if there are more than 1 email. Primary email must match the username. + :ivar active: Indicates whether the user is active + :ivar locale: User's locale + :ivar timezone: User's time zone + :ivar schemas: An array of URIs that indicate the schemas supported for this user resource + :ivar meta: + :ivar detail: A human-readable description of the error + :ivar scim_type: A scimType error code as defined in RFC7644 + :ivar status: Http status code + :ivar code: Twilio-specific error code + :ivar more_info: Link to Error Code References + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + organization_sid: str, + id: Optional[str] = None, + ): + super().__init__(version) + + self.id: Optional[str] = payload.get("id") + self.external_id: Optional[str] = payload.get("externalId") + self.user_name: Optional[str] = payload.get("userName") + self.display_name: Optional[str] = payload.get("displayName") + self.name: Optional[UserList.str] = payload.get("name") + self.emails: Optional[List[UserList.str]] = payload.get("emails") + self.active: Optional[bool] = payload.get("active") + self.locale: Optional[str] = payload.get("locale") + self.timezone: Optional[str] = payload.get("timezone") + self.schemas: Optional[List[str]] = payload.get("schemas") + self.meta: Optional[UserList.str] = payload.get("meta") + self.detail: Optional[str] = payload.get("detail") + self.scim_type: Optional[str] = payload.get("scimType") + self.status: Optional[str] = payload.get("status") + self.code: Optional[int] = payload.get("code") + self.more_info: Optional[str] = payload.get("moreInfo") + + self._solution = { + "organization_sid": organization_sid, + "id": id or self.id, + } + self._context: Optional[UserContext] = None + + @property + def _proxy(self) -> "UserContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: UserContext for this UserInstance + """ + if self._context is None: + self._context = UserContext( + self._version, + organization_sid=self._solution["organization_sid"], + id=self._solution["id"], + ) + return self._context + + def delete(self) -> bool: + """ + Deletes the UserInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the UserInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def fetch(self) -> "UserInstance": + """ + Fetch the UserInstance + + + :returns: The fetched UserInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "UserInstance": + """ + Asynchronous coroutine to fetch the UserInstance + + + :returns: The fetched UserInstance + """ + return await self._proxy.fetch_async() + + def update( + self, scim_user: ScimUser, if_match: Union[str, object] = values.unset + ) -> "UserInstance": + """ + Update the UserInstance + + :param scim_user: + :param if_match: + + :returns: The updated UserInstance + """ + return self._proxy.update( + scim_user=scim_user, + if_match=if_match, + ) + + async def update_async( + self, scim_user: ScimUser, if_match: Union[str, object] = values.unset + ) -> "UserInstance": + """ + Asynchronous coroutine to update the UserInstance + + :param scim_user: + :param if_match: + + :returns: The updated UserInstance + """ + return await self._proxy.update_async( + scim_user=scim_user, + if_match=if_match, + ) + + 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 UserContext(InstanceContext): + + class ScimEmailAddress(object): + """ + :ivar primary: Indicates if this email address is the primary one + :ivar value: The actual email address value + :ivar type: The type of email address (e.g., work, home, etc.) + """ + + def __init__(self, payload: Dict[str, Any]): + + self.primary: Optional[bool] = payload.get("primary") + self.value: Optional[str] = payload.get("value") + self.type: Optional[str] = payload.get("type") + + def to_dict(self): + return { + "primary": self.primary, + "value": self.value, + "type": self.type, + } + + class ScimMeta(object): + """ + :ivar resource_type: Indicates the type of the resource + :ivar created: The date and time when the resource was created in the system + :ivar last_modified: The date and time when the resource was last modified + :ivar version: A version identifier for the resource. This can be used to manage resource versioning and concurrency control. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.resource_type: Optional[str] = payload.get("resource_type") + self.created: Optional[datetime] = payload.get("created") + self.last_modified: Optional[datetime] = payload.get("last_modified") + self.version: Optional[str] = payload.get("version") + + def to_dict(self): + return { + "resource_type": self.resource_type, + "created": self.created, + "last_modified": self.last_modified, + "version": self.version, + } + + class ScimName(object): + """ + :ivar given_name: The user's first or given name + :ivar family_name: The user's last or family name + """ + + def __init__(self, payload: Dict[str, Any]): + + self.given_name: Optional[str] = payload.get("given_name") + self.family_name: Optional[str] = payload.get("family_name") + + def to_dict(self): + return { + "given_name": self.given_name, + "family_name": self.family_name, + } + + class ScimUser(object): + """ + :ivar id: Unique Twilio user sid + :ivar external_id: External unique resource id defined by provisioning client + :ivar user_name: Unique username, MUST be same as primary email address + :ivar display_name: User friendly display name + :ivar name: + :ivar emails: Email address list of the user. Primary email must be defined if there are more than 1 email. Primary email must match the username. + :ivar active: Indicates whether the user is active + :ivar locale: User's locale + :ivar timezone: User's time zone + :ivar schemas: An array of URIs that indicate the schemas supported for this user resource + :ivar meta: + :ivar detail: A human-readable description of the error + :ivar scim_type: A scimType error code as defined in RFC7644 + :ivar status: Http status code + :ivar code: Twilio-specific error code + :ivar more_info: Link to Error Code References + """ + + def __init__(self, payload: Dict[str, Any]): + + self.id: Optional[str] = payload.get("id") + self.external_id: Optional[str] = payload.get("external_id") + self.user_name: Optional[str] = payload.get("user_name") + self.display_name: Optional[str] = payload.get("display_name") + self.name: Optional[UserList.ScimName] = payload.get("name") + self.emails: Optional[List[UserList.ScimEmailAddress]] = payload.get( + "emails" + ) + self.active: Optional[bool] = payload.get("active") + self.locale: Optional[str] = payload.get("locale") + self.timezone: Optional[str] = payload.get("timezone") + self.schemas: Optional[List[str]] = payload.get("schemas") + self.meta: Optional[UserList.ScimMeta] = payload.get("meta") + self.detail: Optional[str] = payload.get("detail") + self.scim_type: Optional[str] = payload.get("scim_type") + self.status: Optional[str] = payload.get("status") + self.code: Optional[int] = payload.get("code") + self.more_info: Optional[str] = payload.get("more_info") + + def to_dict(self): + return { + "id": self.id, + "externalId": self.external_id, + "userName": self.user_name, + "displayName": self.display_name, + "name": self.name.to_dict() if self.name is not None else None, + "emails": ( + [emails.to_dict() for emails in self.emails] + if self.emails is not None + else None + ), + "active": self.active, + "locale": self.locale, + "timezone": self.timezone, + "schemas": self.schemas, + "meta": self.meta.to_dict() if self.meta is not None else None, + "detail": self.detail, + "scimType": self.scim_type, + "status": self.status, + "code": self.code, + "moreInfo": self.more_info, + } + + def __init__(self, version: Version, organization_sid: str, id: str): + """ + Initialize the UserContext + + :param version: Version that contains the resource + :param organization_sid: + :param id: + """ + super().__init__(version) + + # Path Solution + self._solution = { + "organization_sid": organization_sid, + "id": id, + } + self._uri = "/{organization_sid}/scim/Users/{id}".format(**self._solution) + + def delete(self) -> bool: + """ + Deletes the UserInstance + + + :returns: True if delete succeeds, False otherwise + """ + + headers = values.of({}) + + headers["Accept"] = "application/scim+json" + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the UserInstance + + + :returns: True if delete succeeds, False otherwise + """ + + headers = values.of({}) + + headers["Accept"] = "application/scim+json" + + return await self._version.delete_async( + method="DELETE", uri=self._uri, headers=headers + ) + + def fetch(self) -> UserInstance: + """ + Fetch the UserInstance + + + :returns: The fetched UserInstance + """ + + headers = values.of({}) + + headers["Accept"] = "application/scim+json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) + + return UserInstance( + self._version, + payload, + organization_sid=self._solution["organization_sid"], + id=self._solution["id"], + ) + + async def fetch_async(self) -> UserInstance: + """ + Asynchronous coroutine to fetch the UserInstance + + + :returns: The fetched UserInstance + """ + + headers = values.of({}) + + headers["Accept"] = "application/scim+json" + + payload = await self._version.fetch_async( + method="GET", uri=self._uri, headers=headers + ) + + return UserInstance( + self._version, + payload, + organization_sid=self._solution["organization_sid"], + id=self._solution["id"], + ) + + def update( + self, scim_user: ScimUser, if_match: Union[str, object] = values.unset + ) -> UserInstance: + """ + Update the UserInstance + + :param scim_user: + :param if_match: + + :returns: The updated UserInstance + """ + data = scim_user.to_dict() + + headers = values.of({}) + + if not ( + if_match is values.unset or (isinstance(if_match, str) and not if_match) + ): + headers["If-Match"] = if_match + + headers["Content-Type"] = "application/json" + + headers["Content-Type"] = "application/scim+json" + + headers["Accept"] = "application/scim+json" + + payload = self._version.update( + method="PUT", uri=self._uri, data=data, headers=headers + ) + + return UserInstance( + self._version, + payload, + organization_sid=self._solution["organization_sid"], + id=self._solution["id"], + ) + + async def update_async( + self, scim_user: ScimUser, if_match: Union[str, object] = values.unset + ) -> UserInstance: + """ + Asynchronous coroutine to update the UserInstance + + :param scim_user: + :param if_match: + + :returns: The updated UserInstance + """ + data = scim_user.to_dict() + + headers = values.of({}) + + if not ( + if_match is values.unset or (isinstance(if_match, str) and not if_match) + ): + headers["If-Match"] = if_match + + headers["Content-Type"] = "application/json" + + headers["Content-Type"] = "application/scim+json" + + headers["Accept"] = "application/scim+json" + + payload = await self._version.update_async( + method="PUT", uri=self._uri, data=data, headers=headers + ) + + return UserInstance( + self._version, + payload, + organization_sid=self._solution["organization_sid"], + id=self._solution["id"], + ) + + 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 UserPage(Page): + + def get_instance(self, payload: Dict[str, Any]) -> UserInstance: + """ + Build an instance of UserInstance + + :param payload: Payload response from the API + """ + return UserInstance( + self._version, payload, organization_sid=self._solution["organization_sid"] + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class UserList(ListResource): + + class ScimEmailAddress(object): + """ + :ivar primary: Indicates if this email address is the primary one + :ivar value: The actual email address value + :ivar type: The type of email address (e.g., work, home, etc.) + """ + + def __init__(self, payload: Dict[str, Any]): + + self.primary: Optional[bool] = payload.get("primary") + self.value: Optional[str] = payload.get("value") + self.type: Optional[str] = payload.get("type") + + def to_dict(self): + return { + "primary": self.primary, + "value": self.value, + "type": self.type, + } + + class ScimMeta(object): + """ + :ivar resource_type: Indicates the type of the resource + :ivar created: The date and time when the resource was created in the system + :ivar last_modified: The date and time when the resource was last modified + :ivar version: A version identifier for the resource. This can be used to manage resource versioning and concurrency control. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.resource_type: Optional[str] = payload.get("resource_type") + self.created: Optional[datetime] = payload.get("created") + self.last_modified: Optional[datetime] = payload.get("last_modified") + self.version: Optional[str] = payload.get("version") + + def to_dict(self): + return { + "resource_type": self.resource_type, + "created": self.created, + "last_modified": self.last_modified, + "version": self.version, + } + + class ScimName(object): + """ + :ivar given_name: The user's first or given name + :ivar family_name: The user's last or family name + """ + + def __init__(self, payload: Dict[str, Any]): + + self.given_name: Optional[str] = payload.get("given_name") + self.family_name: Optional[str] = payload.get("family_name") + + def to_dict(self): + return { + "given_name": self.given_name, + "family_name": self.family_name, + } + + class ScimUser(object): + """ + :ivar id: Unique Twilio user sid + :ivar external_id: External unique resource id defined by provisioning client + :ivar user_name: Unique username, MUST be same as primary email address + :ivar display_name: User friendly display name + :ivar name: + :ivar emails: Email address list of the user. Primary email must be defined if there are more than 1 email. Primary email must match the username. + :ivar active: Indicates whether the user is active + :ivar locale: User's locale + :ivar timezone: User's time zone + :ivar schemas: An array of URIs that indicate the schemas supported for this user resource + :ivar meta: + :ivar detail: A human-readable description of the error + :ivar scim_type: A scimType error code as defined in RFC7644 + :ivar status: Http status code + :ivar code: Twilio-specific error code + :ivar more_info: Link to Error Code References + """ + + def __init__(self, payload: Dict[str, Any]): + + self.id: Optional[str] = payload.get("id") + self.external_id: Optional[str] = payload.get("external_id") + self.user_name: Optional[str] = payload.get("user_name") + self.display_name: Optional[str] = payload.get("display_name") + self.name: Optional[UserList.ScimName] = payload.get("name") + self.emails: Optional[List[UserList.ScimEmailAddress]] = payload.get( + "emails" + ) + self.active: Optional[bool] = payload.get("active") + self.locale: Optional[str] = payload.get("locale") + self.timezone: Optional[str] = payload.get("timezone") + self.schemas: Optional[List[str]] = payload.get("schemas") + self.meta: Optional[UserList.ScimMeta] = payload.get("meta") + self.detail: Optional[str] = payload.get("detail") + self.scim_type: Optional[str] = payload.get("scim_type") + self.status: Optional[str] = payload.get("status") + self.code: Optional[int] = payload.get("code") + self.more_info: Optional[str] = payload.get("more_info") + + def to_dict(self): + return { + "id": self.id, + "externalId": self.external_id, + "userName": self.user_name, + "displayName": self.display_name, + "name": self.name.to_dict() if self.name is not None else None, + "emails": ( + [emails.to_dict() for emails in self.emails] + if self.emails is not None + else None + ), + "active": self.active, + "locale": self.locale, + "timezone": self.timezone, + "schemas": self.schemas, + "meta": self.meta.to_dict() if self.meta is not None else None, + "detail": self.detail, + "scimType": self.scim_type, + "status": self.status, + "code": self.code, + "moreInfo": self.more_info, + } + + def __init__(self, version: Version, organization_sid: str): + """ + Initialize the UserList + + :param version: Version that contains the resource + :param organization_sid: + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "organization_sid": organization_sid, + } + self._uri = "/{organization_sid}/scim/Users".format(**self._solution) + + def create(self, scim_user: ScimUser) -> UserInstance: + """ + Create the UserInstance + + :param scim_user: + + :returns: The created UserInstance + """ + data = scim_user.to_dict() + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/json" + + headers["Content-Type"] = "application/scim+json" + + headers["Accept"] = "application/scim+json" + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return UserInstance( + self._version, payload, organization_sid=self._solution["organization_sid"] + ) + + async def create_async(self, scim_user: ScimUser) -> UserInstance: + """ + Asynchronously create the UserInstance + + :param scim_user: + + :returns: The created UserInstance + """ + data = scim_user.to_dict() + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/json" + + headers["Content-Type"] = "application/scim+json" + + headers["Accept"] = "application/scim+json" + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return UserInstance( + self._version, payload, organization_sid=self._solution["organization_sid"] + ) + + def stream( + self, + filter: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[UserInstance]: + """ + Streams UserInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param str filter: + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = self.page(filter=filter, page_size=limits["page_size"]) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + filter: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[UserInstance]: + """ + Asynchronously streams UserInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param str filter: + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = await self.page_async(filter=filter, page_size=limits["page_size"]) + + return self._version.stream_async(page, limits["limit"]) + + def list( + self, + filter: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[UserInstance]: + """ + Lists UserInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str filter: + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return list( + self.stream( + filter=filter, + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + filter: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[UserInstance]: + """ + Asynchronously lists UserInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str filter: + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return [ + record + async for record in await self.stream_async( + filter=filter, + limit=limit, + page_size=page_size, + ) + ] + + def page( + self, + filter: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> UserPage: + """ + Retrieve a single page of UserInstance records from the API. + Request is executed immediately + + :param filter: + :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 + + :returns: Page of UserInstance + """ + data = values.of( + { + "filter": filter, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/scim+json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) + return UserPage(self._version, response, self._solution) + + async def page_async( + self, + filter: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> UserPage: + """ + Asynchronously retrieve a single page of UserInstance records from the API. + Request is executed immediately + + :param filter: + :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 + + :returns: Page of UserInstance + """ + data = values.of( + { + "filter": filter, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/scim+json" + + response = await self._version.page_async( + method="GET", uri=self._uri, params=data, headers=headers + ) + return UserPage(self._version, response, self._solution) + + def get_page(self, target_url: str) -> UserPage: + """ + Retrieve a specific page of UserInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of UserInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return UserPage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> UserPage: + """ + Asynchronously retrieve a specific page of UserInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of UserInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return UserPage(self._version, response, self._solution) + + def get(self, id: str) -> UserContext: + """ + Constructs a UserContext + + :param id: + """ + return UserContext( + self._version, organization_sid=self._solution["organization_sid"], id=id + ) + + def __call__(self, id: str) -> UserContext: + """ + Constructs a UserContext + + :param id: + """ + return UserContext( + self._version, organization_sid=self._solution["organization_sid"], id=id + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" From 0b8aab400793efc06c1beb4a6a0f931b21df0ca1 Mon Sep 17 00:00:00 2001 From: Athira Sabu <102021496+AsabuHere@users.noreply.github.com> Date: Thu, 12 Dec 2024 16:01:56 +0530 Subject: [PATCH 52/87] feat: Docs update and examples for organization api uptake and public oauth (#825) * Docs update and examples --- README.md | 7 ++++ examples/organization_api.py | 30 ++++++++++++++ examples/public_oauth.py | 31 ++++++++++++++ .../credential/client_credential_provider.py | 28 +++++++++++++ twilio/http/client_token_manager.py | 41 +++++++++++++++++++ 5 files changed, 137 insertions(+) create mode 100644 examples/organization_api.py create mode 100644 examples/public_oauth.py create mode 100644 twilio/credential/client_credential_provider.py create mode 100644 twilio/http/client_token_manager.py diff --git a/README.md b/README.md index 50cc5509e1..bfbd6a14b5 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,13 @@ After a brief delay, you will receive the text message on your phone. > **Warning** > It's okay to hardcode your credentials when testing locally, but you should use environment variables to keep them secret before committing any code or deploying to production. Check out [How to Set Environment Variables](https://www.twilio.com/blog/2017/01/how-to-set-environment-variables.html) for more information. +## OAuth Feature for Twilio APIs +We are introducing Client Credentials Flow-based OAuth 2.0 authentication. This feature is currently in beta and its implementation is subject to change. + +API examples [here](https://github.com/twilio/twilio-python/blob/main/examples/public_oauth.py) + +Organisation API examples [here](https://github.com/twilio/twilio-python/blob/main/examples/organization_api.py) + ## Use the helper library ### API Credentials diff --git a/examples/organization_api.py b/examples/organization_api.py new file mode 100644 index 0000000000..f95df03c72 --- /dev/null +++ b/examples/organization_api.py @@ -0,0 +1,30 @@ +import os + +from twilio.rest import Client +from twilio.credential.orgs_credential_provider import OrgsCredentialProvider + +ACCOUNT_SID = os.environ.get("TWILIO_ACCOUNT_SID") +API_KEY = os.environ.get("TWILIO_API_KEY") +API_SECRET = os.environ.get("TWILIO_API_SECRET") + +CLIENT_ID = os.environ.get("TWILIO_CLIENT_ID") +CLIENT_SECRET = os.environ.get("CLIENT_SECRET") +ORGS_SID = os.environ.get("ORGS_SID") + + +def example(): + """ + Some example usage of using organization resources + """ + self.client = Client( + account_sid=ACCOUNT_SID, + credential_provider= OrgsCredentialProvider(CLIENT_ID,CLIENT_SECRET) + ) + + accounts = self.client.preview_iam.organization(organization_sid=ORGS_SID).accounts.stream() + for record in accounts: + print(record) + + +if __name__ == "__main__": + example() diff --git a/examples/public_oauth.py b/examples/public_oauth.py new file mode 100644 index 0000000000..a01d04a6c1 --- /dev/null +++ b/examples/public_oauth.py @@ -0,0 +1,31 @@ +import os + +from twilio.rest import Client +from twilio.credential.client_credential_provider import ClientCredentialProvider + +ACCOUNT_SID = os.environ.get("TWILIO_ACCOUNT_SID") +API_KEY = os.environ.get("TWILIO_API_KEY") +API_SECRET = os.environ.get("TWILIO_API_SECRET") +FROM_NUMBER = os.environ.get("TWILIO_FROM_NUMBER") +TO_NUMBER = os.environ.get("TWILIO_TO_NUMBER") + +CLIENT_ID = os.environ.get("TWILIO_CLIENT_ID") +CLIENT_SECRET = os.environ.get("CLIENT_SECRET") + + +def example(): + """ + Some example usage of message resources. + """ + self.client = Client( + account_sid=ACCOUNT_SID, + credential_provider= ClientCredentialProvider(CLIENT_ID,CLIENT_SECRET) + ) + + msg = self.client.messages.create( + to=self.to_number, from_=self.from_number, body="hello world" + ) + + +if __name__ == "__main__": + example() diff --git a/twilio/credential/client_credential_provider.py b/twilio/credential/client_credential_provider.py new file mode 100644 index 0000000000..656d446395 --- /dev/null +++ b/twilio/credential/client_credential_provider.py @@ -0,0 +1,28 @@ +from twilio.http.client_token_manager import ClientTokenManager +from twilio.base.exceptions import TwilioException +from twilio.credential.credential_provider import CredentialProvider +from twilio.auth_strategy.auth_type import AuthType +from twilio.auth_strategy.token_auth_strategy import TokenAuthStrategy + + +class ClientCredentialProvider(CredentialProvider): + def __init__(self, client_id: str, client_secret: str, token_manager=None): + super().__init__(AuthType.CLIENT_CREDENTIALS) + + if client_id is None or client_secret is None: + raise TwilioException("Client id and Client secret are mandatory") + + self.grant_type = "client_credentials" + self.client_id = client_id + self.client_secret = client_secret + self.token_manager = token_manager + self.auth_strategy = None + + def to_auth_strategy(self): + if self.token_manager is None: + self.token_manager = ClientTokenManager( + self.grant_type, self.client_id, self.client_secret + ) + if self.auth_strategy is None: + self.auth_strategy = TokenAuthStrategy(self.token_manager) + return self.auth_strategy diff --git a/twilio/http/client_token_manager.py b/twilio/http/client_token_manager.py new file mode 100644 index 0000000000..d65acb2ba2 --- /dev/null +++ b/twilio/http/client_token_manager.py @@ -0,0 +1,41 @@ +from twilio.http.token_manager import TokenManager +from twilio.rest import Client + + +class ClientTokenManager(TokenManager): + """ + Client Token Manager + """ + + def __init__( + self, + grant_type: str, + client_id: str, + client_secret: str, + code: str = None, + redirect_uri: str = None, + audience: str = None, + refreshToken: str = None, + scope: str = None, + ): + self.grant_type = grant_type + self.client_id = client_id + self.client_secret = client_secret + self.code = code + self.redirect_uri = redirect_uri + self.audience = audience + self.refreshToken = refreshToken + self.scope = scope + self.client = Client() + + def fetch_access_token(self): + token_instance = self.client.preview_iam.v1.token.create( + grant_type=self.grant_type, + client_id=self.client_id, + client_secret=self.client_secret, + code=self.code, + redirect_uri=self.redirect_uri, + audience=self.audience, + scope=self.scope, + ) + return token_instance.access_token From ec1b6bf43817919279052069ad0863c4fb96a739 Mon Sep 17 00:00:00 2001 From: Twilio Date: Thu, 12 Dec 2024 17:07:11 +0000 Subject: [PATCH 53/87] [Librarian] Regenerated @ ca4a5892d2b6a6161860845fe1152af07920bc07 403073118470eabf87311669c7fea876d35ced04 --- CHANGES.md | 7 + examples/organization_api.py | 6 +- examples/public_oauth.py | 2 +- twilio/rest/__init__.py | 32 +- .../rest/accounts/v1/auth_token_promotion.py | 16 +- twilio/rest/accounts/v1/bulk_consents.py | 8 + twilio/rest/accounts/v1/bulk_contacts.py | 8 + twilio/rest/accounts/v1/credential/aws.py | 72 +- .../rest/accounts/v1/credential/public_key.py | 72 +- twilio/rest/accounts/v1/safelist.py | 12 + .../rest/accounts/v1/secondary_auth_token.py | 14 +- twilio/rest/api/v2010/account/__init__.py | 58 +- .../api/v2010/account/address/__init__.py | 72 +- .../account/address/dependent_phone_number.py | 14 +- twilio/rest/api/v2010/account/application.py | 72 +- .../v2010/account/authorized_connect_app.py | 30 +- .../__init__.py | 30 +- .../available_phone_number_country/local.py | 14 +- .../machine_to_machine.py | 14 +- .../available_phone_number_country/mobile.py | 14 +- .../national.py | 14 +- .../shared_cost.py | 14 +- .../toll_free.py | 14 +- .../available_phone_number_country/voip.py | 14 +- twilio/rest/api/v2010/account/balance.py | 4 + .../rest/api/v2010/account/call/__init__.py | 72 +- twilio/rest/api/v2010/account/call/event.py | 14 +- .../api/v2010/account/call/notification.py | 30 +- twilio/rest/api/v2010/account/call/payment.py | 28 +- .../rest/api/v2010/account/call/recording.py | 72 +- twilio/rest/api/v2010/account/call/siprec.py | 28 +- twilio/rest/api/v2010/account/call/stream.py | 28 +- .../api/v2010/account/call/transcription.py | 28 +- .../account/call/user_defined_message.py | 8 + .../call/user_defined_message_subscription.py | 22 +- .../api/v2010/account/conference/__init__.py | 50 +- .../v2010/account/conference/participant.py | 72 +- .../api/v2010/account/conference/recording.py | 64 +- twilio/rest/api/v2010/account/connect_app.py | 64 +- .../account/incoming_phone_number/__init__.py | 72 +- .../assigned_add_on/__init__.py | 52 +- .../assigned_add_on_extension.py | 30 +- .../account/incoming_phone_number/local.py | 22 +- .../account/incoming_phone_number/mobile.py | 22 +- .../incoming_phone_number/toll_free.py | 22 +- twilio/rest/api/v2010/account/key.py | 64 +- .../api/v2010/account/message/__init__.py | 72 +- .../api/v2010/account/message/feedback.py | 8 + .../rest/api/v2010/account/message/media.py | 44 +- twilio/rest/api/v2010/account/new_key.py | 8 + .../rest/api/v2010/account/new_signing_key.py | 8 + twilio/rest/api/v2010/account/notification.py | 30 +- .../api/v2010/account/outgoing_caller_id.py | 64 +- .../rest/api/v2010/account/queue/__init__.py | 72 +- twilio/rest/api/v2010/account/queue/member.py | 50 +- .../api/v2010/account/recording/__init__.py | 42 +- .../recording/add_on_result/__init__.py | 44 +- .../add_on_result/payload/__init__.py | 44 +- .../recording/add_on_result/payload/data.py | 17 +- .../v2010/account/recording/transcription.py | 44 +- twilio/rest/api/v2010/account/short_code.py | 50 +- twilio/rest/api/v2010/account/signing_key.py | 64 +- .../account/sip/credential_list/__init__.py | 72 +- .../account/sip/credential_list/credential.py | 72 +- .../api/v2010/account/sip/domain/__init__.py | 72 +- .../auth_calls_credential_list_mapping.py | 52 +- ...th_calls_ip_access_control_list_mapping.py | 52 +- ...h_registrations_credential_list_mapping.py | 52 +- .../sip/domain/credential_list_mapping.py | 52 +- .../domain/ip_access_control_list_mapping.py | 52 +- .../sip/ip_access_control_list/__init__.py | 72 +- .../sip/ip_access_control_list/ip_address.py | 72 +- twilio/rest/api/v2010/account/token.py | 8 + .../rest/api/v2010/account/transcription.py | 44 +- .../v2010/account/usage/record/__init__.py | 14 +- .../v2010/account/usage/record/all_time.py | 14 +- .../api/v2010/account/usage/record/daily.py | 14 +- .../v2010/account/usage/record/last_month.py | 14 +- .../api/v2010/account/usage/record/monthly.py | 14 +- .../v2010/account/usage/record/this_month.py | 14 +- .../api/v2010/account/usage/record/today.py | 14 +- .../api/v2010/account/usage/record/yearly.py | 14 +- .../v2010/account/usage/record/yesterday.py | 14 +- .../rest/api/v2010/account/usage/trigger.py | 72 +- .../api/v2010/account/validation_request.py | 8 + .../rest/assistants/v1/assistant/__init__.py | 323 ++- .../v1/assistant/assistants_knowledge.py | 28 +- .../v1/assistant/assistants_tool.py | 28 +- .../rest/assistants/v1/assistant/feedback.py | 44 +- .../rest/assistants/v1/assistant/message.py | 33 + .../rest/assistants/v1/knowledge/__init__.py | 263 ++- twilio/rest/assistants/v1/knowledge/chunk.py | 14 +- .../v1/knowledge/knowledge_status.py | 18 +- twilio/rest/assistants/v1/policy.py | 14 +- twilio/rest/assistants/v1/session/__init__.py | 30 +- twilio/rest/assistants/v1/session/message.py | 14 +- twilio/rest/assistants/v1/tool.py | 273 ++- twilio/rest/bulkexports/v1/export/__init__.py | 17 +- twilio/rest/bulkexports/v1/export/day.py | 30 +- .../v1/export/export_custom_job.py | 22 +- twilio/rest/bulkexports/v1/export/job.py | 31 +- .../bulkexports/v1/export_configuration.py | 36 +- twilio/rest/chat/v1/credential.py | 72 +- twilio/rest/chat/v1/service/__init__.py | 72 +- .../rest/chat/v1/service/channel/__init__.py | 72 +- twilio/rest/chat/v1/service/channel/invite.py | 52 +- twilio/rest/chat/v1/service/channel/member.py | 72 +- .../rest/chat/v1/service/channel/message.py | 72 +- twilio/rest/chat/v1/service/role.py | 72 +- twilio/rest/chat/v1/service/user/__init__.py | 72 +- .../rest/chat/v1/service/user/user_channel.py | 14 +- twilio/rest/chat/v2/credential.py | 72 +- twilio/rest/chat/v2/service/__init__.py | 72 +- twilio/rest/chat/v2/service/binding.py | 44 +- .../rest/chat/v2/service/channel/__init__.py | 82 +- twilio/rest/chat/v2/service/channel/invite.py | 52 +- twilio/rest/chat/v2/service/channel/member.py | 82 +- .../rest/chat/v2/service/channel/message.py | 82 +- .../rest/chat/v2/service/channel/webhook.py | 72 +- twilio/rest/chat/v2/service/role.py | 72 +- twilio/rest/chat/v2/service/user/__init__.py | 92 +- .../rest/chat/v2/service/user/user_binding.py | 44 +- .../rest/chat/v2/service/user/user_channel.py | 54 +- twilio/rest/chat/v3/channel.py | 40 +- twilio/rest/content/v1/content/__init__.py | 1830 +++++++++++++++-- .../content/v1/content/approval_create.py | 36 +- .../rest/content/v1/content/approval_fetch.py | 17 +- .../rest/content/v1/content_and_approvals.py | 14 +- twilio/rest/content/v1/legacy_content.py | 14 +- twilio/rest/content/v2/content.py | 14 +- .../rest/content/v2/content_and_approvals.py | 14 +- .../conversations/v1/address_configuration.py | 72 +- .../v1/configuration/__init__.py | 36 +- .../conversations/v1/configuration/webhook.py | 36 +- .../conversations/v1/conversation/__init__.py | 82 +- .../v1/conversation/message/__init__.py | 82 +- .../conversation/message/delivery_receipt.py | 30 +- .../v1/conversation/participant.py | 82 +- .../conversations/v1/conversation/webhook.py | 72 +- .../v1/conversation_with_participants.py | 8 + twilio/rest/conversations/v1/credential.py | 72 +- .../v1/participant_conversation.py | 14 +- twilio/rest/conversations/v1/role.py | 72 +- .../rest/conversations/v1/service/__init__.py | 52 +- .../rest/conversations/v1/service/binding.py | 44 +- .../v1/service/configuration/__init__.py | 36 +- .../v1/service/configuration/notification.py | 36 +- .../v1/service/configuration/webhook.py | 36 +- .../v1/service/conversation/__init__.py | 82 +- .../service/conversation/message/__init__.py | 82 +- .../conversation/message/delivery_receipt.py | 30 +- .../v1/service/conversation/participant.py | 82 +- .../v1/service/conversation/webhook.py | 72 +- .../service/conversation_with_participants.py | 8 + .../v1/service/participant_conversation.py | 14 +- twilio/rest/conversations/v1/service/role.py | 72 +- .../conversations/v1/service/user/__init__.py | 82 +- .../v1/service/user/user_conversation.py | 64 +- twilio/rest/conversations/v1/user/__init__.py | 82 +- .../v1/user/user_conversation.py | 64 +- twilio/rest/events/v1/event_type.py | 30 +- twilio/rest/events/v1/schema/__init__.py | 18 +- .../rest/events/v1/schema/schema_version.py | 30 +- twilio/rest/events/v1/sink/__init__.py | 72 +- twilio/rest/events/v1/sink/sink_test.py | 4 + twilio/rest/events/v1/sink/sink_validate.py | 8 + .../rest/events/v1/subscription/__init__.py | 72 +- .../v1/subscription/subscribed_event.py | 72 +- twilio/rest/flex_api/v1/assessments.py | 66 +- twilio/rest/flex_api/v1/channel.py | 52 +- twilio/rest/flex_api/v1/configuration.py | 40 +- twilio/rest/flex_api/v1/flex_flow.py | 72 +- .../v1/insights_assessments_comment.py | 32 +- .../flex_api/v1/insights_conversations.py | 24 +- .../flex_api/v1/insights_questionnaires.py | 84 +- .../v1/insights_questionnaires_category.py | 70 +- .../v1/insights_questionnaires_question.py | 70 +- twilio/rest/flex_api/v1/insights_segments.py | 24 +- .../v1/insights_settings_answer_sets.py | 4 + .../flex_api/v1/insights_settings_comment.py | 4 + .../rest/flex_api/v1/insights_user_roles.py | 14 +- .../rest/flex_api/v1/interaction/__init__.py | 24 +- .../interaction_channel/__init__.py | 50 +- .../interaction_channel_invite.py | 22 +- .../interaction_channel_participant.py | 42 +- twilio/rest/flex_api/v1/plugin/__init__.py | 80 +- .../flex_api/v1/plugin/plugin_versions.py | 46 +- twilio/rest/flex_api/v1/plugin_archive.py | 30 +- .../v1/plugin_configuration/__init__.py | 46 +- .../plugin_configuration/configured_plugin.py | 38 +- .../v1/plugin_configuration_archive.py | 30 +- twilio/rest/flex_api/v1/plugin_release.py | 46 +- .../flex_api/v1/plugin_version_archive.py | 30 +- .../rest/flex_api/v1/provisioning_status.py | 17 +- twilio/rest/flex_api/v1/web_channel.py | 72 +- twilio/rest/flex_api/v2/flex_user.py | 36 +- twilio/rest/flex_api/v2/web_channels.py | 8 + twilio/rest/frontline_api/v1/user.py | 36 +- twilio/rest/iam/v1/__init__.py | 12 +- twilio/rest/iam/v1/api_key.py | 50 +- twilio/rest/iam/v1/get_api_keys.py | 14 +- twilio/rest/iam/v1/{key.py => new_api_key.py} | 38 +- twilio/rest/insights/v1/call/__init__.py | 17 +- twilio/rest/insights/v1/call/annotation.py | 36 +- twilio/rest/insights/v1/call/call_summary.py | 14 +- twilio/rest/insights/v1/call/event.py | 14 +- twilio/rest/insights/v1/call/metric.py | 14 +- twilio/rest/insights/v1/call_summaries.py | 14 +- .../rest/insights/v1/conference/__init__.py | 30 +- .../v1/conference/conference_participant.py | 28 +- twilio/rest/insights/v1/room/__init__.py | 30 +- twilio/rest/insights/v1/room/participant.py | 30 +- twilio/rest/insights/v1/setting.py | 34 +- .../rest/intelligence/v2/custom_operator.py | 84 +- twilio/rest/intelligence/v2/operator.py | 30 +- .../intelligence/v2/operator_attachment.py | 14 +- .../intelligence/v2/operator_attachments.py | 17 +- twilio/rest/intelligence/v2/operator_type.py | 30 +- .../rest/intelligence/v2/prebuilt_operator.py | 30 +- twilio/rest/intelligence/v2/service.py | 84 +- .../intelligence/v2/transcript/__init__.py | 52 +- .../rest/intelligence/v2/transcript/media.py | 14 +- .../v2/transcript/operator_result.py | 28 +- .../intelligence/v2/transcript/sentence.py | 14 +- twilio/rest/ip_messaging/v1/credential.py | 72 +- .../rest/ip_messaging/v1/service/__init__.py | 72 +- .../v1/service/channel/__init__.py | 72 +- .../ip_messaging/v1/service/channel/invite.py | 52 +- .../ip_messaging/v1/service/channel/member.py | 72 +- .../v1/service/channel/message.py | 72 +- twilio/rest/ip_messaging/v1/service/role.py | 72 +- .../ip_messaging/v1/service/user/__init__.py | 72 +- .../v1/service/user/user_channel.py | 14 +- twilio/rest/ip_messaging/v2/credential.py | 72 +- .../rest/ip_messaging/v2/service/__init__.py | 72 +- .../rest/ip_messaging/v2/service/binding.py | 44 +- .../v2/service/channel/__init__.py | 82 +- .../ip_messaging/v2/service/channel/invite.py | 52 +- .../ip_messaging/v2/service/channel/member.py | 82 +- .../v2/service/channel/message.py | 82 +- .../v2/service/channel/webhook.py | 72 +- twilio/rest/ip_messaging/v2/service/role.py | 72 +- .../ip_messaging/v2/service/user/__init__.py | 92 +- .../v2/service/user/user_binding.py | 44 +- .../v2/service/user/user_channel.py | 64 +- twilio/rest/lookups/v1/phone_number.py | 16 +- twilio/rest/lookups/v2/phone_number.py | 14 +- .../v1/available_add_on/__init__.py | 30 +- .../available_add_on_extension.py | 30 +- .../v1/installed_add_on/__init__.py | 72 +- .../installed_add_on_extension.py | 50 +- .../installed_add_on_usage.py | 84 +- .../marketplace/v1/module_data_management.py | 36 +- .../marketplace/v1/referral_conversion.py | 25 +- .../v1/brand_registration/__init__.py | 54 +- .../brand_registration_otp.py | 4 + .../v1/brand_registration/brand_vetting.py | 38 +- twilio/rest/messaging/v1/deactivations.py | 14 +- twilio/rest/messaging/v1/domain_certs.py | 50 +- twilio/rest/messaging/v1/domain_config.py | 36 +- .../v1/domain_config_messaging_service.py | 18 +- twilio/rest/messaging/v1/external_campaign.py | 8 + .../v1/linkshortening_messaging_service.py | 14 +- ...ng_messaging_service_domain_association.py | 17 +- .../rest/messaging/v1/request_managed_cert.py | 16 +- twilio/rest/messaging/v1/service/__init__.py | 72 +- .../rest/messaging/v1/service/alpha_sender.py | 52 +- .../messaging/v1/service/channel_sender.py | 52 +- .../rest/messaging/v1/service/phone_number.py | 52 +- .../rest/messaging/v1/service/short_code.py | 52 +- .../messaging/v1/service/us_app_to_person.py | 72 +- .../v1/service/us_app_to_person_usecase.py | 4 + .../messaging/v1/tollfree_verification.py | 72 +- twilio/rest/messaging/v1/usecase.py | 4 + twilio/rest/microvisor/v1/account_config.py | 72 +- twilio/rest/microvisor/v1/account_secret.py | 72 +- twilio/rest/microvisor/v1/app/__init__.py | 44 +- twilio/rest/microvisor/v1/app/app_manifest.py | 17 +- twilio/rest/microvisor/v1/device/__init__.py | 50 +- .../microvisor/v1/device/device_config.py | 72 +- .../microvisor/v1/device/device_secret.py | 72 +- twilio/rest/monitor/v1/alert.py | 30 +- twilio/rest/monitor/v1/event.py | 30 +- twilio/rest/notify/v1/credential.py | 72 +- twilio/rest/notify/v1/service/__init__.py | 72 +- twilio/rest/notify/v1/service/binding.py | 52 +- twilio/rest/notify/v1/service/notification.py | 8 + twilio/rest/numbers/v1/__init__.py | 24 +- twilio/rest/numbers/v1/bulk_eligibility.py | 22 +- twilio/rest/numbers/v1/eligibility.py | 6 + twilio/rest/numbers/v1/porting_port_in.py | 36 +- .../v1/porting_port_in_phone_number.py | 32 +- twilio/rest/numbers/v1/porting_portability.py | 14 +- .../v1/porting_webhook_configuration.py | 6 + .../porting_webhook_configuration_delete.py | 15 +- .../v1/signing_request_configuration.py | 20 +- ...hook_configuration_fetch.py => webhook.py} | 30 +- .../v2/authorization_document/__init__.py | 52 +- .../dependent_hosted_number_order.py | 14 +- .../numbers/v2/bulk_hosted_number_order.py | 20 +- twilio/rest/numbers/v2/hosted_number_order.py | 72 +- .../regulatory_compliance/bundle/__init__.py | 72 +- .../bundle/bundle_copy.py | 22 +- .../bundle/evaluation.py | 34 +- .../bundle/item_assignment.py | 52 +- .../bundle/replace_items.py | 8 + .../v2/regulatory_compliance/end_user.py | 72 +- .../v2/regulatory_compliance/end_user_type.py | 30 +- .../v2/regulatory_compliance/regulation.py | 28 +- .../supporting_document.py | 72 +- .../supporting_document_type.py | 30 +- twilio/rest/oauth/v1/authorize.py | 4 + twilio/rest/oauth/v1/token.py | 8 + .../authorization_document/__init__.py | 58 +- .../dependent_hosted_number_order.py | 14 +- .../hosted_numbers/hosted_number_order.py | 72 +- .../marketplace/available_add_on/__init__.py | 30 +- .../available_add_on_extension.py | 30 +- .../marketplace/installed_add_on/__init__.py | 72 +- .../installed_add_on_extension.py | 50 +- twilio/rest/preview/sync/service/__init__.py | 72 +- .../preview/sync/service/document/__init__.py | 84 +- .../service/document/document_permission.py | 64 +- .../sync/service/sync_list/__init__.py | 52 +- .../sync/service/sync_list/sync_list_item.py | 74 +- .../service/sync_list/sync_list_permission.py | 64 +- .../preview/sync/service/sync_map/__init__.py | 52 +- .../sync/service/sync_map/sync_map_item.py | 74 +- .../service/sync_map/sync_map_permission.py | 64 +- twilio/rest/preview/wireless/command.py | 38 +- twilio/rest/preview/wireless/rate_plan.py | 72 +- twilio/rest/preview/wireless/sim/__init__.py | 50 +- twilio/rest/preview/wireless/sim/usage.py | 14 +- twilio/rest/preview_iam/PreviewIamBase.py | 28 +- twilio/rest/preview_iam/__init__.py | 68 +- .../preview_iam/organizations/__init__.py | 59 + .../rest/preview_iam/organizations/account.py | 436 ++++ .../organizations/role_assignment.py | 588 ++++++ twilio/rest/preview_iam/organizations/user.py | 1052 ++++++++++ twilio/rest/preview_iam/v1/authorize.py | 4 + twilio/rest/preview_iam/v1/token.py | 8 + twilio/rest/pricing/v1/messaging/country.py | 30 +- .../rest/pricing/v1/phone_number/country.py | 30 +- twilio/rest/pricing/v1/voice/country.py | 30 +- twilio/rest/pricing/v1/voice/number.py | 17 +- twilio/rest/pricing/v2/country.py | 30 +- twilio/rest/pricing/v2/number.py | 14 +- twilio/rest/pricing/v2/voice/country.py | 30 +- twilio/rest/pricing/v2/voice/number.py | 14 +- twilio/rest/proxy/v1/service/__init__.py | 72 +- twilio/rest/proxy/v1/service/phone_number.py | 72 +- .../rest/proxy/v1/service/session/__init__.py | 72 +- .../proxy/v1/service/session/interaction.py | 44 +- .../service/session/participant/__init__.py | 52 +- .../participant/message_interaction.py | 38 +- twilio/rest/proxy/v1/service/short_code.py | 72 +- twilio/rest/routes/v2/phone_number.py | 36 +- twilio/rest/routes/v2/sip_domain.py | 36 +- twilio/rest/routes/v2/trunk.py | 36 +- twilio/rest/serverless/v1/service/__init__.py | 72 +- .../serverless/v1/service/asset/__init__.py | 72 +- .../v1/service/asset/asset_version.py | 30 +- .../serverless/v1/service/build/__init__.py | 62 +- .../v1/service/build/build_status.py | 18 +- .../v1/service/environment/__init__.py | 52 +- .../v1/service/environment/deployment.py | 38 +- .../serverless/v1/service/environment/log.py | 30 +- .../v1/service/environment/variable.py | 72 +- .../v1/service/function/__init__.py | 72 +- .../function/function_version/__init__.py | 30 +- .../function_version_content.py | 17 +- twilio/rest/studio/v1/flow/__init__.py | 44 +- .../studio/v1/flow/engagement/__init__.py | 52 +- .../v1/flow/engagement/engagement_context.py | 17 +- .../v1/flow/engagement/step/__init__.py | 30 +- .../v1/flow/engagement/step/step_context.py | 17 +- .../rest/studio/v1/flow/execution/__init__.py | 72 +- .../v1/flow/execution/execution_context.py | 17 +- .../flow/execution/execution_step/__init__.py | 30 +- .../execution_step/execution_step_context.py | 17 +- twilio/rest/studio/v2/flow/__init__.py | 72 +- .../rest/studio/v2/flow/execution/__init__.py | 72 +- .../v2/flow/execution/execution_context.py | 17 +- .../flow/execution/execution_step/__init__.py | 30 +- .../execution_step/execution_step_context.py | 17 +- twilio/rest/studio/v2/flow/flow_revision.py | 30 +- twilio/rest/studio/v2/flow/flow_test_user.py | 36 +- twilio/rest/studio/v2/flow_validate.py | 8 + twilio/rest/supersim/v1/esim_profile.py | 38 +- twilio/rest/supersim/v1/fleet.py | 58 +- twilio/rest/supersim/v1/ip_command.py | 38 +- twilio/rest/supersim/v1/network.py | 30 +- .../v1/network_access_profile/__init__.py | 58 +- .../network_access_profile_network.py | 52 +- twilio/rest/supersim/v1/settings_update.py | 14 +- twilio/rest/supersim/v1/sim/__init__.py | 58 +- twilio/rest/supersim/v1/sim/billing_period.py | 14 +- twilio/rest/supersim/v1/sim/sim_ip_address.py | 14 +- twilio/rest/supersim/v1/sms_command.py | 38 +- twilio/rest/supersim/v1/usage_record.py | 14 +- twilio/rest/sync/v1/service/__init__.py | 72 +- .../rest/sync/v1/service/document/__init__.py | 84 +- .../service/document/document_permission.py | 64 +- .../sync/v1/service/sync_list/__init__.py | 72 +- .../v1/service/sync_list/sync_list_item.py | 74 +- .../service/sync_list/sync_list_permission.py | 64 +- .../rest/sync/v1/service/sync_map/__init__.py | 72 +- .../sync/v1/service/sync_map/sync_map_item.py | 74 +- .../service/sync_map/sync_map_permission.py | 64 +- .../sync/v1/service/sync_stream/__init__.py | 72 +- .../v1/service/sync_stream/stream_message.py | 8 + .../rest/taskrouter/v1/workspace/__init__.py | 72 +- .../rest/taskrouter/v1/workspace/activity.py | 72 +- twilio/rest/taskrouter/v1/workspace/event.py | 30 +- .../taskrouter/v1/workspace/task/__init__.py | 74 +- .../v1/workspace/task/reservation.py | 62 +- .../taskrouter/v1/workspace/task_channel.py | 72 +- .../v1/workspace/task_queue/__init__.py | 72 +- .../task_queue_bulk_real_time_statistics.py | 6 + .../task_queue_cumulative_statistics.py | 14 +- .../task_queue_real_time_statistics.py | 14 +- .../task_queue/task_queue_statistics.py | 14 +- .../task_queue/task_queues_statistics.py | 14 +- .../v1/workspace/worker/__init__.py | 74 +- .../v1/workspace/worker/reservation.py | 62 +- .../v1/workspace/worker/worker_channel.py | 50 +- .../v1/workspace/worker/worker_statistics.py | 14 +- .../worker/workers_cumulative_statistics.py | 14 +- .../worker/workers_real_time_statistics.py | 14 +- .../v1/workspace/worker/workers_statistics.py | 14 +- .../v1/workspace/workflow/__init__.py | 72 +- .../workflow_cumulative_statistics.py | 14 +- .../workflow/workflow_real_time_statistics.py | 14 +- .../workspace/workflow/workflow_statistics.py | 14 +- .../workspace_cumulative_statistics.py | 14 +- .../workspace_real_time_statistics.py | 14 +- .../v1/workspace/workspace_statistics.py | 14 +- twilio/rest/trunking/v1/trunk/__init__.py | 72 +- .../rest/trunking/v1/trunk/credential_list.py | 52 +- .../v1/trunk/ip_access_control_list.py | 52 +- .../rest/trunking/v1/trunk/origination_url.py | 72 +- twilio/rest/trunking/v1/trunk/phone_number.py | 52 +- twilio/rest/trunking/v1/trunk/recording.py | 36 +- .../rest/trusthub/v1/compliance_inquiries.py | 28 +- .../v1/compliance_registration_inquiries.py | 28 +- .../v1/compliance_tollfree_inquiries.py | 8 + .../trusthub/v1/customer_profiles/__init__.py | 72 +- ...er_profiles_channel_endpoint_assignment.py | 52 +- .../customer_profiles_entity_assignments.py | 52 +- .../customer_profiles_evaluations.py | 38 +- twilio/rest/trusthub/v1/end_user.py | 72 +- twilio/rest/trusthub/v1/end_user_type.py | 30 +- twilio/rest/trusthub/v1/policies.py | 30 +- .../rest/trusthub/v1/supporting_document.py | 72 +- .../trusthub/v1/supporting_document_type.py | 30 +- .../trusthub/v1/trust_products/__init__.py | 72 +- ...st_products_channel_endpoint_assignment.py | 52 +- .../trust_products_entity_assignments.py | 52 +- .../trust_products_evaluations.py | 38 +- twilio/rest/verify/v2/form.py | 17 +- twilio/rest/verify/v2/safelist.py | 38 +- twilio/rest/verify/v2/service/__init__.py | 72 +- twilio/rest/verify/v2/service/access_token.py | 24 +- .../rest/verify/v2/service/entity/__init__.py | 52 +- .../v2/service/entity/challenge/__init__.py | 58 +- .../service/entity/challenge/notification.py | 8 + .../rest/verify/v2/service/entity/factor.py | 64 +- .../verify/v2/service/entity/new_factor.py | 8 + .../v2/service/messaging_configuration.py | 72 +- .../verify/v2/service/rate_limit/__init__.py | 72 +- .../verify/v2/service/rate_limit/bucket.py | 72 +- twilio/rest/verify/v2/service/verification.py | 44 +- .../verify/v2/service/verification_check.py | 8 + twilio/rest/verify/v2/service/webhook.py | 72 +- twilio/rest/verify/v2/template.py | 14 +- twilio/rest/verify/v2/verification_attempt.py | 30 +- .../v2/verification_attempts_summary.py | 14 +- twilio/rest/video/v1/composition.py | 52 +- twilio/rest/video/v1/composition_hook.py | 72 +- twilio/rest/video/v1/composition_settings.py | 16 +- twilio/rest/video/v1/recording.py | 44 +- twilio/rest/video/v1/recording_settings.py | 16 +- twilio/rest/video/v1/room/__init__.py | 58 +- .../video/v1/room/participant/__init__.py | 50 +- .../video/v1/room/participant/anonymize.py | 16 +- .../v1/room/participant/published_track.py | 30 +- .../v1/room/participant/subscribe_rules.py | 12 + .../v1/room/participant/subscribed_track.py | 30 +- twilio/rest/video/v1/room/recording_rules.py | 12 + twilio/rest/video/v1/room/room_recording.py | 44 +- twilio/rest/voice/v1/archived_call.py | 15 +- twilio/rest/voice/v1/byoc_trunk.py | 72 +- .../voice/v1/connection_policy/__init__.py | 72 +- .../connection_policy_target.py | 72 +- .../bulk_country_update.py | 8 + .../dialing_permissions/country/__init__.py | 30 +- .../country/highrisk_special_prefix.py | 14 +- .../voice/v1/dialing_permissions/settings.py | 36 +- twilio/rest/voice/v1/ip_record.py | 72 +- twilio/rest/voice/v1/source_ip_mapping.py | 72 +- twilio/rest/wireless/v1/command.py | 52 +- twilio/rest/wireless/v1/rate_plan.py | 72 +- twilio/rest/wireless/v1/sim/__init__.py | 64 +- twilio/rest/wireless/v1/sim/data_session.py | 14 +- twilio/rest/wireless/v1/sim/usage_record.py | 14 +- twilio/rest/wireless/v1/usage_record.py | 14 +- 506 files changed, 20008 insertions(+), 5625 deletions(-) rename twilio/rest/iam/v1/{key.py => new_api_key.py} (84%) rename twilio/rest/numbers/v1/{porting_webhook_configuration_fetch.py => webhook.py} (77%) create mode 100644 twilio/rest/preview_iam/organizations/__init__.py create mode 100644 twilio/rest/preview_iam/organizations/account.py create mode 100644 twilio/rest/preview_iam/organizations/role_assignment.py create mode 100644 twilio/rest/preview_iam/organizations/user.py diff --git a/CHANGES.md b/CHANGES.md index aa224e00fd..3c59707068 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,13 @@ twilio-python Changelog Here you can see the full list of changes between each twilio-python release. +[2024-12-12] Version 9.4.0 +-------------------------- +**Library - Feature** +- [PR #825](https://github.com/twilio/twilio-python/pull/825): Docs update and examples for organization api uptake and public oauth. Thanks to [@AsabuHere](https://github.com/AsabuHere)! +- [PR #815](https://github.com/twilio/twilio-python/pull/815): Organizations Api uptake for twilio-python. Thanks to [@AsabuHere](https://github.com/AsabuHere)! + + [2024-12-05] Version 9.3.8 -------------------------- **Api** diff --git a/examples/organization_api.py b/examples/organization_api.py index f95df03c72..180f18c20b 100644 --- a/examples/organization_api.py +++ b/examples/organization_api.py @@ -18,10 +18,12 @@ def example(): """ self.client = Client( account_sid=ACCOUNT_SID, - credential_provider= OrgsCredentialProvider(CLIENT_ID,CLIENT_SECRET) + credential_provider=OrgsCredentialProvider(CLIENT_ID, CLIENT_SECRET), ) - accounts = self.client.preview_iam.organization(organization_sid=ORGS_SID).accounts.stream() + accounts = self.client.preview_iam.organization( + organization_sid=ORGS_SID + ).accounts.stream() for record in accounts: print(record) diff --git a/examples/public_oauth.py b/examples/public_oauth.py index a01d04a6c1..527961f4e3 100644 --- a/examples/public_oauth.py +++ b/examples/public_oauth.py @@ -19,7 +19,7 @@ def example(): """ self.client = Client( account_sid=ACCOUNT_SID, - credential_provider= ClientCredentialProvider(CLIENT_ID,CLIENT_SECRET) + credential_provider=ClientCredentialProvider(CLIENT_ID, CLIENT_SECRET), ) msg = self.client.messages.create( diff --git a/twilio/rest/__init__.py b/twilio/rest/__init__.py index 7874236a26..d727b2467e 100644 --- a/twilio/rest/__init__.py +++ b/twilio/rest/__init__.py @@ -24,6 +24,7 @@ from twilio.rest.events import Events from twilio.rest.flex_api import FlexApi from twilio.rest.frontline_api import FrontlineApi + from twilio.rest.preview_iam import PreviewIam from twilio.rest.iam import Iam from twilio.rest.insights import Insights from twilio.rest.intelligence import Intelligence @@ -96,7 +97,6 @@ def __init__( environment=None, edge=None, user_agent_extensions=None, - credential_provider=None, ): """ Initializes the Twilio Client @@ -122,7 +122,6 @@ def __init__( environment, edge, user_agent_extensions, - credential_provider, ) # Domains @@ -136,8 +135,8 @@ def __init__( self._events: Optional["Events"] = None self._flex_api: Optional["FlexApi"] = None self._frontline_api: Optional["FrontlineApi"] = None - self._iam: Optional["Iam"] = None self._preview_iam: Optional["PreviewIam"] = None + self._iam: Optional["Iam"] = None self._insights: Optional["Insights"] = None self._intelligence: Optional["Intelligence"] = None self._ip_messaging: Optional["IpMessaging"] = None @@ -150,7 +149,6 @@ def __init__( self._numbers: Optional["Numbers"] = None self._oauth: Optional["Oauth"] = None self._preview: Optional["Preview"] = None - self._preview_iam: Optional["PreviewIam"] = None self._pricing: Optional["Pricing"] = None self._proxy: Optional["Proxy"] = None self._routes: Optional["Routes"] = None @@ -296,6 +294,19 @@ def frontline_api(self) -> "FrontlineApi": self._frontline_api = FrontlineApi(self) return self._frontline_api + @property + def preview_iam(self) -> "PreviewIam": + """ + Access the PreviewIam Twilio Domain + + :returns: PreviewIam Twilio Domain + """ + if self._preview_iam is None: + from twilio.rest.preview_iam import PreviewIam + + self._preview_iam = PreviewIam(self) + return self._preview_iam + @property def iam(self) -> "Iam": """ @@ -400,19 +411,6 @@ def microvisor(self) -> "Microvisor": self._microvisor = Microvisor(self) return self._microvisor - @property - def preview_iam(self) -> "PreviewIam": - """ - Access the PreviewIam Twilio Domain - - :returns: PreviewIam Twilio Domain - """ - if self._preview_iam is None: - from twilio.rest.preview_iam import PreviewIam - - self._preview_iam = PreviewIam(self) - return self._preview_iam - @property def monitor(self) -> "Monitor": """ diff --git a/twilio/rest/accounts/v1/auth_token_promotion.py b/twilio/rest/accounts/v1/auth_token_promotion.py index 7ab6c3f39d..8580538a9b 100644 --- a/twilio/rest/accounts/v1/auth_token_promotion.py +++ b/twilio/rest/accounts/v1/auth_token_promotion.py @@ -106,12 +106,14 @@ def update(self) -> AuthTokenPromotionInstance: :returns: The updated AuthTokenPromotionInstance """ + data = values.of({}) + headers = values.of({}) + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AuthTokenPromotionInstance(self._version, payload) @@ -123,12 +125,14 @@ async def update_async(self) -> AuthTokenPromotionInstance: :returns: The updated AuthTokenPromotionInstance """ + data = values.of({}) + headers = values.of({}) + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AuthTokenPromotionInstance(self._version, payload) diff --git a/twilio/rest/accounts/v1/bulk_consents.py b/twilio/rest/accounts/v1/bulk_consents.py index 850d72162e..3e4564386b 100644 --- a/twilio/rest/accounts/v1/bulk_consents.py +++ b/twilio/rest/accounts/v1/bulk_consents.py @@ -69,6 +69,10 @@ def create(self, items: List[object]) -> BulkConsentsInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -91,6 +95,10 @@ async def create_async(self, items: List[object]) -> BulkConsentsInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/accounts/v1/bulk_contacts.py b/twilio/rest/accounts/v1/bulk_contacts.py index 0d68908e31..17b6da33f3 100644 --- a/twilio/rest/accounts/v1/bulk_contacts.py +++ b/twilio/rest/accounts/v1/bulk_contacts.py @@ -69,6 +69,10 @@ def create(self, items: List[object]) -> BulkContactsInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -91,6 +95,10 @@ async def create_async(self, items: List[object]) -> BulkContactsInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/accounts/v1/credential/aws.py b/twilio/rest/accounts/v1/credential/aws.py index 05d92755c4..ba5335accd 100644 --- a/twilio/rest/accounts/v1/credential/aws.py +++ b/twilio/rest/accounts/v1/credential/aws.py @@ -164,10 +164,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -176,9 +176,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> AwsInstance: @@ -189,10 +191,11 @@ def fetch(self) -> AwsInstance: :returns: The fetched AwsInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return AwsInstance( self._version, @@ -208,9 +211,12 @@ async def fetch_async(self) -> AwsInstance: :returns: The fetched AwsInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return AwsInstance( @@ -227,16 +233,20 @@ def update(self, friendly_name: Union[str, object] = values.unset) -> AwsInstanc :returns: The updated AwsInstance """ + data = values.of( { "FriendlyName": friendly_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AwsInstance(self._version, payload, sid=self._solution["sid"]) @@ -251,16 +261,20 @@ async def update_async( :returns: The updated AwsInstance """ + data = values.of( { "FriendlyName": friendly_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AwsInstance(self._version, payload, sid=self._solution["sid"]) @@ -332,6 +346,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -363,6 +381,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -496,7 +518,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return AwsPage(self._version, response) async def page_async( @@ -523,8 +551,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return AwsPage(self._version, response) diff --git a/twilio/rest/accounts/v1/credential/public_key.py b/twilio/rest/accounts/v1/credential/public_key.py index ec2a1f8660..c2b4f9bbee 100644 --- a/twilio/rest/accounts/v1/credential/public_key.py +++ b/twilio/rest/accounts/v1/credential/public_key.py @@ -166,10 +166,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -178,9 +178,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> PublicKeyInstance: @@ -191,10 +193,11 @@ def fetch(self) -> PublicKeyInstance: :returns: The fetched PublicKeyInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return PublicKeyInstance( self._version, @@ -210,9 +213,12 @@ async def fetch_async(self) -> PublicKeyInstance: :returns: The fetched PublicKeyInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return PublicKeyInstance( @@ -231,16 +237,20 @@ def update( :returns: The updated PublicKeyInstance """ + data = values.of( { "FriendlyName": friendly_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return PublicKeyInstance(self._version, payload, sid=self._solution["sid"]) @@ -255,16 +265,20 @@ async def update_async( :returns: The updated PublicKeyInstance """ + data = values.of( { "FriendlyName": friendly_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return PublicKeyInstance(self._version, payload, sid=self._solution["sid"]) @@ -336,6 +350,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -367,6 +385,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -500,7 +522,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return PublicKeyPage(self._version, response) async def page_async( @@ -527,8 +555,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return PublicKeyPage(self._version, response) diff --git a/twilio/rest/accounts/v1/safelist.py b/twilio/rest/accounts/v1/safelist.py index 51f00fd8ca..0bbbb32420 100644 --- a/twilio/rest/accounts/v1/safelist.py +++ b/twilio/rest/accounts/v1/safelist.py @@ -71,6 +71,10 @@ def create(self, phone_number: str) -> SafelistInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -93,6 +97,10 @@ async def create_async(self, phone_number: str) -> SafelistInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -148,6 +156,8 @@ def fetch( """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Accept"] = "application/json" + params = values.of( { "PhoneNumber": phone_number, @@ -171,6 +181,8 @@ async def fetch_async( """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Accept"] = "application/json" + params = values.of( { "PhoneNumber": phone_number, diff --git a/twilio/rest/accounts/v1/secondary_auth_token.py b/twilio/rest/accounts/v1/secondary_auth_token.py index 3735dd876a..f5e2b5c1a3 100644 --- a/twilio/rest/accounts/v1/secondary_auth_token.py +++ b/twilio/rest/accounts/v1/secondary_auth_token.py @@ -152,10 +152,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -164,9 +164,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def __repr__(self) -> str: diff --git a/twilio/rest/api/v2010/account/__init__.py b/twilio/rest/api/v2010/account/__init__.py index dc0c53c9c0..7c7e2c1069 100644 --- a/twilio/rest/api/v2010/account/__init__.py +++ b/twilio/rest/api/v2010/account/__init__.py @@ -398,10 +398,11 @@ def fetch(self) -> AccountInstance: :returns: The fetched AccountInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return AccountInstance( self._version, @@ -417,9 +418,12 @@ async def fetch_async(self) -> AccountInstance: :returns: The fetched AccountInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return AccountInstance( @@ -441,17 +445,21 @@ def update( :returns: The updated AccountInstance """ + data = values.of( { "FriendlyName": friendly_name, "Status": status, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AccountInstance(self._version, payload, sid=self._solution["sid"]) @@ -469,17 +477,21 @@ async def update_async( :returns: The updated AccountInstance """ + data = values.of( { "FriendlyName": friendly_name, "Status": status, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AccountInstance(self._version, payload, sid=self._solution["sid"]) @@ -832,6 +844,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -856,6 +872,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -1019,7 +1039,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return AccountPage(self._version, response) async def page_async( @@ -1052,8 +1078,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return AccountPage(self._version, response) diff --git a/twilio/rest/api/v2010/account/address/__init__.py b/twilio/rest/api/v2010/account/address/__init__.py index 36ee8f2231..b97628fe87 100644 --- a/twilio/rest/api/v2010/account/address/__init__.py +++ b/twilio/rest/api/v2010/account/address/__init__.py @@ -258,10 +258,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -270,9 +270,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> AddressInstance: @@ -283,10 +285,11 @@ def fetch(self) -> AddressInstance: :returns: The fetched AddressInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return AddressInstance( self._version, @@ -303,9 +306,12 @@ async def fetch_async(self) -> AddressInstance: :returns: The fetched AddressInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return AddressInstance( @@ -342,6 +348,7 @@ def update( :returns: The updated AddressInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -355,11 +362,14 @@ def update( "StreetSecondary": street_secondary, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AddressInstance( @@ -396,6 +406,7 @@ async def update_async( :returns: The updated AddressInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -409,11 +420,14 @@ async def update_async( "StreetSecondary": street_secondary, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AddressInstance( @@ -531,6 +545,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -585,6 +603,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -769,7 +791,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return AddressPage(self._version, response, self._solution) async def page_async( @@ -805,8 +833,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return AddressPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/address/dependent_phone_number.py b/twilio/rest/api/v2010/account/address/dependent_phone_number.py index 738f9baffd..504e69bc92 100644 --- a/twilio/rest/api/v2010/account/address/dependent_phone_number.py +++ b/twilio/rest/api/v2010/account/address/dependent_phone_number.py @@ -299,7 +299,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return DependentPhoneNumberPage(self._version, response, self._solution) async def page_async( @@ -326,8 +332,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return DependentPhoneNumberPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/application.py b/twilio/rest/api/v2010/account/application.py index d1e50c5f04..555ab72b4a 100644 --- a/twilio/rest/api/v2010/account/application.py +++ b/twilio/rest/api/v2010/account/application.py @@ -306,10 +306,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -318,9 +318,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> ApplicationInstance: @@ -331,10 +333,11 @@ def fetch(self) -> ApplicationInstance: :returns: The fetched ApplicationInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ApplicationInstance( self._version, @@ -351,9 +354,12 @@ async def fetch_async(self) -> ApplicationInstance: :returns: The fetched ApplicationInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ApplicationInstance( @@ -404,6 +410,7 @@ def update( :returns: The updated ApplicationInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -428,11 +435,14 @@ def update( ), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ApplicationInstance( @@ -483,6 +493,7 @@ async def update_async( :returns: The updated ApplicationInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -507,11 +518,14 @@ async def update_async( ), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ApplicationInstance( @@ -638,6 +652,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -714,6 +732,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -864,7 +886,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ApplicationPage(self._version, response, self._solution) async def page_async( @@ -894,8 +922,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ApplicationPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/authorized_connect_app.py b/twilio/rest/api/v2010/account/authorized_connect_app.py index 9359545cdb..cceb694c10 100644 --- a/twilio/rest/api/v2010/account/authorized_connect_app.py +++ b/twilio/rest/api/v2010/account/authorized_connect_app.py @@ -145,10 +145,11 @@ def fetch(self) -> AuthorizedConnectAppInstance: :returns: The fetched AuthorizedConnectAppInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return AuthorizedConnectAppInstance( self._version, @@ -165,9 +166,12 @@ async def fetch_async(self) -> AuthorizedConnectAppInstance: :returns: The fetched AuthorizedConnectAppInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return AuthorizedConnectAppInstance( @@ -355,7 +359,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return AuthorizedConnectAppPage(self._version, response, self._solution) async def page_async( @@ -382,8 +392,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return AuthorizedConnectAppPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/available_phone_number_country/__init__.py b/twilio/rest/api/v2010/account/available_phone_number_country/__init__.py index 14fcfc28df..fc2a6f0600 100644 --- a/twilio/rest/api/v2010/account/available_phone_number_country/__init__.py +++ b/twilio/rest/api/v2010/account/available_phone_number_country/__init__.py @@ -204,10 +204,11 @@ def fetch(self) -> AvailablePhoneNumberCountryInstance: :returns: The fetched AvailablePhoneNumberCountryInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return AvailablePhoneNumberCountryInstance( self._version, @@ -224,9 +225,12 @@ async def fetch_async(self) -> AvailablePhoneNumberCountryInstance: :returns: The fetched AvailablePhoneNumberCountryInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return AvailablePhoneNumberCountryInstance( @@ -509,7 +513,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return AvailablePhoneNumberCountryPage(self._version, response, self._solution) async def page_async( @@ -536,8 +546,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return AvailablePhoneNumberCountryPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/available_phone_number_country/local.py b/twilio/rest/api/v2010/account/available_phone_number_country/local.py index 43118d9f72..4f0b2e7991 100644 --- a/twilio/rest/api/v2010/account/available_phone_number_country/local.py +++ b/twilio/rest/api/v2010/account/available_phone_number_country/local.py @@ -529,7 +529,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return LocalPage(self._version, response, self._solution) async def page_async( @@ -616,8 +622,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return LocalPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/available_phone_number_country/machine_to_machine.py b/twilio/rest/api/v2010/account/available_phone_number_country/machine_to_machine.py index ee94aa944e..5695c917c3 100644 --- a/twilio/rest/api/v2010/account/available_phone_number_country/machine_to_machine.py +++ b/twilio/rest/api/v2010/account/available_phone_number_country/machine_to_machine.py @@ -529,7 +529,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return MachineToMachinePage(self._version, response, self._solution) async def page_async( @@ -616,8 +622,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return MachineToMachinePage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/available_phone_number_country/mobile.py b/twilio/rest/api/v2010/account/available_phone_number_country/mobile.py index 622d2b8597..2382155ee5 100644 --- a/twilio/rest/api/v2010/account/available_phone_number_country/mobile.py +++ b/twilio/rest/api/v2010/account/available_phone_number_country/mobile.py @@ -529,7 +529,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return MobilePage(self._version, response, self._solution) async def page_async( @@ -616,8 +622,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return MobilePage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/available_phone_number_country/national.py b/twilio/rest/api/v2010/account/available_phone_number_country/national.py index d0f3a63dda..a5e926425a 100644 --- a/twilio/rest/api/v2010/account/available_phone_number_country/national.py +++ b/twilio/rest/api/v2010/account/available_phone_number_country/national.py @@ -529,7 +529,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return NationalPage(self._version, response, self._solution) async def page_async( @@ -616,8 +622,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return NationalPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/available_phone_number_country/shared_cost.py b/twilio/rest/api/v2010/account/available_phone_number_country/shared_cost.py index 7b5b9b11c8..3a9c02bab4 100644 --- a/twilio/rest/api/v2010/account/available_phone_number_country/shared_cost.py +++ b/twilio/rest/api/v2010/account/available_phone_number_country/shared_cost.py @@ -529,7 +529,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return SharedCostPage(self._version, response, self._solution) async def page_async( @@ -616,8 +622,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return SharedCostPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/available_phone_number_country/toll_free.py b/twilio/rest/api/v2010/account/available_phone_number_country/toll_free.py index 4368018001..de4a2d9885 100644 --- a/twilio/rest/api/v2010/account/available_phone_number_country/toll_free.py +++ b/twilio/rest/api/v2010/account/available_phone_number_country/toll_free.py @@ -529,7 +529,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return TollFreePage(self._version, response, self._solution) async def page_async( @@ -616,8 +622,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return TollFreePage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/available_phone_number_country/voip.py b/twilio/rest/api/v2010/account/available_phone_number_country/voip.py index e0615d5a6e..9ebfae5396 100644 --- a/twilio/rest/api/v2010/account/available_phone_number_country/voip.py +++ b/twilio/rest/api/v2010/account/available_phone_number_country/voip.py @@ -529,7 +529,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return VoipPage(self._version, response, self._solution) async def page_async( @@ -616,8 +622,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return VoipPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/balance.py b/twilio/rest/api/v2010/account/balance.py index 97c7b33035..66bb91e9f9 100644 --- a/twilio/rest/api/v2010/account/balance.py +++ b/twilio/rest/api/v2010/account/balance.py @@ -75,6 +75,8 @@ def fetch(self) -> BalanceInstance: """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Accept"] = "application/json" + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return BalanceInstance( @@ -90,6 +92,8 @@ async def fetch_async(self) -> BalanceInstance: """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( method="GET", uri=self._uri, headers=headers ) diff --git a/twilio/rest/api/v2010/account/call/__init__.py b/twilio/rest/api/v2010/account/call/__init__.py index ff9e98b09f..b09550c326 100644 --- a/twilio/rest/api/v2010/account/call/__init__.py +++ b/twilio/rest/api/v2010/account/call/__init__.py @@ -373,10 +373,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -385,9 +385,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> CallInstance: @@ -398,10 +400,11 @@ def fetch(self) -> CallInstance: :returns: The fetched CallInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return CallInstance( self._version, @@ -418,9 +421,12 @@ async def fetch_async(self) -> CallInstance: :returns: The fetched CallInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return CallInstance( @@ -457,6 +463,7 @@ def update( :returns: The updated CallInstance """ + data = values.of( { "Url": url, @@ -470,11 +477,14 @@ def update( "TimeLimit": time_limit, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CallInstance( @@ -511,6 +521,7 @@ async def update_async( :returns: The updated CallInstance """ + data = values.of( { "Url": url, @@ -524,11 +535,14 @@ async def update_async( "TimeLimit": time_limit, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CallInstance( @@ -831,6 +845,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -964,6 +982,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -1253,7 +1275,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return CallPage(self._version, response, self._solution) async def page_async( @@ -1310,8 +1338,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return CallPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/call/event.py b/twilio/rest/api/v2010/account/call/event.py index 7993dd00a0..80eb8aa8ba 100644 --- a/twilio/rest/api/v2010/account/call/event.py +++ b/twilio/rest/api/v2010/account/call/event.py @@ -223,7 +223,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return EventPage(self._version, response, self._solution) async def page_async( @@ -250,8 +256,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return EventPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/call/notification.py b/twilio/rest/api/v2010/account/call/notification.py index 44291b8448..fd9e8c0d00 100644 --- a/twilio/rest/api/v2010/account/call/notification.py +++ b/twilio/rest/api/v2010/account/call/notification.py @@ -162,10 +162,11 @@ def fetch(self) -> NotificationInstance: :returns: The fetched NotificationInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return NotificationInstance( self._version, @@ -183,9 +184,12 @@ async def fetch_async(self) -> NotificationInstance: :returns: The fetched NotificationInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return NotificationInstance( @@ -445,7 +449,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return NotificationPage(self._version, response, self._solution) async def page_async( @@ -484,8 +494,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return NotificationPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/call/payment.py b/twilio/rest/api/v2010/account/call/payment.py index 00f76be814..0f91860987 100644 --- a/twilio/rest/api/v2010/account/call/payment.py +++ b/twilio/rest/api/v2010/account/call/payment.py @@ -203,6 +203,7 @@ def update( :returns: The updated PaymentInstance """ + data = values.of( { "IdempotencyKey": idempotency_key, @@ -211,11 +212,14 @@ def update( "Status": status, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return PaymentInstance( @@ -243,6 +247,7 @@ async def update_async( :returns: The updated PaymentInstance """ + data = values.of( { "IdempotencyKey": idempotency_key, @@ -251,11 +256,14 @@ async def update_async( "Status": status, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return PaymentInstance( @@ -364,6 +372,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -441,6 +453,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/api/v2010/account/call/recording.py b/twilio/rest/api/v2010/account/call/recording.py index 71158a2fe8..5b93ec6c95 100644 --- a/twilio/rest/api/v2010/account/call/recording.py +++ b/twilio/rest/api/v2010/account/call/recording.py @@ -237,10 +237,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -249,9 +249,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> RecordingInstance: @@ -262,10 +264,11 @@ def fetch(self) -> RecordingInstance: :returns: The fetched RecordingInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return RecordingInstance( self._version, @@ -283,9 +286,12 @@ async def fetch_async(self) -> RecordingInstance: :returns: The fetched RecordingInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return RecordingInstance( @@ -309,17 +315,21 @@ def update( :returns: The updated RecordingInstance """ + data = values.of( { "Status": status, "PauseBehavior": pause_behavior, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RecordingInstance( @@ -343,17 +353,21 @@ async def update_async( :returns: The updated RecordingInstance """ + data = values.of( { "Status": status, "PauseBehavior": pause_behavior, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RecordingInstance( @@ -456,6 +470,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -503,6 +521,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -690,7 +712,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return RecordingPage(self._version, response, self._solution) async def page_async( @@ -726,8 +754,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return RecordingPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/call/siprec.py b/twilio/rest/api/v2010/account/call/siprec.py index 28a0734e19..d808331c64 100644 --- a/twilio/rest/api/v2010/account/call/siprec.py +++ b/twilio/rest/api/v2010/account/call/siprec.py @@ -156,16 +156,20 @@ def update(self, status: "SiprecInstance.UpdateStatus") -> SiprecInstance: :returns: The updated SiprecInstance """ + data = values.of( { "Status": status, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SiprecInstance( @@ -186,16 +190,20 @@ async def update_async( :returns: The updated SiprecInstance """ + data = values.of( { "Status": status, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SiprecInstance( @@ -863,6 +871,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -1499,6 +1511,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/api/v2010/account/call/stream.py b/twilio/rest/api/v2010/account/call/stream.py index b3fa197bf8..1a506e6684 100644 --- a/twilio/rest/api/v2010/account/call/stream.py +++ b/twilio/rest/api/v2010/account/call/stream.py @@ -158,16 +158,20 @@ def update(self, status: "StreamInstance.UpdateStatus") -> StreamInstance: :returns: The updated StreamInstance """ + data = values.of( { "Status": status, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return StreamInstance( @@ -188,16 +192,20 @@ async def update_async( :returns: The updated StreamInstance """ + data = values.of( { "Status": status, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return StreamInstance( @@ -865,6 +873,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -1501,6 +1513,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/api/v2010/account/call/transcription.py b/twilio/rest/api/v2010/account/call/transcription.py index c649b8ad1b..f415928cc8 100644 --- a/twilio/rest/api/v2010/account/call/transcription.py +++ b/twilio/rest/api/v2010/account/call/transcription.py @@ -162,16 +162,20 @@ def update( :returns: The updated TranscriptionInstance """ + data = values.of( { "Status": status, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return TranscriptionInstance( @@ -192,16 +196,20 @@ async def update_async( :returns: The updated TranscriptionInstance """ + data = values.of( { "Status": status, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return TranscriptionInstance( @@ -306,6 +314,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -377,6 +389,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/api/v2010/account/call/user_defined_message.py b/twilio/rest/api/v2010/account/call/user_defined_message.py index 4b43383711..bc66f8b8e1 100644 --- a/twilio/rest/api/v2010/account/call/user_defined_message.py +++ b/twilio/rest/api/v2010/account/call/user_defined_message.py @@ -100,6 +100,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -131,6 +135,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/api/v2010/account/call/user_defined_message_subscription.py b/twilio/rest/api/v2010/account/call/user_defined_message_subscription.py index 677042bd7c..66923d4b79 100644 --- a/twilio/rest/api/v2010/account/call/user_defined_message_subscription.py +++ b/twilio/rest/api/v2010/account/call/user_defined_message_subscription.py @@ -132,10 +132,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -144,9 +144,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def __repr__(self) -> str: @@ -208,6 +210,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -244,6 +250,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/api/v2010/account/conference/__init__.py b/twilio/rest/api/v2010/account/conference/__init__.py index 074ce8a587..1ff3289a6c 100644 --- a/twilio/rest/api/v2010/account/conference/__init__.py +++ b/twilio/rest/api/v2010/account/conference/__init__.py @@ -230,10 +230,11 @@ def fetch(self) -> ConferenceInstance: :returns: The fetched ConferenceInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ConferenceInstance( self._version, @@ -250,9 +251,12 @@ async def fetch_async(self) -> ConferenceInstance: :returns: The fetched ConferenceInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ConferenceInstance( @@ -277,6 +281,7 @@ def update( :returns: The updated ConferenceInstance """ + data = values.of( { "Status": status, @@ -284,11 +289,14 @@ def update( "AnnounceMethod": announce_method, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ConferenceInstance( @@ -313,6 +321,7 @@ async def update_async( :returns: The updated ConferenceInstance """ + data = values.of( { "Status": status, @@ -320,11 +329,14 @@ async def update_async( "AnnounceMethod": announce_method, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ConferenceInstance( @@ -660,7 +672,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ConferencePage(self._version, response, self._solution) async def page_async( @@ -711,8 +729,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ConferencePage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/conference/participant.py b/twilio/rest/api/v2010/account/conference/participant.py index 3706cd24fa..a93f9f9adc 100644 --- a/twilio/rest/api/v2010/account/conference/participant.py +++ b/twilio/rest/api/v2010/account/conference/participant.py @@ -282,10 +282,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -294,9 +294,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> ParticipantInstance: @@ -307,10 +309,11 @@ def fetch(self) -> ParticipantInstance: :returns: The fetched ParticipantInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ParticipantInstance( self._version, @@ -328,9 +331,12 @@ async def fetch_async(self) -> ParticipantInstance: :returns: The fetched ParticipantInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ParticipantInstance( @@ -374,6 +380,7 @@ def update( :returns: The updated ParticipantInstance """ + data = values.of( { "Muted": serialize.boolean_to_string(muted), @@ -392,11 +399,14 @@ def update( "CallSidToCoach": call_sid_to_coach, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ParticipantInstance( @@ -440,6 +450,7 @@ async def update_async( :returns: The updated ParticipantInstance """ + data = values.of( { "Muted": serialize.boolean_to_string(muted), @@ -458,11 +469,14 @@ async def update_async( "CallSidToCoach": call_sid_to_coach, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ParticipantInstance( @@ -703,6 +717,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -888,6 +906,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -1069,7 +1091,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ParticipantPage(self._version, response, self._solution) async def page_async( @@ -1105,8 +1133,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ParticipantPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/conference/recording.py b/twilio/rest/api/v2010/account/conference/recording.py index dfb1d406ee..12008ed37f 100644 --- a/twilio/rest/api/v2010/account/conference/recording.py +++ b/twilio/rest/api/v2010/account/conference/recording.py @@ -235,10 +235,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -247,9 +247,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> RecordingInstance: @@ -260,10 +262,11 @@ def fetch(self) -> RecordingInstance: :returns: The fetched RecordingInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return RecordingInstance( self._version, @@ -281,9 +284,12 @@ async def fetch_async(self) -> RecordingInstance: :returns: The fetched RecordingInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return RecordingInstance( @@ -307,17 +313,21 @@ def update( :returns: The updated RecordingInstance """ + data = values.of( { "Status": status, "PauseBehavior": pause_behavior, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RecordingInstance( @@ -341,17 +351,21 @@ async def update_async( :returns: The updated RecordingInstance """ + data = values.of( { "Status": status, "PauseBehavior": pause_behavior, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RecordingInstance( @@ -594,7 +608,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return RecordingPage(self._version, response, self._solution) async def page_async( @@ -630,8 +650,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return RecordingPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/connect_app.py b/twilio/rest/api/v2010/account/connect_app.py index 722e4e9b3e..689a2b184a 100644 --- a/twilio/rest/api/v2010/account/connect_app.py +++ b/twilio/rest/api/v2010/account/connect_app.py @@ -242,10 +242,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -254,9 +254,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> ConnectAppInstance: @@ -267,10 +269,11 @@ def fetch(self) -> ConnectAppInstance: :returns: The fetched ConnectAppInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ConnectAppInstance( self._version, @@ -287,9 +290,12 @@ async def fetch_async(self) -> ConnectAppInstance: :returns: The fetched ConnectAppInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ConnectAppInstance( @@ -326,6 +332,7 @@ def update( :returns: The updated ConnectAppInstance """ + data = values.of( { "AuthorizeRedirectUrl": authorize_redirect_url, @@ -338,11 +345,14 @@ def update( "Permissions": serialize.map(permissions, lambda e: e), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ConnectAppInstance( @@ -379,6 +389,7 @@ async def update_async( :returns: The updated ConnectAppInstance """ + data = values.of( { "AuthorizeRedirectUrl": authorize_redirect_url, @@ -391,11 +402,14 @@ async def update_async( "Permissions": serialize.map(permissions, lambda e: e), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ConnectAppInstance( @@ -581,7 +595,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ConnectAppPage(self._version, response, self._solution) async def page_async( @@ -608,8 +628,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ConnectAppPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/__init__.py b/twilio/rest/api/v2010/account/incoming_phone_number/__init__.py index d1001a7cae..c7c1eebcfd 100644 --- a/twilio/rest/api/v2010/account/incoming_phone_number/__init__.py +++ b/twilio/rest/api/v2010/account/incoming_phone_number/__init__.py @@ -424,10 +424,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -436,9 +436,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> IncomingPhoneNumberInstance: @@ -449,10 +451,11 @@ def fetch(self) -> IncomingPhoneNumberInstance: :returns: The fetched IncomingPhoneNumberInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return IncomingPhoneNumberInstance( self._version, @@ -469,9 +472,12 @@ async def fetch_async(self) -> IncomingPhoneNumberInstance: :returns: The fetched IncomingPhoneNumberInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return IncomingPhoneNumberInstance( @@ -540,6 +546,7 @@ def update( :returns: The updated IncomingPhoneNumberInstance """ + data = values.of( { "AccountSid": account_sid, @@ -569,11 +576,14 @@ def update( "BundleSid": bundle_sid, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return IncomingPhoneNumberInstance( @@ -642,6 +652,7 @@ async def update_async( :returns: The updated IncomingPhoneNumberInstance """ + data = values.of( { "AccountSid": account_sid, @@ -671,11 +682,14 @@ async def update_async( "BundleSid": bundle_sid, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return IncomingPhoneNumberInstance( @@ -847,6 +861,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -949,6 +967,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -1148,7 +1170,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return IncomingPhoneNumberPage(self._version, response, self._solution) async def page_async( @@ -1187,8 +1215,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return IncomingPhoneNumberPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/__init__.py b/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/__init__.py index a6ced82856..52fe2a52af 100644 --- a/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/__init__.py +++ b/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/__init__.py @@ -177,10 +177,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -189,9 +189,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> AssignedAddOnInstance: @@ -202,10 +204,11 @@ def fetch(self) -> AssignedAddOnInstance: :returns: The fetched AssignedAddOnInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return AssignedAddOnInstance( self._version, @@ -223,9 +226,12 @@ async def fetch_async(self) -> AssignedAddOnInstance: :returns: The fetched AssignedAddOnInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return AssignedAddOnInstance( @@ -322,6 +328,10 @@ def create(self, installed_add_on_sid: str) -> AssignedAddOnInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -349,6 +359,10 @@ async def create_async(self, installed_add_on_sid: str) -> AssignedAddOnInstance ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -487,7 +501,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return AssignedAddOnPage(self._version, response, self._solution) async def page_async( @@ -514,8 +534,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return AssignedAddOnPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/assigned_add_on_extension.py b/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/assigned_add_on_extension.py index 18504cafd8..1a7d9cdc34 100644 --- a/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/assigned_add_on_extension.py +++ b/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/assigned_add_on_extension.py @@ -149,10 +149,11 @@ def fetch(self) -> AssignedAddOnExtensionInstance: :returns: The fetched AssignedAddOnExtensionInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return AssignedAddOnExtensionInstance( self._version, @@ -171,9 +172,12 @@ async def fetch_async(self) -> AssignedAddOnExtensionInstance: :returns: The fetched AssignedAddOnExtensionInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return AssignedAddOnExtensionInstance( @@ -377,7 +381,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return AssignedAddOnExtensionPage(self._version, response, self._solution) async def page_async( @@ -404,8 +414,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return AssignedAddOnExtensionPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/local.py b/twilio/rest/api/v2010/account/incoming_phone_number/local.py index ca7baa8552..af67fb0a2d 100644 --- a/twilio/rest/api/v2010/account/incoming_phone_number/local.py +++ b/twilio/rest/api/v2010/account/incoming_phone_number/local.py @@ -281,6 +281,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -378,6 +382,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -577,7 +585,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return LocalPage(self._version, response, self._solution) async def page_async( @@ -616,8 +630,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return LocalPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/mobile.py b/twilio/rest/api/v2010/account/incoming_phone_number/mobile.py index 830897b178..27fc8a0e9f 100644 --- a/twilio/rest/api/v2010/account/incoming_phone_number/mobile.py +++ b/twilio/rest/api/v2010/account/incoming_phone_number/mobile.py @@ -283,6 +283,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -382,6 +386,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -581,7 +589,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return MobilePage(self._version, response, self._solution) async def page_async( @@ -620,8 +634,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return MobilePage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/toll_free.py b/twilio/rest/api/v2010/account/incoming_phone_number/toll_free.py index 8625e318c6..86290ff9b2 100644 --- a/twilio/rest/api/v2010/account/incoming_phone_number/toll_free.py +++ b/twilio/rest/api/v2010/account/incoming_phone_number/toll_free.py @@ -283,6 +283,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -382,6 +386,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -581,7 +589,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return TollFreePage(self._version, response, self._solution) async def page_async( @@ -620,8 +634,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return TollFreePage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/key.py b/twilio/rest/api/v2010/account/key.py index 68a9feb0e1..8b18dbd4ba 100644 --- a/twilio/rest/api/v2010/account/key.py +++ b/twilio/rest/api/v2010/account/key.py @@ -168,10 +168,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -180,9 +180,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> KeyInstance: @@ -193,10 +195,11 @@ def fetch(self) -> KeyInstance: :returns: The fetched KeyInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return KeyInstance( self._version, @@ -213,9 +216,12 @@ async def fetch_async(self) -> KeyInstance: :returns: The fetched KeyInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return KeyInstance( @@ -233,16 +239,20 @@ def update(self, friendly_name: Union[str, object] = values.unset) -> KeyInstanc :returns: The updated KeyInstance """ + data = values.of( { "FriendlyName": friendly_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return KeyInstance( @@ -262,16 +272,20 @@ async def update_async( :returns: The updated KeyInstance """ + data = values.of( { "FriendlyName": friendly_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return KeyInstance( @@ -457,7 +471,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return KeyPage(self._version, response, self._solution) async def page_async( @@ -484,8 +504,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return KeyPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/message/__init__.py b/twilio/rest/api/v2010/account/message/__init__.py index 1b6d3aea81..f41c1c5ad7 100644 --- a/twilio/rest/api/v2010/account/message/__init__.py +++ b/twilio/rest/api/v2010/account/message/__init__.py @@ -275,10 +275,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -287,9 +287,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> MessageInstance: @@ -300,10 +302,11 @@ def fetch(self) -> MessageInstance: :returns: The fetched MessageInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return MessageInstance( self._version, @@ -320,9 +323,12 @@ async def fetch_async(self) -> MessageInstance: :returns: The fetched MessageInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return MessageInstance( @@ -345,17 +351,21 @@ def update( :returns: The updated MessageInstance """ + data = values.of( { "Body": body, "Status": status, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return MessageInstance( @@ -378,17 +388,21 @@ async def update_async( :returns: The updated MessageInstance """ + data = values.of( { "Body": body, "Status": status, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return MessageInstance( @@ -562,6 +576,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -659,6 +677,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -873,7 +895,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return MessagePage(self._version, response, self._solution) async def page_async( @@ -915,8 +943,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return MessagePage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/message/feedback.py b/twilio/rest/api/v2010/account/message/feedback.py index 797c9a7331..cda2de2ff6 100644 --- a/twilio/rest/api/v2010/account/message/feedback.py +++ b/twilio/rest/api/v2010/account/message/feedback.py @@ -113,6 +113,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -142,6 +146,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/api/v2010/account/message/media.py b/twilio/rest/api/v2010/account/message/media.py index 4068d0c35d..b5d2926d12 100644 --- a/twilio/rest/api/v2010/account/message/media.py +++ b/twilio/rest/api/v2010/account/message/media.py @@ -157,10 +157,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -169,9 +169,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> MediaInstance: @@ -182,10 +184,11 @@ def fetch(self) -> MediaInstance: :returns: The fetched MediaInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return MediaInstance( self._version, @@ -203,9 +206,12 @@ async def fetch_async(self) -> MediaInstance: :returns: The fetched MediaInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return MediaInstance( @@ -448,7 +454,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return MediaPage(self._version, response, self._solution) async def page_async( @@ -484,8 +496,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return MediaPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/new_key.py b/twilio/rest/api/v2010/account/new_key.py index fcefed5b62..ba811ec14f 100644 --- a/twilio/rest/api/v2010/account/new_key.py +++ b/twilio/rest/api/v2010/account/new_key.py @@ -93,6 +93,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -119,6 +123,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/api/v2010/account/new_signing_key.py b/twilio/rest/api/v2010/account/new_signing_key.py index bb9b0f2e2d..95341d31cb 100644 --- a/twilio/rest/api/v2010/account/new_signing_key.py +++ b/twilio/rest/api/v2010/account/new_signing_key.py @@ -93,6 +93,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -119,6 +123,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/api/v2010/account/notification.py b/twilio/rest/api/v2010/account/notification.py index 0a2e13da35..cd35efeabf 100644 --- a/twilio/rest/api/v2010/account/notification.py +++ b/twilio/rest/api/v2010/account/notification.py @@ -155,10 +155,11 @@ def fetch(self) -> NotificationInstance: :returns: The fetched NotificationInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return NotificationInstance( self._version, @@ -175,9 +176,12 @@ async def fetch_async(self) -> NotificationInstance: :returns: The fetched NotificationInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return NotificationInstance( @@ -429,7 +433,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return NotificationPage(self._version, response, self._solution) async def page_async( @@ -468,8 +478,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return NotificationPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/outgoing_caller_id.py b/twilio/rest/api/v2010/account/outgoing_caller_id.py index 65ddfa1cdb..eeb9954c75 100644 --- a/twilio/rest/api/v2010/account/outgoing_caller_id.py +++ b/twilio/rest/api/v2010/account/outgoing_caller_id.py @@ -178,10 +178,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -190,9 +190,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> OutgoingCallerIdInstance: @@ -203,10 +205,11 @@ def fetch(self) -> OutgoingCallerIdInstance: :returns: The fetched OutgoingCallerIdInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return OutgoingCallerIdInstance( self._version, @@ -223,9 +226,12 @@ async def fetch_async(self) -> OutgoingCallerIdInstance: :returns: The fetched OutgoingCallerIdInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return OutgoingCallerIdInstance( @@ -245,16 +251,20 @@ def update( :returns: The updated OutgoingCallerIdInstance """ + data = values.of( { "FriendlyName": friendly_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return OutgoingCallerIdInstance( @@ -274,16 +284,20 @@ async def update_async( :returns: The updated OutgoingCallerIdInstance """ + data = values.of( { "FriendlyName": friendly_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return OutgoingCallerIdInstance( @@ -505,7 +519,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return OutgoingCallerIdPage(self._version, response, self._solution) async def page_async( @@ -538,8 +558,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return OutgoingCallerIdPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/queue/__init__.py b/twilio/rest/api/v2010/account/queue/__init__.py index 4031ba8196..e76fda1259 100644 --- a/twilio/rest/api/v2010/account/queue/__init__.py +++ b/twilio/rest/api/v2010/account/queue/__init__.py @@ -202,10 +202,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -214,9 +214,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> QueueInstance: @@ -227,10 +229,11 @@ def fetch(self) -> QueueInstance: :returns: The fetched QueueInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return QueueInstance( self._version, @@ -247,9 +250,12 @@ async def fetch_async(self) -> QueueInstance: :returns: The fetched QueueInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return QueueInstance( @@ -272,17 +278,21 @@ def update( :returns: The updated QueueInstance """ + data = values.of( { "FriendlyName": friendly_name, "MaxSize": max_size, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return QueueInstance( @@ -305,17 +315,21 @@ async def update_async( :returns: The updated QueueInstance """ + data = values.of( { "FriendlyName": friendly_name, "MaxSize": max_size, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return QueueInstance( @@ -407,6 +421,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -435,6 +453,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -570,7 +592,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return QueuePage(self._version, response, self._solution) async def page_async( @@ -597,8 +625,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return QueuePage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/queue/member.py b/twilio/rest/api/v2010/account/queue/member.py index bf092ff283..30ff4abbc7 100644 --- a/twilio/rest/api/v2010/account/queue/member.py +++ b/twilio/rest/api/v2010/account/queue/member.py @@ -170,10 +170,11 @@ def fetch(self) -> MemberInstance: :returns: The fetched MemberInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return MemberInstance( self._version, @@ -191,9 +192,12 @@ async def fetch_async(self) -> MemberInstance: :returns: The fetched MemberInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return MemberInstance( @@ -215,17 +219,21 @@ def update( :returns: The updated MemberInstance """ + data = values.of( { "Url": url, "Method": method, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return MemberInstance( @@ -247,17 +255,21 @@ async def update_async( :returns: The updated MemberInstance """ + data = values.of( { "Url": url, "Method": method, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return MemberInstance( @@ -451,7 +463,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return MemberPage(self._version, response, self._solution) async def page_async( @@ -478,8 +496,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return MemberPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/recording/__init__.py b/twilio/rest/api/v2010/account/recording/__init__.py index 1766600ec3..ab5c1c8b7b 100644 --- a/twilio/rest/api/v2010/account/recording/__init__.py +++ b/twilio/rest/api/v2010/account/recording/__init__.py @@ -228,10 +228,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -240,9 +240,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch( @@ -262,7 +264,13 @@ def fetch( } ) - payload = self._version.fetch(method="GET", uri=self._uri, params=data) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch( + method="GET", uri=self._uri, params=data, headers=headers + ) return RecordingInstance( self._version, @@ -288,8 +296,12 @@ async def fetch_async( } ) + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return RecordingInstance( @@ -595,7 +607,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return RecordingPage(self._version, response, self._solution) async def page_async( @@ -640,8 +658,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return RecordingPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/recording/add_on_result/__init__.py b/twilio/rest/api/v2010/account/recording/add_on_result/__init__.py index af1e75f4c6..95296f3cc4 100644 --- a/twilio/rest/api/v2010/account/recording/add_on_result/__init__.py +++ b/twilio/rest/api/v2010/account/recording/add_on_result/__init__.py @@ -190,10 +190,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -202,9 +202,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> AddOnResultInstance: @@ -215,10 +217,11 @@ def fetch(self) -> AddOnResultInstance: :returns: The fetched AddOnResultInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return AddOnResultInstance( self._version, @@ -236,9 +239,12 @@ async def fetch_async(self) -> AddOnResultInstance: :returns: The fetched AddOnResultInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return AddOnResultInstance( @@ -446,7 +452,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return AddOnResultPage(self._version, response, self._solution) async def page_async( @@ -473,8 +485,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return AddOnResultPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/recording/add_on_result/payload/__init__.py b/twilio/rest/api/v2010/account/recording/add_on_result/payload/__init__.py index 9008f6a688..08e6ea2109 100644 --- a/twilio/rest/api/v2010/account/recording/add_on_result/payload/__init__.py +++ b/twilio/rest/api/v2010/account/recording/add_on_result/payload/__init__.py @@ -189,10 +189,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -201,9 +201,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> PayloadInstance: @@ -214,10 +216,11 @@ def fetch(self) -> PayloadInstance: :returns: The fetched PayloadInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return PayloadInstance( self._version, @@ -236,9 +239,12 @@ async def fetch_async(self) -> PayloadInstance: :returns: The fetched PayloadInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return PayloadInstance( @@ -457,7 +463,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return PayloadPage(self._version, response, self._solution) async def page_async( @@ -484,8 +496,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return PayloadPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/recording/add_on_result/payload/data.py b/twilio/rest/api/v2010/account/recording/add_on_result/payload/data.py index 1cc931a693..48567badca 100644 --- a/twilio/rest/api/v2010/account/recording/add_on_result/payload/data.py +++ b/twilio/rest/api/v2010/account/recording/add_on_result/payload/data.py @@ -13,6 +13,7 @@ """ from typing import Any, Dict, Optional +from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -131,10 +132,11 @@ def fetch(self) -> DataInstance: :returns: The fetched DataInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return DataInstance( self._version, @@ -153,9 +155,12 @@ async def fetch_async(self) -> DataInstance: :returns: The fetched DataInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return DataInstance( diff --git a/twilio/rest/api/v2010/account/recording/transcription.py b/twilio/rest/api/v2010/account/recording/transcription.py index bb6e0e405a..472f5b2bff 100644 --- a/twilio/rest/api/v2010/account/recording/transcription.py +++ b/twilio/rest/api/v2010/account/recording/transcription.py @@ -175,10 +175,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -187,9 +187,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> TranscriptionInstance: @@ -200,10 +202,11 @@ def fetch(self) -> TranscriptionInstance: :returns: The fetched TranscriptionInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return TranscriptionInstance( self._version, @@ -221,9 +224,12 @@ async def fetch_async(self) -> TranscriptionInstance: :returns: The fetched TranscriptionInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return TranscriptionInstance( @@ -417,7 +423,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return TranscriptionPage(self._version, response, self._solution) async def page_async( @@ -444,8 +456,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return TranscriptionPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/short_code.py b/twilio/rest/api/v2010/account/short_code.py index 2af049a20b..eae35c4aa5 100644 --- a/twilio/rest/api/v2010/account/short_code.py +++ b/twilio/rest/api/v2010/account/short_code.py @@ -203,10 +203,11 @@ def fetch(self) -> ShortCodeInstance: :returns: The fetched ShortCodeInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ShortCodeInstance( self._version, @@ -223,9 +224,12 @@ async def fetch_async(self) -> ShortCodeInstance: :returns: The fetched ShortCodeInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ShortCodeInstance( @@ -256,6 +260,7 @@ def update( :returns: The updated ShortCodeInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -266,11 +271,14 @@ def update( "SmsFallbackMethod": sms_fallback_method, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ShortCodeInstance( @@ -301,6 +309,7 @@ async def update_async( :returns: The updated ShortCodeInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -311,11 +320,14 @@ async def update_async( "SmsFallbackMethod": sms_fallback_method, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ShortCodeInstance( @@ -537,7 +549,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ShortCodePage(self._version, response, self._solution) async def page_async( @@ -570,8 +588,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ShortCodePage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/signing_key.py b/twilio/rest/api/v2010/account/signing_key.py index 6ddc7b92b0..8e33f218f5 100644 --- a/twilio/rest/api/v2010/account/signing_key.py +++ b/twilio/rest/api/v2010/account/signing_key.py @@ -172,10 +172,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -184,9 +184,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> SigningKeyInstance: @@ -197,10 +199,11 @@ def fetch(self) -> SigningKeyInstance: :returns: The fetched SigningKeyInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return SigningKeyInstance( self._version, @@ -217,9 +220,12 @@ async def fetch_async(self) -> SigningKeyInstance: :returns: The fetched SigningKeyInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return SigningKeyInstance( @@ -239,16 +245,20 @@ def update( :returns: The updated SigningKeyInstance """ + data = values.of( { "FriendlyName": friendly_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SigningKeyInstance( @@ -268,16 +278,20 @@ async def update_async( :returns: The updated SigningKeyInstance """ + data = values.of( { "FriendlyName": friendly_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SigningKeyInstance( @@ -463,7 +477,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return SigningKeyPage(self._version, response, self._solution) async def page_async( @@ -490,8 +510,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return SigningKeyPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/sip/credential_list/__init__.py b/twilio/rest/api/v2010/account/sip/credential_list/__init__.py index 30bb7094e7..d1be747b6d 100644 --- a/twilio/rest/api/v2010/account/sip/credential_list/__init__.py +++ b/twilio/rest/api/v2010/account/sip/credential_list/__init__.py @@ -186,10 +186,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -198,9 +198,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> CredentialListInstance: @@ -211,10 +213,11 @@ def fetch(self) -> CredentialListInstance: :returns: The fetched CredentialListInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return CredentialListInstance( self._version, @@ -231,9 +234,12 @@ async def fetch_async(self) -> CredentialListInstance: :returns: The fetched CredentialListInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return CredentialListInstance( @@ -251,16 +257,20 @@ def update(self, friendly_name: str) -> CredentialListInstance: :returns: The updated CredentialListInstance """ + data = values.of( { "FriendlyName": friendly_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CredentialListInstance( @@ -278,16 +288,20 @@ async def update_async(self, friendly_name: str) -> CredentialListInstance: :returns: The updated CredentialListInstance """ + data = values.of( { "FriendlyName": friendly_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CredentialListInstance( @@ -377,6 +391,10 @@ def create(self, friendly_name: str) -> CredentialListInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -401,6 +419,10 @@ async def create_async(self, friendly_name: str) -> CredentialListInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -536,7 +558,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return CredentialListPage(self._version, response, self._solution) async def page_async( @@ -563,8 +591,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return CredentialListPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/sip/credential_list/credential.py b/twilio/rest/api/v2010/account/sip/credential_list/credential.py index 1e46bfe16e..9c52a110e0 100644 --- a/twilio/rest/api/v2010/account/sip/credential_list/credential.py +++ b/twilio/rest/api/v2010/account/sip/credential_list/credential.py @@ -185,10 +185,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -197,9 +197,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> CredentialInstance: @@ -210,10 +212,11 @@ def fetch(self) -> CredentialInstance: :returns: The fetched CredentialInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return CredentialInstance( self._version, @@ -231,9 +234,12 @@ async def fetch_async(self) -> CredentialInstance: :returns: The fetched CredentialInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return CredentialInstance( @@ -252,16 +258,20 @@ def update(self, password: Union[str, object] = values.unset) -> CredentialInsta :returns: The updated CredentialInstance """ + data = values.of( { "Password": password, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CredentialInstance( @@ -282,16 +292,20 @@ async def update_async( :returns: The updated CredentialInstance """ + data = values.of( { "Password": password, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CredentialInstance( @@ -376,6 +390,10 @@ def create(self, username: str, password: str) -> CredentialInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -405,6 +423,10 @@ async def create_async(self, username: str, password: str) -> CredentialInstance ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -543,7 +565,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return CredentialPage(self._version, response, self._solution) async def page_async( @@ -570,8 +598,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return CredentialPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/sip/domain/__init__.py b/twilio/rest/api/v2010/account/sip/domain/__init__.py index 9ea7260438..0a45e68273 100644 --- a/twilio/rest/api/v2010/account/sip/domain/__init__.py +++ b/twilio/rest/api/v2010/account/sip/domain/__init__.py @@ -322,10 +322,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -334,9 +334,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> DomainInstance: @@ -347,10 +349,11 @@ def fetch(self) -> DomainInstance: :returns: The fetched DomainInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return DomainInstance( self._version, @@ -367,9 +370,12 @@ async def fetch_async(self) -> DomainInstance: :returns: The fetched DomainInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return DomainInstance( @@ -414,6 +420,7 @@ def update( :returns: The updated DomainInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -433,11 +440,14 @@ def update( "EmergencyCallerSid": emergency_caller_sid, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return DomainInstance( @@ -482,6 +492,7 @@ async def update_async( :returns: The updated DomainInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -501,11 +512,14 @@ async def update_async( "EmergencyCallerSid": emergency_caller_sid, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return DomainInstance( @@ -660,6 +674,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -725,6 +743,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -860,7 +882,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return DomainPage(self._version, response, self._solution) async def page_async( @@ -887,8 +915,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return DomainPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/auth_calls_credential_list_mapping.py b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/auth_calls_credential_list_mapping.py index ff6fd5136e..4839f17d48 100644 --- a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/auth_calls_credential_list_mapping.py +++ b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/auth_calls_credential_list_mapping.py @@ -153,10 +153,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -165,9 +165,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> AuthCallsCredentialListMappingInstance: @@ -178,10 +180,11 @@ def fetch(self) -> AuthCallsCredentialListMappingInstance: :returns: The fetched AuthCallsCredentialListMappingInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return AuthCallsCredentialListMappingInstance( self._version, @@ -199,9 +202,12 @@ async def fetch_async(self) -> AuthCallsCredentialListMappingInstance: :returns: The fetched AuthCallsCredentialListMappingInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return AuthCallsCredentialListMappingInstance( @@ -290,6 +296,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -319,6 +329,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -457,7 +471,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return AuthCallsCredentialListMappingPage( self._version, response, self._solution ) @@ -486,8 +506,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return AuthCallsCredentialListMappingPage( self._version, response, self._solution diff --git a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/auth_calls_ip_access_control_list_mapping.py b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/auth_calls_ip_access_control_list_mapping.py index 82099164e7..198f4fc406 100644 --- a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/auth_calls_ip_access_control_list_mapping.py +++ b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/auth_calls_ip_access_control_list_mapping.py @@ -155,10 +155,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -167,9 +167,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> AuthCallsIpAccessControlListMappingInstance: @@ -180,10 +182,11 @@ def fetch(self) -> AuthCallsIpAccessControlListMappingInstance: :returns: The fetched AuthCallsIpAccessControlListMappingInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return AuthCallsIpAccessControlListMappingInstance( self._version, @@ -201,9 +204,12 @@ async def fetch_async(self) -> AuthCallsIpAccessControlListMappingInstance: :returns: The fetched AuthCallsIpAccessControlListMappingInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return AuthCallsIpAccessControlListMappingInstance( @@ -294,6 +300,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -323,6 +333,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -461,7 +475,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return AuthCallsIpAccessControlListMappingPage( self._version, response, self._solution ) @@ -490,8 +510,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return AuthCallsIpAccessControlListMappingPage( self._version, response, self._solution diff --git a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_registrations/auth_registrations_credential_list_mapping.py b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_registrations/auth_registrations_credential_list_mapping.py index 22acb7ef10..e4b1bf0d23 100644 --- a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_registrations/auth_registrations_credential_list_mapping.py +++ b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_registrations/auth_registrations_credential_list_mapping.py @@ -153,10 +153,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -165,9 +165,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> AuthRegistrationsCredentialListMappingInstance: @@ -178,10 +180,11 @@ def fetch(self) -> AuthRegistrationsCredentialListMappingInstance: :returns: The fetched AuthRegistrationsCredentialListMappingInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return AuthRegistrationsCredentialListMappingInstance( self._version, @@ -199,9 +202,12 @@ async def fetch_async(self) -> AuthRegistrationsCredentialListMappingInstance: :returns: The fetched AuthRegistrationsCredentialListMappingInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return AuthRegistrationsCredentialListMappingInstance( @@ -290,6 +296,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -319,6 +329,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -457,7 +471,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return AuthRegistrationsCredentialListMappingPage( self._version, response, self._solution ) @@ -486,8 +506,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return AuthRegistrationsCredentialListMappingPage( self._version, response, self._solution diff --git a/twilio/rest/api/v2010/account/sip/domain/credential_list_mapping.py b/twilio/rest/api/v2010/account/sip/domain/credential_list_mapping.py index e20e08e0fb..b520f4813a 100644 --- a/twilio/rest/api/v2010/account/sip/domain/credential_list_mapping.py +++ b/twilio/rest/api/v2010/account/sip/domain/credential_list_mapping.py @@ -155,10 +155,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -167,9 +167,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> CredentialListMappingInstance: @@ -180,10 +182,11 @@ def fetch(self) -> CredentialListMappingInstance: :returns: The fetched CredentialListMappingInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return CredentialListMappingInstance( self._version, @@ -201,9 +204,12 @@ async def fetch_async(self) -> CredentialListMappingInstance: :returns: The fetched CredentialListMappingInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return CredentialListMappingInstance( @@ -286,6 +292,10 @@ def create(self, credential_list_sid: str) -> CredentialListMappingInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -315,6 +325,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -453,7 +467,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return CredentialListMappingPage(self._version, response, self._solution) async def page_async( @@ -480,8 +500,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return CredentialListMappingPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.py b/twilio/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.py index 607bb6ce12..4dfecfe826 100644 --- a/twilio/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.py +++ b/twilio/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.py @@ -157,10 +157,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -169,9 +169,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> IpAccessControlListMappingInstance: @@ -182,10 +184,11 @@ def fetch(self) -> IpAccessControlListMappingInstance: :returns: The fetched IpAccessControlListMappingInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return IpAccessControlListMappingInstance( self._version, @@ -203,9 +206,12 @@ async def fetch_async(self) -> IpAccessControlListMappingInstance: :returns: The fetched IpAccessControlListMappingInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return IpAccessControlListMappingInstance( @@ -292,6 +298,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -321,6 +331,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -459,7 +473,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return IpAccessControlListMappingPage(self._version, response, self._solution) async def page_async( @@ -486,8 +506,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return IpAccessControlListMappingPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/sip/ip_access_control_list/__init__.py b/twilio/rest/api/v2010/account/sip/ip_access_control_list/__init__.py index cf75721a96..afa504c208 100644 --- a/twilio/rest/api/v2010/account/sip/ip_access_control_list/__init__.py +++ b/twilio/rest/api/v2010/account/sip/ip_access_control_list/__init__.py @@ -190,10 +190,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -202,9 +202,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> IpAccessControlListInstance: @@ -215,10 +217,11 @@ def fetch(self) -> IpAccessControlListInstance: :returns: The fetched IpAccessControlListInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return IpAccessControlListInstance( self._version, @@ -235,9 +238,12 @@ async def fetch_async(self) -> IpAccessControlListInstance: :returns: The fetched IpAccessControlListInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return IpAccessControlListInstance( @@ -255,16 +261,20 @@ def update(self, friendly_name: str) -> IpAccessControlListInstance: :returns: The updated IpAccessControlListInstance """ + data = values.of( { "FriendlyName": friendly_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return IpAccessControlListInstance( @@ -282,16 +292,20 @@ async def update_async(self, friendly_name: str) -> IpAccessControlListInstance: :returns: The updated IpAccessControlListInstance """ + data = values.of( { "FriendlyName": friendly_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return IpAccessControlListInstance( @@ -381,6 +395,10 @@ def create(self, friendly_name: str) -> IpAccessControlListInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -405,6 +423,10 @@ async def create_async(self, friendly_name: str) -> IpAccessControlListInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -540,7 +562,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return IpAccessControlListPage(self._version, response, self._solution) async def page_async( @@ -567,8 +595,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return IpAccessControlListPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/sip/ip_access_control_list/ip_address.py b/twilio/rest/api/v2010/account/sip/ip_access_control_list/ip_address.py index 106bd7400e..ca2f82eacc 100644 --- a/twilio/rest/api/v2010/account/sip/ip_access_control_list/ip_address.py +++ b/twilio/rest/api/v2010/account/sip/ip_access_control_list/ip_address.py @@ -211,10 +211,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -223,9 +223,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> IpAddressInstance: @@ -236,10 +238,11 @@ def fetch(self) -> IpAddressInstance: :returns: The fetched IpAddressInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return IpAddressInstance( self._version, @@ -257,9 +260,12 @@ async def fetch_async(self) -> IpAddressInstance: :returns: The fetched IpAddressInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return IpAddressInstance( @@ -285,6 +291,7 @@ def update( :returns: The updated IpAddressInstance """ + data = values.of( { "IpAddress": ip_address, @@ -292,11 +299,14 @@ def update( "CidrPrefixLength": cidr_prefix_length, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return IpAddressInstance( @@ -322,6 +332,7 @@ async def update_async( :returns: The updated IpAddressInstance """ + data = values.of( { "IpAddress": ip_address, @@ -329,11 +340,14 @@ async def update_async( "CidrPrefixLength": cidr_prefix_length, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return IpAddressInstance( @@ -427,6 +441,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -463,6 +481,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -601,7 +623,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return IpAddressPage(self._version, response, self._solution) async def page_async( @@ -628,8 +656,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return IpAddressPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/token.py b/twilio/rest/api/v2010/account/token.py index 6d5edcf3e8..fa43360fb1 100644 --- a/twilio/rest/api/v2010/account/token.py +++ b/twilio/rest/api/v2010/account/token.py @@ -95,6 +95,10 @@ def create(self, ttl: Union[int, object] = values.unset) -> TokenInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -121,6 +125,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/api/v2010/account/transcription.py b/twilio/rest/api/v2010/account/transcription.py index a77bc42fb4..386ff9ee74 100644 --- a/twilio/rest/api/v2010/account/transcription.py +++ b/twilio/rest/api/v2010/account/transcription.py @@ -168,10 +168,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -180,9 +180,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> TranscriptionInstance: @@ -193,10 +195,11 @@ def fetch(self) -> TranscriptionInstance: :returns: The fetched TranscriptionInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return TranscriptionInstance( self._version, @@ -213,9 +216,12 @@ async def fetch_async(self) -> TranscriptionInstance: :returns: The fetched TranscriptionInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return TranscriptionInstance( @@ -403,7 +409,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return TranscriptionPage(self._version, response, self._solution) async def page_async( @@ -430,8 +442,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return TranscriptionPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/usage/record/__init__.py b/twilio/rest/api/v2010/account/usage/record/__init__.py index 509b98e5a2..1798eb4079 100644 --- a/twilio/rest/api/v2010/account/usage/record/__init__.py +++ b/twilio/rest/api/v2010/account/usage/record/__init__.py @@ -655,7 +655,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return RecordPage(self._version, response, self._solution) async def page_async( @@ -694,8 +700,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return RecordPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/usage/record/all_time.py b/twilio/rest/api/v2010/account/usage/record/all_time.py index f7da24250d..56145d98a9 100644 --- a/twilio/rest/api/v2010/account/usage/record/all_time.py +++ b/twilio/rest/api/v2010/account/usage/record/all_time.py @@ -638,7 +638,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return AllTimePage(self._version, response, self._solution) async def page_async( @@ -677,8 +683,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return AllTimePage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/usage/record/daily.py b/twilio/rest/api/v2010/account/usage/record/daily.py index 6eff180bae..49058b8ea2 100644 --- a/twilio/rest/api/v2010/account/usage/record/daily.py +++ b/twilio/rest/api/v2010/account/usage/record/daily.py @@ -638,7 +638,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return DailyPage(self._version, response, self._solution) async def page_async( @@ -677,8 +683,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return DailyPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/usage/record/last_month.py b/twilio/rest/api/v2010/account/usage/record/last_month.py index bcaacc4ae7..acd98874ca 100644 --- a/twilio/rest/api/v2010/account/usage/record/last_month.py +++ b/twilio/rest/api/v2010/account/usage/record/last_month.py @@ -638,7 +638,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return LastMonthPage(self._version, response, self._solution) async def page_async( @@ -677,8 +683,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return LastMonthPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/usage/record/monthly.py b/twilio/rest/api/v2010/account/usage/record/monthly.py index 3b606977cc..3258e5f4fe 100644 --- a/twilio/rest/api/v2010/account/usage/record/monthly.py +++ b/twilio/rest/api/v2010/account/usage/record/monthly.py @@ -638,7 +638,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return MonthlyPage(self._version, response, self._solution) async def page_async( @@ -677,8 +683,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return MonthlyPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/usage/record/this_month.py b/twilio/rest/api/v2010/account/usage/record/this_month.py index 9b7fc8a51d..cf120b91d3 100644 --- a/twilio/rest/api/v2010/account/usage/record/this_month.py +++ b/twilio/rest/api/v2010/account/usage/record/this_month.py @@ -638,7 +638,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ThisMonthPage(self._version, response, self._solution) async def page_async( @@ -677,8 +683,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ThisMonthPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/usage/record/today.py b/twilio/rest/api/v2010/account/usage/record/today.py index fed8286f7d..b2387c95b4 100644 --- a/twilio/rest/api/v2010/account/usage/record/today.py +++ b/twilio/rest/api/v2010/account/usage/record/today.py @@ -638,7 +638,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return TodayPage(self._version, response, self._solution) async def page_async( @@ -677,8 +683,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return TodayPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/usage/record/yearly.py b/twilio/rest/api/v2010/account/usage/record/yearly.py index e773670d27..490b317e72 100644 --- a/twilio/rest/api/v2010/account/usage/record/yearly.py +++ b/twilio/rest/api/v2010/account/usage/record/yearly.py @@ -638,7 +638,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return YearlyPage(self._version, response, self._solution) async def page_async( @@ -677,8 +683,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return YearlyPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/usage/record/yesterday.py b/twilio/rest/api/v2010/account/usage/record/yesterday.py index a0efe356e4..da5c9dc180 100644 --- a/twilio/rest/api/v2010/account/usage/record/yesterday.py +++ b/twilio/rest/api/v2010/account/usage/record/yesterday.py @@ -638,7 +638,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return YesterdayPage(self._version, response, self._solution) async def page_async( @@ -677,8 +683,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return YesterdayPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/usage/trigger.py b/twilio/rest/api/v2010/account/usage/trigger.py index ba63beec11..08ac52f605 100644 --- a/twilio/rest/api/v2010/account/usage/trigger.py +++ b/twilio/rest/api/v2010/account/usage/trigger.py @@ -553,10 +553,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -565,9 +565,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> TriggerInstance: @@ -578,10 +580,11 @@ def fetch(self) -> TriggerInstance: :returns: The fetched TriggerInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return TriggerInstance( self._version, @@ -598,9 +601,12 @@ async def fetch_async(self) -> TriggerInstance: :returns: The fetched TriggerInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return TriggerInstance( @@ -625,6 +631,7 @@ def update( :returns: The updated TriggerInstance """ + data = values.of( { "CallbackMethod": callback_method, @@ -632,11 +639,14 @@ def update( "FriendlyName": friendly_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return TriggerInstance( @@ -661,6 +671,7 @@ async def update_async( :returns: The updated TriggerInstance """ + data = values.of( { "CallbackMethod": callback_method, @@ -668,11 +679,14 @@ async def update_async( "FriendlyName": friendly_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return TriggerInstance( @@ -770,6 +784,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -815,6 +833,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -999,7 +1021,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return TriggerPage(self._version, response, self._solution) async def page_async( @@ -1035,8 +1063,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return TriggerPage(self._version, response, self._solution) diff --git a/twilio/rest/api/v2010/account/validation_request.py b/twilio/rest/api/v2010/account/validation_request.py index 261322712f..d92f840e68 100644 --- a/twilio/rest/api/v2010/account/validation_request.py +++ b/twilio/rest/api/v2010/account/validation_request.py @@ -106,6 +106,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -148,6 +152,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/assistants/v1/assistant/__init__.py b/twilio/rest/assistants/v1/assistant/__init__.py index a865a040eb..8ab22a5dcf 100644 --- a/twilio/rest/assistants/v1/assistant/__init__.py +++ b/twilio/rest/assistants/v1/assistant/__init__.py @@ -29,6 +29,120 @@ class AssistantInstance(InstanceResource): + + class AssistantsV1ServiceCreateAssistantRequest(object): + """ + :ivar customer_ai: + :ivar name: The name of the assistant. + :ivar owner: The owner/company of the assistant. + :ivar personality_prompt: The personality prompt to be used for assistant. + :ivar segment_credential: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.customer_ai: Optional[AssistantList.AssistantsV1ServiceCustomerAi] = ( + payload.get("customer_ai") + ) + self.name: Optional[str] = payload.get("name") + self.owner: Optional[str] = payload.get("owner") + self.personality_prompt: Optional[str] = payload.get("personality_prompt") + self.segment_credential: Optional[ + AssistantList.AssistantsV1ServiceSegmentCredential + ] = payload.get("segment_credential") + + def to_dict(self): + return { + "customer_ai": ( + self.customer_ai.to_dict() if self.customer_ai is not None else None + ), + "name": self.name, + "owner": self.owner, + "personality_prompt": self.personality_prompt, + "segment_credential": ( + self.segment_credential.to_dict() + if self.segment_credential is not None + else None + ), + } + + class AssistantsV1ServiceCustomerAi(object): + """ + :ivar perception_engine_enabled: True if the perception engine is enabled. + :ivar personalization_engine_enabled: True if the personalization engine is enabled. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.perception_engine_enabled: Optional[bool] = payload.get( + "perception_engine_enabled" + ) + self.personalization_engine_enabled: Optional[bool] = payload.get( + "personalization_engine_enabled" + ) + + def to_dict(self): + return { + "perception_engine_enabled": self.perception_engine_enabled, + "personalization_engine_enabled": self.personalization_engine_enabled, + } + + class AssistantsV1ServiceSegmentCredential(object): + """ + :ivar profile_api_key: The profile API key. + :ivar space_id: The space ID. + :ivar write_key: The write key. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.profile_api_key: Optional[str] = payload.get("profile_api_key") + self.space_id: Optional[str] = payload.get("space_id") + self.write_key: Optional[str] = payload.get("write_key") + + def to_dict(self): + return { + "profile_api_key": self.profile_api_key, + "space_id": self.space_id, + "write_key": self.write_key, + } + + class AssistantsV1ServiceUpdateAssistantRequest(object): + """ + :ivar customer_ai: + :ivar name: The name of the assistant. + :ivar owner: The owner/company of the assistant. + :ivar personality_prompt: The personality prompt to be used for assistant. + :ivar segment_credential: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.customer_ai: Optional[AssistantList.AssistantsV1ServiceCustomerAi] = ( + payload.get("customer_ai") + ) + self.name: Optional[str] = payload.get("name") + self.owner: Optional[str] = payload.get("owner") + self.personality_prompt: Optional[str] = payload.get("personality_prompt") + self.segment_credential: Optional[ + AssistantList.AssistantsV1ServiceSegmentCredential + ] = payload.get("segment_credential") + + def to_dict(self): + return { + "customer_ai": ( + self.customer_ai.to_dict() if self.customer_ai is not None else None + ), + "name": self.name, + "owner": self.owner, + "personality_prompt": self.personality_prompt, + "segment_credential": ( + self.segment_credential.to_dict() + if self.segment_credential is not None + else None + ), + } + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Assistant resource. :ivar customer_ai: The Personalization and Perception Engine settings. @@ -196,6 +310,119 @@ def __repr__(self) -> str: class AssistantContext(InstanceContext): + class AssistantsV1ServiceCreateAssistantRequest(object): + """ + :ivar customer_ai: + :ivar name: The name of the assistant. + :ivar owner: The owner/company of the assistant. + :ivar personality_prompt: The personality prompt to be used for assistant. + :ivar segment_credential: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.customer_ai: Optional[AssistantList.AssistantsV1ServiceCustomerAi] = ( + payload.get("customer_ai") + ) + self.name: Optional[str] = payload.get("name") + self.owner: Optional[str] = payload.get("owner") + self.personality_prompt: Optional[str] = payload.get("personality_prompt") + self.segment_credential: Optional[ + AssistantList.AssistantsV1ServiceSegmentCredential + ] = payload.get("segment_credential") + + def to_dict(self): + return { + "customer_ai": ( + self.customer_ai.to_dict() if self.customer_ai is not None else None + ), + "name": self.name, + "owner": self.owner, + "personality_prompt": self.personality_prompt, + "segment_credential": ( + self.segment_credential.to_dict() + if self.segment_credential is not None + else None + ), + } + + class AssistantsV1ServiceCustomerAi(object): + """ + :ivar perception_engine_enabled: True if the perception engine is enabled. + :ivar personalization_engine_enabled: True if the personalization engine is enabled. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.perception_engine_enabled: Optional[bool] = payload.get( + "perception_engine_enabled" + ) + self.personalization_engine_enabled: Optional[bool] = payload.get( + "personalization_engine_enabled" + ) + + def to_dict(self): + return { + "perception_engine_enabled": self.perception_engine_enabled, + "personalization_engine_enabled": self.personalization_engine_enabled, + } + + class AssistantsV1ServiceSegmentCredential(object): + """ + :ivar profile_api_key: The profile API key. + :ivar space_id: The space ID. + :ivar write_key: The write key. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.profile_api_key: Optional[str] = payload.get("profile_api_key") + self.space_id: Optional[str] = payload.get("space_id") + self.write_key: Optional[str] = payload.get("write_key") + + def to_dict(self): + return { + "profile_api_key": self.profile_api_key, + "space_id": self.space_id, + "write_key": self.write_key, + } + + class AssistantsV1ServiceUpdateAssistantRequest(object): + """ + :ivar customer_ai: + :ivar name: The name of the assistant. + :ivar owner: The owner/company of the assistant. + :ivar personality_prompt: The personality prompt to be used for assistant. + :ivar segment_credential: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.customer_ai: Optional[AssistantList.AssistantsV1ServiceCustomerAi] = ( + payload.get("customer_ai") + ) + self.name: Optional[str] = payload.get("name") + self.owner: Optional[str] = payload.get("owner") + self.personality_prompt: Optional[str] = payload.get("personality_prompt") + self.segment_credential: Optional[ + AssistantList.AssistantsV1ServiceSegmentCredential + ] = payload.get("segment_credential") + + def to_dict(self): + return { + "customer_ai": ( + self.customer_ai.to_dict() if self.customer_ai is not None else None + ), + "name": self.name, + "owner": self.owner, + "personality_prompt": self.personality_prompt, + "segment_credential": ( + self.segment_credential.to_dict() + if self.segment_credential is not None + else None + ), + } + def __init__(self, version: Version, id: str): """ Initialize the AssistantContext @@ -223,10 +450,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -235,9 +462,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> AssistantInstance: @@ -248,10 +477,11 @@ def fetch(self) -> AssistantInstance: :returns: The fetched AssistantInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return AssistantInstance( self._version, @@ -267,9 +497,12 @@ async def fetch_async(self) -> AssistantInstance: :returns: The fetched AssistantInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return AssistantInstance( @@ -291,12 +524,13 @@ def update( :returns: The updated AssistantInstance """ - data = values.of({}) - headers = values.of( - { - "AssistantsV1ServiceUpdateAssistantRequest": assistants_v1_service_update_assistant_request, - } - ) + data = assistants_v1_service_update_assistant_request.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" payload = self._version.update( method="PUT", uri=self._uri, data=data, headers=headers @@ -317,12 +551,13 @@ async def update_async( :returns: The updated AssistantInstance """ - data = values.of({}) - headers = values.of( - { - "AssistantsV1ServiceUpdateAssistantRequest": assistants_v1_service_update_assistant_request, - } - ) + data = assistants_v1_service_update_assistant_request.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" payload = await self._version.update_async( method="PUT", uri=self._uri, data=data, headers=headers @@ -432,11 +667,17 @@ def __init__(self, payload: Dict[str, Any]): def to_dict(self): return { - "customer_ai": self.customer_ai.to_dict(), + "customer_ai": ( + self.customer_ai.to_dict() if self.customer_ai is not None else None + ), "name": self.name, "owner": self.owner, "personality_prompt": self.personality_prompt, - "segment_credential": self.segment_credential.to_dict(), + "segment_credential": ( + self.segment_credential.to_dict() + if self.segment_credential is not None + else None + ), } class AssistantsV1ServiceCustomerAi(object): @@ -503,11 +744,17 @@ def __init__(self, payload: Dict[str, Any]): def to_dict(self): return { - "customer_ai": self.customer_ai.to_dict(), + "customer_ai": ( + self.customer_ai.to_dict() if self.customer_ai is not None else None + ), "name": self.name, "owner": self.owner, "personality_prompt": self.personality_prompt, - "segment_credential": self.segment_credential.to_dict(), + "segment_credential": ( + self.segment_credential.to_dict() + if self.segment_credential is not None + else None + ), } def __init__(self, version: Version): @@ -535,8 +782,11 @@ def create( data = assistants_v1_service_create_assistant_request.to_dict() headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -557,8 +807,11 @@ async def create_async( data = assistants_v1_service_create_assistant_request.to_dict() headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -692,7 +945,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return AssistantPage(self._version, response) async def page_async( @@ -719,8 +978,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return AssistantPage(self._version, response) diff --git a/twilio/rest/assistants/v1/assistant/assistants_knowledge.py b/twilio/rest/assistants/v1/assistant/assistants_knowledge.py index b3c7e9ae0e..c3767223e1 100644 --- a/twilio/rest/assistants/v1/assistant/assistants_knowledge.py +++ b/twilio/rest/assistants/v1/assistant/assistants_knowledge.py @@ -194,10 +194,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -206,9 +206,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def __repr__(self) -> str: @@ -421,7 +423,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return AssistantsKnowledgePage(self._version, response, self._solution) async def page_async( @@ -448,8 +456,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return AssistantsKnowledgePage(self._version, response, self._solution) diff --git a/twilio/rest/assistants/v1/assistant/assistants_tool.py b/twilio/rest/assistants/v1/assistant/assistants_tool.py index 0bed2b76a3..ed02410d3c 100644 --- a/twilio/rest/assistants/v1/assistant/assistants_tool.py +++ b/twilio/rest/assistants/v1/assistant/assistants_tool.py @@ -194,10 +194,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -206,9 +206,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def __repr__(self) -> str: @@ -421,7 +423,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return AssistantsToolPage(self._version, response, self._solution) async def page_async( @@ -448,8 +456,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return AssistantsToolPage(self._version, response, self._solution) diff --git a/twilio/rest/assistants/v1/assistant/feedback.py b/twilio/rest/assistants/v1/assistant/feedback.py index 63a6d3b6b2..77c6d405f4 100644 --- a/twilio/rest/assistants/v1/assistant/feedback.py +++ b/twilio/rest/assistants/v1/assistant/feedback.py @@ -23,6 +23,30 @@ class FeedbackInstance(InstanceResource): + + class AssistantsV1ServiceCreateFeedbackRequest(object): + """ + :ivar message_id: The message ID. + :ivar score: The score to be given(0-1). + :ivar session_id: The Session ID. + :ivar text: The text to be given as feedback. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.message_id: Optional[str] = payload.get("message_id") + self.score: Optional[float] = payload.get("score") + self.session_id: Optional[str] = payload.get("session_id") + self.text: Optional[str] = payload.get("text") + + def to_dict(self): + return { + "message_id": self.message_id, + "score": self.score, + "session_id": self.session_id, + "text": self.text, + } + """ :ivar assistant_id: The Assistant ID. :ivar id: The Feedback ID. @@ -142,8 +166,11 @@ def create( data = assistants_v1_service_create_feedback_request.to_dict() headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -164,8 +191,11 @@ async def create_async( data = assistants_v1_service_create_feedback_request.to_dict() headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -299,7 +329,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return FeedbackPage(self._version, response, self._solution) async def page_async( @@ -326,8 +362,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return FeedbackPage(self._version, response, self._solution) diff --git a/twilio/rest/assistants/v1/assistant/message.py b/twilio/rest/assistants/v1/assistant/message.py index b42514cb38..11d73776b7 100644 --- a/twilio/rest/assistants/v1/assistant/message.py +++ b/twilio/rest/assistants/v1/assistant/message.py @@ -21,6 +21,33 @@ class MessageInstance(InstanceResource): + + class AssistantsV1ServiceAssistantSendMessageRequest(object): + """ + :ivar identity: The unique identity of user for the session. + :ivar session_id: The unique name for the session. + :ivar body: The query to ask the assistant. + :ivar webhook: The webhook url to call after the assistant has generated a response or report an error. + :ivar mode: one of the modes 'chat', 'email' or 'voice' + """ + + def __init__(self, payload: Dict[str, Any]): + + self.identity: Optional[str] = payload.get("identity") + self.session_id: Optional[str] = payload.get("session_id") + self.body: Optional[str] = payload.get("body") + self.webhook: Optional[str] = payload.get("webhook") + self.mode: Optional[str] = payload.get("mode") + + def to_dict(self): + return { + "identity": self.identity, + "session_id": self.session_id, + "body": self.body, + "webhook": self.webhook, + "mode": self.mode, + } + """ :ivar status: success or failure based on whether the request successfully generated a response. :ivar flagged: If successful, this property will denote whether the response was flagged or not. @@ -114,8 +141,11 @@ def create( data = assistants_v1_service_assistant_send_message_request.to_dict() headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -136,8 +166,11 @@ async def create_async( data = assistants_v1_service_assistant_send_message_request.to_dict() headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/assistants/v1/knowledge/__init__.py b/twilio/rest/assistants/v1/knowledge/__init__.py index 498bc80f95..993ed922ce 100644 --- a/twilio/rest/assistants/v1/knowledge/__init__.py +++ b/twilio/rest/assistants/v1/knowledge/__init__.py @@ -25,6 +25,98 @@ class KnowledgeInstance(InstanceResource): + + class AssistantsV1ServiceCreateKnowledgeRequest(object): + """ + :ivar assistant_id: The Assistant ID. + :ivar description: The description of the knowledge source. + :ivar knowledge_source_details: The details of the knowledge source based on the type. + :ivar name: The name of the tool. + :ivar policy: + :ivar type: The type of the knowledge source. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.assistant_id: Optional[str] = payload.get("assistant_id") + self.description: Optional[str] = payload.get("description") + self.knowledge_source_details: Optional[Dict[str, object]] = payload.get( + "knowledge_source_details" + ) + self.name: Optional[str] = payload.get("name") + self.policy: Optional[ + KnowledgeList.AssistantsV1ServiceCreatePolicyRequest + ] = payload.get("policy") + self.type: Optional[str] = payload.get("type") + + def to_dict(self): + return { + "assistant_id": self.assistant_id, + "description": self.description, + "knowledge_source_details": self.knowledge_source_details, + "name": self.name, + "policy": self.policy.to_dict() if self.policy is not None else None, + "type": self.type, + } + + class AssistantsV1ServiceCreatePolicyRequest(object): + """ + :ivar description: The description of the policy. + :ivar id: The Policy ID. + :ivar name: The name of the policy. + :ivar policy_details: + :ivar type: The description of the policy. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.description: Optional[str] = payload.get("description") + self.id: Optional[str] = payload.get("id") + self.name: Optional[str] = payload.get("name") + self.policy_details: Optional[Dict[str, object]] = payload.get( + "policy_details" + ) + self.type: Optional[str] = payload.get("type") + + def to_dict(self): + return { + "description": self.description, + "id": self.id, + "name": self.name, + "policy_details": self.policy_details, + "type": self.type, + } + + class AssistantsV1ServiceUpdateKnowledgeRequest(object): + """ + :ivar description: The description of the knowledge source. + :ivar knowledge_source_details: The details of the knowledge source based on the type. + :ivar name: The name of the knowledge source. + :ivar policy: + :ivar type: The description of the knowledge source. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.description: Optional[str] = payload.get("description") + self.knowledge_source_details: Optional[Dict[str, object]] = payload.get( + "knowledge_source_details" + ) + self.name: Optional[str] = payload.get("name") + self.policy: Optional[ + KnowledgeList.AssistantsV1ServiceCreatePolicyRequest + ] = payload.get("policy") + self.type: Optional[str] = payload.get("type") + + def to_dict(self): + return { + "description": self.description, + "knowledge_source_details": self.knowledge_source_details, + "name": self.name, + "policy": self.policy.to_dict() if self.policy is not None else None, + "type": self.type, + } + """ :ivar description: The type of knowledge source. :ivar id: The description of knowledge. @@ -176,6 +268,97 @@ def __repr__(self) -> str: class KnowledgeContext(InstanceContext): + class AssistantsV1ServiceCreateKnowledgeRequest(object): + """ + :ivar assistant_id: The Assistant ID. + :ivar description: The description of the knowledge source. + :ivar knowledge_source_details: The details of the knowledge source based on the type. + :ivar name: The name of the tool. + :ivar policy: + :ivar type: The type of the knowledge source. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.assistant_id: Optional[str] = payload.get("assistant_id") + self.description: Optional[str] = payload.get("description") + self.knowledge_source_details: Optional[Dict[str, object]] = payload.get( + "knowledge_source_details" + ) + self.name: Optional[str] = payload.get("name") + self.policy: Optional[ + KnowledgeList.AssistantsV1ServiceCreatePolicyRequest + ] = payload.get("policy") + self.type: Optional[str] = payload.get("type") + + def to_dict(self): + return { + "assistant_id": self.assistant_id, + "description": self.description, + "knowledge_source_details": self.knowledge_source_details, + "name": self.name, + "policy": self.policy.to_dict() if self.policy is not None else None, + "type": self.type, + } + + class AssistantsV1ServiceCreatePolicyRequest(object): + """ + :ivar description: The description of the policy. + :ivar id: The Policy ID. + :ivar name: The name of the policy. + :ivar policy_details: + :ivar type: The description of the policy. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.description: Optional[str] = payload.get("description") + self.id: Optional[str] = payload.get("id") + self.name: Optional[str] = payload.get("name") + self.policy_details: Optional[Dict[str, object]] = payload.get( + "policy_details" + ) + self.type: Optional[str] = payload.get("type") + + def to_dict(self): + return { + "description": self.description, + "id": self.id, + "name": self.name, + "policy_details": self.policy_details, + "type": self.type, + } + + class AssistantsV1ServiceUpdateKnowledgeRequest(object): + """ + :ivar description: The description of the knowledge source. + :ivar knowledge_source_details: The details of the knowledge source based on the type. + :ivar name: The name of the knowledge source. + :ivar policy: + :ivar type: The description of the knowledge source. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.description: Optional[str] = payload.get("description") + self.knowledge_source_details: Optional[Dict[str, object]] = payload.get( + "knowledge_source_details" + ) + self.name: Optional[str] = payload.get("name") + self.policy: Optional[ + KnowledgeList.AssistantsV1ServiceCreatePolicyRequest + ] = payload.get("policy") + self.type: Optional[str] = payload.get("type") + + def to_dict(self): + return { + "description": self.description, + "knowledge_source_details": self.knowledge_source_details, + "name": self.name, + "policy": self.policy.to_dict() if self.policy is not None else None, + "type": self.type, + } + def __init__(self, version: Version, id: str): """ Initialize the KnowledgeContext @@ -201,10 +384,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -213,9 +396,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> KnowledgeInstance: @@ -226,10 +411,11 @@ def fetch(self) -> KnowledgeInstance: :returns: The fetched KnowledgeInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return KnowledgeInstance( self._version, @@ -245,9 +431,12 @@ async def fetch_async(self) -> KnowledgeInstance: :returns: The fetched KnowledgeInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return KnowledgeInstance( @@ -269,12 +458,13 @@ def update( :returns: The updated KnowledgeInstance """ - data = values.of({}) - headers = values.of( - { - "AssistantsV1ServiceUpdateKnowledgeRequest": assistants_v1_service_update_knowledge_request, - } - ) + data = assistants_v1_service_update_knowledge_request.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" payload = self._version.update( method="PUT", uri=self._uri, data=data, headers=headers @@ -295,12 +485,13 @@ async def update_async( :returns: The updated KnowledgeInstance """ - data = values.of({}) - headers = values.of( - { - "AssistantsV1ServiceUpdateKnowledgeRequest": assistants_v1_service_update_knowledge_request, - } - ) + data = assistants_v1_service_update_knowledge_request.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" payload = await self._version.update_async( method="PUT", uri=self._uri, data=data, headers=headers @@ -392,7 +583,7 @@ def to_dict(self): "description": self.description, "knowledge_source_details": self.knowledge_source_details, "name": self.name, - "policy": self.policy.to_dict(), + "policy": self.policy.to_dict() if self.policy is not None else None, "type": self.type, } @@ -450,7 +641,7 @@ def to_dict(self): "description": self.description, "knowledge_source_details": self.knowledge_source_details, "name": self.name, - "policy": self.policy.to_dict(), + "policy": self.policy.to_dict() if self.policy is not None else None, "type": self.type, } @@ -479,8 +670,11 @@ def create( data = assistants_v1_service_create_knowledge_request.to_dict() headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -501,8 +695,11 @@ async def create_async( data = assistants_v1_service_create_knowledge_request.to_dict() headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -651,7 +848,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return KnowledgePage(self._version, response) async def page_async( @@ -681,8 +884,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return KnowledgePage(self._version, response) diff --git a/twilio/rest/assistants/v1/knowledge/chunk.py b/twilio/rest/assistants/v1/knowledge/chunk.py index 29e1a34945..be90a7626e 100644 --- a/twilio/rest/assistants/v1/knowledge/chunk.py +++ b/twilio/rest/assistants/v1/knowledge/chunk.py @@ -222,7 +222,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ChunkPage(self._version, response, self._solution) async def page_async( @@ -249,8 +255,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ChunkPage(self._version, response, self._solution) diff --git a/twilio/rest/assistants/v1/knowledge/knowledge_status.py b/twilio/rest/assistants/v1/knowledge/knowledge_status.py index 14a56b0cc2..fedbcaad25 100644 --- a/twilio/rest/assistants/v1/knowledge/knowledge_status.py +++ b/twilio/rest/assistants/v1/knowledge/knowledge_status.py @@ -14,7 +14,7 @@ from datetime import datetime from typing import Any, Dict, Optional -from twilio.base import deserialize +from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -112,10 +112,11 @@ def fetch(self) -> KnowledgeStatusInstance: :returns: The fetched KnowledgeStatusInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return KnowledgeStatusInstance( self._version, @@ -131,9 +132,12 @@ async def fetch_async(self) -> KnowledgeStatusInstance: :returns: The fetched KnowledgeStatusInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return KnowledgeStatusInstance( diff --git a/twilio/rest/assistants/v1/policy.py b/twilio/rest/assistants/v1/policy.py index c63eee2e2f..63854fb82b 100644 --- a/twilio/rest/assistants/v1/policy.py +++ b/twilio/rest/assistants/v1/policy.py @@ -251,7 +251,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return PolicyPage(self._version, response) async def page_async( @@ -284,8 +290,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return PolicyPage(self._version, response) diff --git a/twilio/rest/assistants/v1/session/__init__.py b/twilio/rest/assistants/v1/session/__init__.py index 1faf9c9174..3f0054ea55 100644 --- a/twilio/rest/assistants/v1/session/__init__.py +++ b/twilio/rest/assistants/v1/session/__init__.py @@ -133,10 +133,11 @@ def fetch(self) -> SessionInstance: :returns: The fetched SessionInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return SessionInstance( self._version, @@ -152,9 +153,12 @@ async def fetch_async(self) -> SessionInstance: :returns: The fetched SessionInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return SessionInstance( @@ -344,7 +348,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return SessionPage(self._version, response) async def page_async( @@ -371,8 +381,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return SessionPage(self._version, response) diff --git a/twilio/rest/assistants/v1/session/message.py b/twilio/rest/assistants/v1/session/message.py index b2d2921dfb..a7ea5ca213 100644 --- a/twilio/rest/assistants/v1/session/message.py +++ b/twilio/rest/assistants/v1/session/message.py @@ -234,7 +234,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return MessagePage(self._version, response, self._solution) async def page_async( @@ -261,8 +267,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return MessagePage(self._version, response, self._solution) diff --git a/twilio/rest/assistants/v1/tool.py b/twilio/rest/assistants/v1/tool.py index a8b1ac6472..648faca599 100644 --- a/twilio/rest/assistants/v1/tool.py +++ b/twilio/rest/assistants/v1/tool.py @@ -23,6 +23,103 @@ class ToolInstance(InstanceResource): + + class AssistantsV1ServiceCreatePolicyRequest(object): + """ + :ivar description: The description of the policy. + :ivar id: The Policy ID. + :ivar name: The name of the policy. + :ivar policy_details: + :ivar type: The description of the policy. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.description: Optional[str] = payload.get("description") + self.id: Optional[str] = payload.get("id") + self.name: Optional[str] = payload.get("name") + self.policy_details: Optional[Dict[str, object]] = payload.get( + "policy_details" + ) + self.type: Optional[str] = payload.get("type") + + def to_dict(self): + return { + "description": self.description, + "id": self.id, + "name": self.name, + "policy_details": self.policy_details, + "type": self.type, + } + + class AssistantsV1ServiceCreateToolRequest(object): + """ + :ivar assistant_id: The Assistant ID. + :ivar description: The description of the tool. + :ivar enabled: True if the tool is enabled. + :ivar meta: The metadata related to method, url, input_schema to used with the Tool. + :ivar name: The name of the tool. + :ivar policy: + :ivar type: The description of the tool. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.assistant_id: Optional[str] = payload.get("assistant_id") + self.description: Optional[str] = payload.get("description") + self.enabled: Optional[bool] = payload.get("enabled") + self.meta: Optional[Dict[str, object]] = payload.get("meta") + self.name: Optional[str] = payload.get("name") + self.policy: Optional[ToolList.AssistantsV1ServiceCreatePolicyRequest] = ( + payload.get("policy") + ) + self.type: Optional[str] = payload.get("type") + + def to_dict(self): + return { + "assistant_id": self.assistant_id, + "description": self.description, + "enabled": self.enabled, + "meta": self.meta, + "name": self.name, + "policy": self.policy.to_dict() if self.policy is not None else None, + "type": self.type, + } + + class AssistantsV1ServiceUpdateToolRequest(object): + """ + :ivar assistant_id: The Assistant ID. + :ivar description: The description of the tool. + :ivar enabled: True if the tool is enabled. + :ivar meta: The metadata related to method, url, input_schema to used with the Tool. + :ivar name: The name of the tool. + :ivar policy: + :ivar type: The type of the tool. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.assistant_id: Optional[str] = payload.get("assistant_id") + self.description: Optional[str] = payload.get("description") + self.enabled: Optional[bool] = payload.get("enabled") + self.meta: Optional[Dict[str, object]] = payload.get("meta") + self.name: Optional[str] = payload.get("name") + self.policy: Optional[ToolList.AssistantsV1ServiceCreatePolicyRequest] = ( + payload.get("policy") + ) + self.type: Optional[str] = payload.get("type") + + def to_dict(self): + return { + "assistant_id": self.assistant_id, + "description": self.description, + "enabled": self.enabled, + "meta": self.meta, + "name": self.name, + "policy": self.policy.to_dict() if self.policy is not None else None, + "type": self.type, + } + """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Tool resource. :ivar description: The description of the tool. @@ -162,6 +259,102 @@ def __repr__(self) -> str: class ToolContext(InstanceContext): + class AssistantsV1ServiceCreatePolicyRequest(object): + """ + :ivar description: The description of the policy. + :ivar id: The Policy ID. + :ivar name: The name of the policy. + :ivar policy_details: + :ivar type: The description of the policy. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.description: Optional[str] = payload.get("description") + self.id: Optional[str] = payload.get("id") + self.name: Optional[str] = payload.get("name") + self.policy_details: Optional[Dict[str, object]] = payload.get( + "policy_details" + ) + self.type: Optional[str] = payload.get("type") + + def to_dict(self): + return { + "description": self.description, + "id": self.id, + "name": self.name, + "policy_details": self.policy_details, + "type": self.type, + } + + class AssistantsV1ServiceCreateToolRequest(object): + """ + :ivar assistant_id: The Assistant ID. + :ivar description: The description of the tool. + :ivar enabled: True if the tool is enabled. + :ivar meta: The metadata related to method, url, input_schema to used with the Tool. + :ivar name: The name of the tool. + :ivar policy: + :ivar type: The description of the tool. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.assistant_id: Optional[str] = payload.get("assistant_id") + self.description: Optional[str] = payload.get("description") + self.enabled: Optional[bool] = payload.get("enabled") + self.meta: Optional[Dict[str, object]] = payload.get("meta") + self.name: Optional[str] = payload.get("name") + self.policy: Optional[ToolList.AssistantsV1ServiceCreatePolicyRequest] = ( + payload.get("policy") + ) + self.type: Optional[str] = payload.get("type") + + def to_dict(self): + return { + "assistant_id": self.assistant_id, + "description": self.description, + "enabled": self.enabled, + "meta": self.meta, + "name": self.name, + "policy": self.policy.to_dict() if self.policy is not None else None, + "type": self.type, + } + + class AssistantsV1ServiceUpdateToolRequest(object): + """ + :ivar assistant_id: The Assistant ID. + :ivar description: The description of the tool. + :ivar enabled: True if the tool is enabled. + :ivar meta: The metadata related to method, url, input_schema to used with the Tool. + :ivar name: The name of the tool. + :ivar policy: + :ivar type: The type of the tool. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.assistant_id: Optional[str] = payload.get("assistant_id") + self.description: Optional[str] = payload.get("description") + self.enabled: Optional[bool] = payload.get("enabled") + self.meta: Optional[Dict[str, object]] = payload.get("meta") + self.name: Optional[str] = payload.get("name") + self.policy: Optional[ToolList.AssistantsV1ServiceCreatePolicyRequest] = ( + payload.get("policy") + ) + self.type: Optional[str] = payload.get("type") + + def to_dict(self): + return { + "assistant_id": self.assistant_id, + "description": self.description, + "enabled": self.enabled, + "meta": self.meta, + "name": self.name, + "policy": self.policy.to_dict() if self.policy is not None else None, + "type": self.type, + } + def __init__(self, version: Version, id: str): """ Initialize the ToolContext @@ -184,10 +377,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -196,9 +389,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> ToolInstance: @@ -209,10 +404,11 @@ def fetch(self) -> ToolInstance: :returns: The fetched ToolInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ToolInstance( self._version, @@ -228,9 +424,12 @@ async def fetch_async(self) -> ToolInstance: :returns: The fetched ToolInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ToolInstance( @@ -252,12 +451,13 @@ def update( :returns: The updated ToolInstance """ - data = values.of({}) - headers = values.of( - { - "AssistantsV1ServiceUpdateToolRequest": assistants_v1_service_update_tool_request, - } - ) + data = assistants_v1_service_update_tool_request.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" payload = self._version.update( method="PUT", uri=self._uri, data=data, headers=headers @@ -278,12 +478,13 @@ async def update_async( :returns: The updated ToolInstance """ - data = values.of({}) - headers = values.of( - { - "AssistantsV1ServiceUpdateToolRequest": assistants_v1_service_update_tool_request, - } - ) + data = assistants_v1_service_update_tool_request.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" payload = await self._version.update_async( method="PUT", uri=self._uri, data=data, headers=headers @@ -380,7 +581,7 @@ def to_dict(self): "enabled": self.enabled, "meta": self.meta, "name": self.name, - "policy": self.policy.to_dict(), + "policy": self.policy.to_dict() if self.policy is not None else None, "type": self.type, } @@ -414,7 +615,7 @@ def to_dict(self): "enabled": self.enabled, "meta": self.meta, "name": self.name, - "policy": self.policy.to_dict(), + "policy": self.policy.to_dict() if self.policy is not None else None, "type": self.type, } @@ -443,8 +644,11 @@ def create( data = assistants_v1_service_create_tool_request.to_dict() headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -465,8 +669,11 @@ async def create_async( data = assistants_v1_service_create_tool_request.to_dict() headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -615,7 +822,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ToolPage(self._version, response) async def page_async( @@ -645,8 +858,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ToolPage(self._version, response) diff --git a/twilio/rest/bulkexports/v1/export/__init__.py b/twilio/rest/bulkexports/v1/export/__init__.py index c5c11df086..0ebf3a451b 100644 --- a/twilio/rest/bulkexports/v1/export/__init__.py +++ b/twilio/rest/bulkexports/v1/export/__init__.py @@ -13,6 +13,7 @@ """ from typing import Any, Dict, Optional +from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -132,10 +133,11 @@ def fetch(self) -> ExportInstance: :returns: The fetched ExportInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ExportInstance( self._version, @@ -151,9 +153,12 @@ async def fetch_async(self) -> ExportInstance: :returns: The fetched ExportInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ExportInstance( diff --git a/twilio/rest/bulkexports/v1/export/day.py b/twilio/rest/bulkexports/v1/export/day.py index fcbc56e979..f4b2a0650f 100644 --- a/twilio/rest/bulkexports/v1/export/day.py +++ b/twilio/rest/bulkexports/v1/export/day.py @@ -124,10 +124,11 @@ def fetch(self) -> DayInstance: :returns: The fetched DayInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return DayInstance( self._version, @@ -144,9 +145,12 @@ async def fetch_async(self) -> DayInstance: :returns: The fetched DayInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return DayInstance( @@ -332,7 +336,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return DayPage(self._version, response, self._solution) async def page_async( @@ -359,8 +369,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return DayPage(self._version, response, self._solution) diff --git a/twilio/rest/bulkexports/v1/export/export_custom_job.py b/twilio/rest/bulkexports/v1/export/export_custom_job.py index 9a81fb23cb..72d0e9b328 100644 --- a/twilio/rest/bulkexports/v1/export/export_custom_job.py +++ b/twilio/rest/bulkexports/v1/export/export_custom_job.py @@ -140,6 +140,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -182,6 +186,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -317,7 +325,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ExportCustomJobPage(self._version, response, self._solution) async def page_async( @@ -344,8 +358,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ExportCustomJobPage(self._version, response, self._solution) diff --git a/twilio/rest/bulkexports/v1/export/job.py b/twilio/rest/bulkexports/v1/export/job.py index 48b2df1ab3..5358ffa83a 100644 --- a/twilio/rest/bulkexports/v1/export/job.py +++ b/twilio/rest/bulkexports/v1/export/job.py @@ -13,6 +13,7 @@ """ from typing import Any, Dict, Optional +from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -145,10 +146,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -157,9 +158,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> JobInstance: @@ -170,10 +173,11 @@ def fetch(self) -> JobInstance: :returns: The fetched JobInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return JobInstance( self._version, @@ -189,9 +193,12 @@ async def fetch_async(self) -> JobInstance: :returns: The fetched JobInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return JobInstance( diff --git a/twilio/rest/bulkexports/v1/export_configuration.py b/twilio/rest/bulkexports/v1/export_configuration.py index c6629d21cf..207642769b 100644 --- a/twilio/rest/bulkexports/v1/export_configuration.py +++ b/twilio/rest/bulkexports/v1/export_configuration.py @@ -158,10 +158,11 @@ def fetch(self) -> ExportConfigurationInstance: :returns: The fetched ExportConfigurationInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ExportConfigurationInstance( self._version, @@ -177,9 +178,12 @@ async def fetch_async(self) -> ExportConfigurationInstance: :returns: The fetched ExportConfigurationInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ExportConfigurationInstance( @@ -203,6 +207,7 @@ def update( :returns: The updated ExportConfigurationInstance """ + data = values.of( { "Enabled": serialize.boolean_to_string(enabled), @@ -210,11 +215,14 @@ def update( "WebhookMethod": webhook_method, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ExportConfigurationInstance( @@ -236,6 +244,7 @@ async def update_async( :returns: The updated ExportConfigurationInstance """ + data = values.of( { "Enabled": serialize.boolean_to_string(enabled), @@ -243,11 +252,14 @@ async def update_async( "WebhookMethod": webhook_method, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ExportConfigurationInstance( diff --git a/twilio/rest/chat/v1/credential.py b/twilio/rest/chat/v1/credential.py index 6bb8b3f981..3bd48b1144 100644 --- a/twilio/rest/chat/v1/credential.py +++ b/twilio/rest/chat/v1/credential.py @@ -208,10 +208,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -220,9 +220,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> CredentialInstance: @@ -233,10 +235,11 @@ def fetch(self) -> CredentialInstance: :returns: The fetched CredentialInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return CredentialInstance( self._version, @@ -252,9 +255,12 @@ async def fetch_async(self) -> CredentialInstance: :returns: The fetched CredentialInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return CredentialInstance( @@ -284,6 +290,7 @@ def update( :returns: The updated CredentialInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -294,11 +301,14 @@ def update( "Secret": secret, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CredentialInstance(self._version, payload, sid=self._solution["sid"]) @@ -324,6 +334,7 @@ async def update_async( :returns: The updated CredentialInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -334,11 +345,14 @@ async def update_async( "Secret": secret, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CredentialInstance(self._version, payload, sid=self._solution["sid"]) @@ -422,6 +436,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -465,6 +483,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -598,7 +620,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return CredentialPage(self._version, response) async def page_async( @@ -625,8 +653,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return CredentialPage(self._version, response) diff --git a/twilio/rest/chat/v1/service/__init__.py b/twilio/rest/chat/v1/service/__init__.py index 71825fe578..26fde4025b 100644 --- a/twilio/rest/chat/v1/service/__init__.py +++ b/twilio/rest/chat/v1/service/__init__.py @@ -554,10 +554,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -566,9 +566,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> ServiceInstance: @@ -579,10 +581,11 @@ def fetch(self) -> ServiceInstance: :returns: The fetched ServiceInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ServiceInstance( self._version, @@ -598,9 +601,12 @@ async def fetch_async(self) -> ServiceInstance: :returns: The fetched ServiceInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ServiceInstance( @@ -726,6 +732,7 @@ def update( :returns: The updated ServiceInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -794,11 +801,14 @@ def update( "Limits.UserChannels": limits_user_channels, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload, sid=self._solution["sid"]) @@ -920,6 +930,7 @@ async def update_async( :returns: The updated ServiceInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -988,11 +999,14 @@ async def update_async( "Limits.UserChannels": limits_user_channels, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload, sid=self._solution["sid"]) @@ -1091,6 +1105,10 @@ def create(self, friendly_name: str) -> ServiceInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -1113,6 +1131,10 @@ async def create_async(self, friendly_name: str) -> ServiceInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -1246,7 +1268,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ServicePage(self._version, response) async def page_async( @@ -1273,8 +1301,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ServicePage(self._version, response) diff --git a/twilio/rest/chat/v1/service/channel/__init__.py b/twilio/rest/chat/v1/service/channel/__init__.py index 02c42f65cc..ffe42c0b5d 100644 --- a/twilio/rest/chat/v1/service/channel/__init__.py +++ b/twilio/rest/chat/v1/service/channel/__init__.py @@ -241,10 +241,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -253,9 +253,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> ChannelInstance: @@ -266,10 +268,11 @@ def fetch(self) -> ChannelInstance: :returns: The fetched ChannelInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ChannelInstance( self._version, @@ -286,9 +289,12 @@ async def fetch_async(self) -> ChannelInstance: :returns: The fetched ChannelInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ChannelInstance( @@ -313,6 +319,7 @@ def update( :returns: The updated ChannelInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -320,11 +327,14 @@ def update( "Attributes": attributes, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ChannelInstance( @@ -349,6 +359,7 @@ async def update_async( :returns: The updated ChannelInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -356,11 +367,14 @@ async def update_async( "Attributes": attributes, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ChannelInstance( @@ -486,6 +500,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -522,6 +540,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -670,7 +692,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ChannelPage(self._version, response, self._solution) async def page_async( @@ -700,8 +728,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ChannelPage(self._version, response, self._solution) diff --git a/twilio/rest/chat/v1/service/channel/invite.py b/twilio/rest/chat/v1/service/channel/invite.py index c80732a2c0..e5cd4ebe36 100644 --- a/twilio/rest/chat/v1/service/channel/invite.py +++ b/twilio/rest/chat/v1/service/channel/invite.py @@ -163,10 +163,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -175,9 +175,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> InviteInstance: @@ -188,10 +190,11 @@ def fetch(self) -> InviteInstance: :returns: The fetched InviteInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return InviteInstance( self._version, @@ -209,9 +212,12 @@ async def fetch_async(self) -> InviteInstance: :returns: The fetched InviteInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return InviteInstance( @@ -298,6 +304,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -329,6 +339,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -480,7 +494,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return InvitePage(self._version, response, self._solution) async def page_async( @@ -510,8 +530,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return InvitePage(self._version, response, self._solution) diff --git a/twilio/rest/chat/v1/service/channel/member.py b/twilio/rest/chat/v1/service/channel/member.py index 405662f02d..1262703ddc 100644 --- a/twilio/rest/chat/v1/service/channel/member.py +++ b/twilio/rest/chat/v1/service/channel/member.py @@ -205,10 +205,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -217,9 +217,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> MemberInstance: @@ -230,10 +232,11 @@ def fetch(self) -> MemberInstance: :returns: The fetched MemberInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return MemberInstance( self._version, @@ -251,9 +254,12 @@ async def fetch_async(self) -> MemberInstance: :returns: The fetched MemberInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return MemberInstance( @@ -277,17 +283,21 @@ def update( :returns: The updated MemberInstance """ + data = values.of( { "RoleSid": role_sid, "LastConsumedMessageIndex": last_consumed_message_index, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return MemberInstance( @@ -311,17 +321,21 @@ async def update_async( :returns: The updated MemberInstance """ + data = values.of( { "RoleSid": role_sid, "LastConsumedMessageIndex": last_consumed_message_index, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return MemberInstance( @@ -408,6 +422,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -439,6 +457,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -590,7 +612,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return MemberPage(self._version, response, self._solution) async def page_async( @@ -620,8 +648,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return MemberPage(self._version, response, self._solution) diff --git a/twilio/rest/chat/v1/service/channel/message.py b/twilio/rest/chat/v1/service/channel/message.py index 34d9e01fb3..e7cfc9217d 100644 --- a/twilio/rest/chat/v1/service/channel/message.py +++ b/twilio/rest/chat/v1/service/channel/message.py @@ -210,10 +210,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -222,9 +222,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> MessageInstance: @@ -235,10 +237,11 @@ def fetch(self) -> MessageInstance: :returns: The fetched MessageInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return MessageInstance( self._version, @@ -256,9 +259,12 @@ async def fetch_async(self) -> MessageInstance: :returns: The fetched MessageInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return MessageInstance( @@ -282,17 +288,21 @@ def update( :returns: The updated MessageInstance """ + data = values.of( { "Body": body, "Attributes": attributes, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return MessageInstance( @@ -316,17 +326,21 @@ async def update_async( :returns: The updated MessageInstance """ + data = values.of( { "Body": body, "Attributes": attributes, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return MessageInstance( @@ -418,6 +432,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -454,6 +472,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -605,7 +627,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return MessagePage(self._version, response, self._solution) async def page_async( @@ -635,8 +663,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return MessagePage(self._version, response, self._solution) diff --git a/twilio/rest/chat/v1/service/role.py b/twilio/rest/chat/v1/service/role.py index 3ed57a6ee2..d81cbd55ac 100644 --- a/twilio/rest/chat/v1/service/role.py +++ b/twilio/rest/chat/v1/service/role.py @@ -181,10 +181,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -193,9 +193,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> RoleInstance: @@ -206,10 +208,11 @@ def fetch(self) -> RoleInstance: :returns: The fetched RoleInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return RoleInstance( self._version, @@ -226,9 +229,12 @@ async def fetch_async(self) -> RoleInstance: :returns: The fetched RoleInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return RoleInstance( @@ -246,16 +252,20 @@ def update(self, permission: List[str]) -> RoleInstance: :returns: The updated RoleInstance """ + data = values.of( { "Permission": serialize.map(permission, lambda e: e), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RoleInstance( @@ -273,16 +283,20 @@ async def update_async(self, permission: List[str]) -> RoleInstance: :returns: The updated RoleInstance """ + data = values.of( { "Permission": serialize.map(permission, lambda e: e), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RoleInstance( @@ -363,6 +377,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -393,6 +411,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -528,7 +550,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return RolePage(self._version, response, self._solution) async def page_async( @@ -555,8 +583,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return RolePage(self._version, response, self._solution) diff --git a/twilio/rest/chat/v1/service/user/__init__.py b/twilio/rest/chat/v1/service/user/__init__.py index 13c4b9bef6..c6b900957c 100644 --- a/twilio/rest/chat/v1/service/user/__init__.py +++ b/twilio/rest/chat/v1/service/user/__init__.py @@ -216,10 +216,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -228,9 +228,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> UserInstance: @@ -241,10 +243,11 @@ def fetch(self) -> UserInstance: :returns: The fetched UserInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return UserInstance( self._version, @@ -261,9 +264,12 @@ async def fetch_async(self) -> UserInstance: :returns: The fetched UserInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return UserInstance( @@ -288,6 +294,7 @@ def update( :returns: The updated UserInstance """ + data = values.of( { "RoleSid": role_sid, @@ -295,11 +302,14 @@ def update( "FriendlyName": friendly_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return UserInstance( @@ -324,6 +334,7 @@ async def update_async( :returns: The updated UserInstance """ + data = values.of( { "RoleSid": role_sid, @@ -331,11 +342,14 @@ async def update_async( "FriendlyName": friendly_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return UserInstance( @@ -435,6 +449,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -471,6 +489,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -606,7 +628,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return UserPage(self._version, response, self._solution) async def page_async( @@ -633,8 +661,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return UserPage(self._version, response, self._solution) diff --git a/twilio/rest/chat/v1/service/user/user_channel.py b/twilio/rest/chat/v1/service/user/user_channel.py index 01e639ceab..b7f35aa9ef 100644 --- a/twilio/rest/chat/v1/service/user/user_channel.py +++ b/twilio/rest/chat/v1/service/user/user_channel.py @@ -247,7 +247,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return UserChannelPage(self._version, response, self._solution) async def page_async( @@ -274,8 +280,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return UserChannelPage(self._version, response, self._solution) diff --git a/twilio/rest/chat/v2/credential.py b/twilio/rest/chat/v2/credential.py index b098f6820c..5479abeca0 100644 --- a/twilio/rest/chat/v2/credential.py +++ b/twilio/rest/chat/v2/credential.py @@ -208,10 +208,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -220,9 +220,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> CredentialInstance: @@ -233,10 +235,11 @@ def fetch(self) -> CredentialInstance: :returns: The fetched CredentialInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return CredentialInstance( self._version, @@ -252,9 +255,12 @@ async def fetch_async(self) -> CredentialInstance: :returns: The fetched CredentialInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return CredentialInstance( @@ -284,6 +290,7 @@ def update( :returns: The updated CredentialInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -294,11 +301,14 @@ def update( "Secret": secret, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CredentialInstance(self._version, payload, sid=self._solution["sid"]) @@ -324,6 +334,7 @@ async def update_async( :returns: The updated CredentialInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -334,11 +345,14 @@ async def update_async( "Secret": secret, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CredentialInstance(self._version, payload, sid=self._solution["sid"]) @@ -422,6 +436,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -465,6 +483,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -598,7 +620,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return CredentialPage(self._version, response) async def page_async( @@ -625,8 +653,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return CredentialPage(self._version, response) diff --git a/twilio/rest/chat/v2/service/__init__.py b/twilio/rest/chat/v2/service/__init__.py index 376043aed6..90a6c6cdba 100644 --- a/twilio/rest/chat/v2/service/__init__.py +++ b/twilio/rest/chat/v2/service/__init__.py @@ -437,10 +437,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -449,9 +449,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> ServiceInstance: @@ -462,10 +464,11 @@ def fetch(self) -> ServiceInstance: :returns: The fetched ServiceInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ServiceInstance( self._version, @@ -481,9 +484,12 @@ async def fetch_async(self) -> ServiceInstance: :returns: The fetched ServiceInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ServiceInstance( @@ -565,6 +571,7 @@ def update( :returns: The updated ServiceInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -614,11 +621,14 @@ def update( ), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload, sid=self._solution["sid"]) @@ -696,6 +706,7 @@ async def update_async( :returns: The updated ServiceInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -745,11 +756,14 @@ async def update_async( ), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload, sid=self._solution["sid"]) @@ -860,6 +874,10 @@ def create(self, friendly_name: str) -> ServiceInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -882,6 +900,10 @@ async def create_async(self, friendly_name: str) -> ServiceInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -1015,7 +1037,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ServicePage(self._version, response) async def page_async( @@ -1042,8 +1070,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ServicePage(self._version, response) diff --git a/twilio/rest/chat/v2/service/binding.py b/twilio/rest/chat/v2/service/binding.py index 2f960c5135..125f4b9368 100644 --- a/twilio/rest/chat/v2/service/binding.py +++ b/twilio/rest/chat/v2/service/binding.py @@ -166,10 +166,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -178,9 +178,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> BindingInstance: @@ -191,10 +193,11 @@ def fetch(self) -> BindingInstance: :returns: The fetched BindingInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return BindingInstance( self._version, @@ -211,9 +214,12 @@ async def fetch_async(self) -> BindingInstance: :returns: The fetched BindingInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return BindingInstance( @@ -429,7 +435,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return BindingPage(self._version, response, self._solution) async def page_async( @@ -462,8 +474,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return BindingPage(self._version, response, self._solution) diff --git a/twilio/rest/chat/v2/service/channel/__init__.py b/twilio/rest/chat/v2/service/channel/__init__.py index b3796c30d8..36d08a3896 100644 --- a/twilio/rest/chat/v2/service/channel/__init__.py +++ b/twilio/rest/chat/v2/service/channel/__init__.py @@ -310,6 +310,8 @@ def delete( } ) + headers = values.of({}) + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async( @@ -331,6 +333,8 @@ async def delete_async( } ) + headers = values.of({}) + return await self._version.delete_async( method="DELETE", uri=self._uri, headers=headers ) @@ -343,10 +347,11 @@ def fetch(self) -> ChannelInstance: :returns: The fetched ChannelInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ChannelInstance( self._version, @@ -363,9 +368,12 @@ async def fetch_async(self) -> ChannelInstance: :returns: The fetched ChannelInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ChannelInstance( @@ -400,6 +408,7 @@ def update( :returns: The updated ChannelInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -410,11 +419,20 @@ def update( "CreatedBy": created_by, } ) - headers = values.of( - { - "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, - } - ) + headers = values.of({}) + + if not ( + x_twilio_webhook_enabled is values.unset + or ( + isinstance(x_twilio_webhook_enabled, str) + and not x_twilio_webhook_enabled + ) + ): + headers["X-Twilio-Webhook-Enabled"] = x_twilio_webhook_enabled + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( method="POST", uri=self._uri, data=data, headers=headers @@ -452,6 +470,7 @@ async def update_async( :returns: The updated ChannelInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -462,11 +481,20 @@ async def update_async( "CreatedBy": created_by, } ) - headers = values.of( - { - "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, - } - ) + headers = values.of({}) + + if not ( + x_twilio_webhook_enabled is values.unset + or ( + isinstance(x_twilio_webhook_enabled, str) + and not x_twilio_webhook_enabled + ) + ): + headers["X-Twilio-Webhook-Enabled"] = x_twilio_webhook_enabled + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( method="POST", uri=self._uri, data=data, headers=headers @@ -626,6 +654,10 @@ def create( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -680,6 +712,10 @@ async def create_async( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -828,7 +864,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ChannelPage(self._version, response, self._solution) async def page_async( @@ -858,8 +900,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ChannelPage(self._version, response, self._solution) diff --git a/twilio/rest/chat/v2/service/channel/invite.py b/twilio/rest/chat/v2/service/channel/invite.py index d0ef32e345..7c7f9f6211 100644 --- a/twilio/rest/chat/v2/service/channel/invite.py +++ b/twilio/rest/chat/v2/service/channel/invite.py @@ -163,10 +163,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -175,9 +175,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> InviteInstance: @@ -188,10 +190,11 @@ def fetch(self) -> InviteInstance: :returns: The fetched InviteInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return InviteInstance( self._version, @@ -209,9 +212,12 @@ async def fetch_async(self) -> InviteInstance: :returns: The fetched InviteInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return InviteInstance( @@ -298,6 +304,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -329,6 +339,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -480,7 +494,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return InvitePage(self._version, response, self._solution) async def page_async( @@ -510,8 +530,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return InvitePage(self._version, response, self._solution) diff --git a/twilio/rest/chat/v2/service/channel/member.py b/twilio/rest/chat/v2/service/channel/member.py index 95e737b82a..f07cb21891 100644 --- a/twilio/rest/chat/v2/service/channel/member.py +++ b/twilio/rest/chat/v2/service/channel/member.py @@ -274,6 +274,8 @@ def delete( } ) + headers = values.of({}) + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async( @@ -295,6 +297,8 @@ async def delete_async( } ) + headers = values.of({}) + return await self._version.delete_async( method="DELETE", uri=self._uri, headers=headers ) @@ -307,10 +311,11 @@ def fetch(self) -> MemberInstance: :returns: The fetched MemberInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return MemberInstance( self._version, @@ -328,9 +333,12 @@ async def fetch_async(self) -> MemberInstance: :returns: The fetched MemberInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return MemberInstance( @@ -366,6 +374,7 @@ def update( :returns: The updated MemberInstance """ + data = values.of( { "RoleSid": role_sid, @@ -378,11 +387,20 @@ def update( "Attributes": attributes, } ) - headers = values.of( - { - "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, - } - ) + headers = values.of({}) + + if not ( + x_twilio_webhook_enabled is values.unset + or ( + isinstance(x_twilio_webhook_enabled, str) + and not x_twilio_webhook_enabled + ) + ): + headers["X-Twilio-Webhook-Enabled"] = x_twilio_webhook_enabled + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( method="POST", uri=self._uri, data=data, headers=headers @@ -421,6 +439,7 @@ async def update_async( :returns: The updated MemberInstance """ + data = values.of( { "RoleSid": role_sid, @@ -433,11 +452,20 @@ async def update_async( "Attributes": attributes, } ) - headers = values.of( - { - "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, - } - ) + headers = values.of({}) + + if not ( + x_twilio_webhook_enabled is values.unset + or ( + isinstance(x_twilio_webhook_enabled, str) + and not x_twilio_webhook_enabled + ) + ): + headers["X-Twilio-Webhook-Enabled"] = x_twilio_webhook_enabled + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( method="POST", uri=self._uri, data=data, headers=headers @@ -555,6 +583,10 @@ def create( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -614,6 +646,10 @@ async def create_async( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -765,7 +801,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return MemberPage(self._version, response, self._solution) async def page_async( @@ -795,8 +837,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return MemberPage(self._version, response, self._solution) diff --git a/twilio/rest/chat/v2/service/channel/message.py b/twilio/rest/chat/v2/service/channel/message.py index 1b2892176e..d0bf2e5ac7 100644 --- a/twilio/rest/chat/v2/service/channel/message.py +++ b/twilio/rest/chat/v2/service/channel/message.py @@ -282,6 +282,8 @@ def delete( } ) + headers = values.of({}) + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async( @@ -303,6 +305,8 @@ async def delete_async( } ) + headers = values.of({}) + return await self._version.delete_async( method="DELETE", uri=self._uri, headers=headers ) @@ -315,10 +319,11 @@ def fetch(self) -> MessageInstance: :returns: The fetched MessageInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return MessageInstance( self._version, @@ -336,9 +341,12 @@ async def fetch_async(self) -> MessageInstance: :returns: The fetched MessageInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return MessageInstance( @@ -374,6 +382,7 @@ def update( :returns: The updated MessageInstance """ + data = values.of( { "Body": body, @@ -384,11 +393,20 @@ def update( "From": from_, } ) - headers = values.of( - { - "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, - } - ) + headers = values.of({}) + + if not ( + x_twilio_webhook_enabled is values.unset + or ( + isinstance(x_twilio_webhook_enabled, str) + and not x_twilio_webhook_enabled + ) + ): + headers["X-Twilio-Webhook-Enabled"] = x_twilio_webhook_enabled + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( method="POST", uri=self._uri, data=data, headers=headers @@ -427,6 +445,7 @@ async def update_async( :returns: The updated MessageInstance """ + data = values.of( { "Body": body, @@ -437,11 +456,20 @@ async def update_async( "From": from_, } ) - headers = values.of( - { - "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, - } - ) + headers = values.of({}) + + if not ( + x_twilio_webhook_enabled is values.unset + or ( + isinstance(x_twilio_webhook_enabled, str) + and not x_twilio_webhook_enabled + ) + ): + headers["X-Twilio-Webhook-Enabled"] = x_twilio_webhook_enabled + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( method="POST", uri=self._uri, data=data, headers=headers @@ -557,6 +585,10 @@ def create( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -614,6 +646,10 @@ async def create_async( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -765,7 +801,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return MessagePage(self._version, response, self._solution) async def page_async( @@ -795,8 +837,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return MessagePage(self._version, response, self._solution) diff --git a/twilio/rest/chat/v2/service/channel/webhook.py b/twilio/rest/chat/v2/service/channel/webhook.py index bc38198256..3e31df4288 100644 --- a/twilio/rest/chat/v2/service/channel/webhook.py +++ b/twilio/rest/chat/v2/service/channel/webhook.py @@ -231,10 +231,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -243,9 +243,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> WebhookInstance: @@ -256,10 +258,11 @@ def fetch(self) -> WebhookInstance: :returns: The fetched WebhookInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return WebhookInstance( self._version, @@ -277,9 +280,12 @@ async def fetch_async(self) -> WebhookInstance: :returns: The fetched WebhookInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return WebhookInstance( @@ -311,6 +317,7 @@ def update( :returns: The updated WebhookInstance """ + data = values.of( { "Configuration.Url": configuration_url, @@ -325,11 +332,14 @@ def update( "Configuration.RetryCount": configuration_retry_count, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return WebhookInstance( @@ -361,6 +371,7 @@ async def update_async( :returns: The updated WebhookInstance """ + data = values.of( { "Configuration.Url": configuration_url, @@ -375,11 +386,14 @@ async def update_async( "Configuration.RetryCount": configuration_retry_count, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return WebhookInstance( @@ -487,6 +501,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -539,6 +557,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -677,7 +699,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return WebhookPage(self._version, response, self._solution) async def page_async( @@ -704,8 +732,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return WebhookPage(self._version, response, self._solution) diff --git a/twilio/rest/chat/v2/service/role.py b/twilio/rest/chat/v2/service/role.py index bcc0b6e5a9..fef06436d0 100644 --- a/twilio/rest/chat/v2/service/role.py +++ b/twilio/rest/chat/v2/service/role.py @@ -181,10 +181,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -193,9 +193,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> RoleInstance: @@ -206,10 +208,11 @@ def fetch(self) -> RoleInstance: :returns: The fetched RoleInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return RoleInstance( self._version, @@ -226,9 +229,12 @@ async def fetch_async(self) -> RoleInstance: :returns: The fetched RoleInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return RoleInstance( @@ -246,16 +252,20 @@ def update(self, permission: List[str]) -> RoleInstance: :returns: The updated RoleInstance """ + data = values.of( { "Permission": serialize.map(permission, lambda e: e), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RoleInstance( @@ -273,16 +283,20 @@ async def update_async(self, permission: List[str]) -> RoleInstance: :returns: The updated RoleInstance """ + data = values.of( { "Permission": serialize.map(permission, lambda e: e), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RoleInstance( @@ -363,6 +377,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -393,6 +411,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -528,7 +550,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return RolePage(self._version, response, self._solution) async def page_async( @@ -555,8 +583,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return RolePage(self._version, response, self._solution) diff --git a/twilio/rest/chat/v2/service/user/__init__.py b/twilio/rest/chat/v2/service/user/__init__.py index 768b78876e..9fbde6feda 100644 --- a/twilio/rest/chat/v2/service/user/__init__.py +++ b/twilio/rest/chat/v2/service/user/__init__.py @@ -240,10 +240,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -252,9 +252,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> UserInstance: @@ -265,10 +267,11 @@ def fetch(self) -> UserInstance: :returns: The fetched UserInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return UserInstance( self._version, @@ -285,9 +288,12 @@ async def fetch_async(self) -> UserInstance: :returns: The fetched UserInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return UserInstance( @@ -316,6 +322,7 @@ def update( :returns: The updated UserInstance """ + data = values.of( { "RoleSid": role_sid, @@ -323,11 +330,20 @@ def update( "FriendlyName": friendly_name, } ) - headers = values.of( - { - "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, - } - ) + headers = values.of({}) + + if not ( + x_twilio_webhook_enabled is values.unset + or ( + isinstance(x_twilio_webhook_enabled, str) + and not x_twilio_webhook_enabled + ) + ): + headers["X-Twilio-Webhook-Enabled"] = x_twilio_webhook_enabled + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( method="POST", uri=self._uri, data=data, headers=headers @@ -359,6 +375,7 @@ async def update_async( :returns: The updated UserInstance """ + data = values.of( { "RoleSid": role_sid, @@ -366,11 +383,20 @@ async def update_async( "FriendlyName": friendly_name, } ) - headers = values.of( - { - "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, - } - ) + headers = values.of({}) + + if not ( + x_twilio_webhook_enabled is values.unset + or ( + isinstance(x_twilio_webhook_enabled, str) + and not x_twilio_webhook_enabled + ) + ): + headers["X-Twilio-Webhook-Enabled"] = x_twilio_webhook_enabled + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( method="POST", uri=self._uri, data=data, headers=headers @@ -495,6 +521,10 @@ def create( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -540,6 +570,10 @@ async def create_async( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -675,7 +709,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return UserPage(self._version, response, self._solution) async def page_async( @@ -702,8 +742,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return UserPage(self._version, response, self._solution) diff --git a/twilio/rest/chat/v2/service/user/user_binding.py b/twilio/rest/chat/v2/service/user/user_binding.py index 4170c74fb6..8d79c551af 100644 --- a/twilio/rest/chat/v2/service/user/user_binding.py +++ b/twilio/rest/chat/v2/service/user/user_binding.py @@ -173,10 +173,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -185,9 +185,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> UserBindingInstance: @@ -198,10 +200,11 @@ def fetch(self) -> UserBindingInstance: :returns: The fetched UserBindingInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return UserBindingInstance( self._version, @@ -219,9 +222,12 @@ async def fetch_async(self) -> UserBindingInstance: :returns: The fetched UserBindingInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return UserBindingInstance( @@ -440,7 +446,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return UserBindingPage(self._version, response, self._solution) async def page_async( @@ -472,8 +484,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return UserBindingPage(self._version, response, self._solution) diff --git a/twilio/rest/chat/v2/service/user/user_channel.py b/twilio/rest/chat/v2/service/user/user_channel.py index 1fd25254a5..9fab357368 100644 --- a/twilio/rest/chat/v2/service/user/user_channel.py +++ b/twilio/rest/chat/v2/service/user/user_channel.py @@ -259,6 +259,8 @@ def delete( } ) + headers = values.of({}) + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async( @@ -280,6 +282,8 @@ async def delete_async( } ) + headers = values.of({}) + return await self._version.delete_async( method="DELETE", uri=self._uri, headers=headers ) @@ -292,10 +296,11 @@ def fetch(self) -> UserChannelInstance: :returns: The fetched UserChannelInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return UserChannelInstance( self._version, @@ -313,9 +318,12 @@ async def fetch_async(self) -> UserChannelInstance: :returns: The fetched UserChannelInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return UserChannelInstance( @@ -343,6 +351,7 @@ def update( :returns: The updated UserChannelInstance """ + data = values.of( { "NotificationLevel": notification_level, @@ -352,11 +361,14 @@ def update( ), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return UserChannelInstance( @@ -384,6 +396,7 @@ async def update_async( :returns: The updated UserChannelInstance """ + data = values.of( { "NotificationLevel": notification_level, @@ -393,11 +406,14 @@ async def update_async( ), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return UserChannelInstance( @@ -591,7 +607,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return UserChannelPage(self._version, response, self._solution) async def page_async( @@ -618,8 +640,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return UserChannelPage(self._version, response, self._solution) diff --git a/twilio/rest/chat/v3/channel.py b/twilio/rest/chat/v3/channel.py index e9d10b55bf..4682838fba 100644 --- a/twilio/rest/chat/v3/channel.py +++ b/twilio/rest/chat/v3/channel.py @@ -194,17 +194,27 @@ def update( :returns: The updated ChannelInstance """ + data = values.of( { "Type": type, "MessagingServiceSid": messaging_service_sid, } ) - headers = values.of( - { - "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, - } - ) + headers = values.of({}) + + if not ( + x_twilio_webhook_enabled is values.unset + or ( + isinstance(x_twilio_webhook_enabled, str) + and not x_twilio_webhook_enabled + ) + ): + headers["X-Twilio-Webhook-Enabled"] = x_twilio_webhook_enabled + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( method="POST", uri=self._uri, data=data, headers=headers @@ -234,17 +244,27 @@ async def update_async( :returns: The updated ChannelInstance """ + data = values.of( { "Type": type, "MessagingServiceSid": messaging_service_sid, } ) - headers = values.of( - { - "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, - } - ) + headers = values.of({}) + + if not ( + x_twilio_webhook_enabled is values.unset + or ( + isinstance(x_twilio_webhook_enabled, str) + and not x_twilio_webhook_enabled + ) + ): + headers["X-Twilio-Webhook-Enabled"] = x_twilio_webhook_enabled + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( method="POST", uri=self._uri, data=data, headers=headers diff --git a/twilio/rest/content/v1/content/__init__.py b/twilio/rest/content/v1/content/__init__.py index b5261516a6..d877b63bc4 100644 --- a/twilio/rest/content/v1/content/__init__.py +++ b/twilio/rest/content/v1/content/__init__.py @@ -26,145 +26,1583 @@ class ContentInstance(InstanceResource): + class AuthenticationAction(object): + """ + :ivar type: + :ivar copy_code_text: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.type: Optional["ContentInstance.AuthenticationActionType"] = ( + payload.get("type") + ) + self.copy_code_text: Optional[str] = payload.get("copy_code_text") + + def to_dict(self): + return { + "type": self.type, + "copy_code_text": self.copy_code_text, + } + + class CallToActionAction(object): + """ + :ivar type: + :ivar title: + :ivar url: + :ivar phone: + :ivar code: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.type: Optional["ContentInstance.CallToActionActionType"] = payload.get( + "type" + ) + self.title: Optional[str] = payload.get("title") + self.url: Optional[str] = payload.get("url") + self.phone: Optional[str] = payload.get("phone") + self.code: Optional[str] = payload.get("code") + + def to_dict(self): + return { + "type": self.type, + "title": self.title, + "url": self.url, + "phone": self.phone, + "code": self.code, + } + + class CardAction(object): + """ + :ivar type: + :ivar title: + :ivar url: + :ivar phone: + :ivar id: + :ivar code: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.type: Optional["ContentInstance.CardActionType"] = payload.get("type") + self.title: Optional[str] = payload.get("title") + self.url: Optional[str] = payload.get("url") + self.phone: Optional[str] = payload.get("phone") + self.id: Optional[str] = payload.get("id") + self.code: Optional[str] = payload.get("code") + + def to_dict(self): + return { + "type": self.type, + "title": self.title, + "url": self.url, + "phone": self.phone, + "id": self.id, + "code": self.code, + } + + class CarouselAction(object): + """ + :ivar type: + :ivar title: + :ivar url: + :ivar phone: + :ivar id: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.type: Optional["ContentInstance.CarouselActionType"] = payload.get( + "type" + ) + self.title: Optional[str] = payload.get("title") + self.url: Optional[str] = payload.get("url") + self.phone: Optional[str] = payload.get("phone") + self.id: Optional[str] = payload.get("id") + + def to_dict(self): + return { + "type": self.type, + "title": self.title, + "url": self.url, + "phone": self.phone, + "id": self.id, + } + + class CarouselCard(object): + """ + :ivar title: + :ivar body: + :ivar media: + :ivar actions: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.title: Optional[str] = payload.get("title") + self.body: Optional[str] = payload.get("body") + self.media: Optional[str] = payload.get("media") + self.actions: Optional[List[ContentList.CarouselAction]] = payload.get( + "actions" + ) + + def to_dict(self): + return { + "title": self.title, + "body": self.body, + "media": self.media, + "actions": ( + [actions.to_dict() for actions in self.actions] + if self.actions is not None + else None + ), + } + + class CatalogItem(object): + """ + :ivar id: + :ivar section_title: + :ivar name: + :ivar media_url: + :ivar price: + :ivar description: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.id: Optional[str] = payload.get("id") + self.section_title: Optional[str] = payload.get("section_title") + self.name: Optional[str] = payload.get("name") + self.media_url: Optional[str] = payload.get("media_url") + self.price: Optional[float] = payload.get("price") + self.description: Optional[str] = payload.get("description") + + def to_dict(self): + return { + "id": self.id, + "section_title": self.section_title, + "name": self.name, + "media_url": self.media_url, + "price": self.price, + "description": self.description, + } + + class ContentCreateRequest(object): + """ + :ivar friendly_name: User defined name of the content + :ivar variables: Key value pairs of variable name to value + :ivar language: Language code for the content + :ivar types: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.variables: Optional[dict[str, str]] = payload.get("variables") + self.language: Optional[str] = payload.get("language") + self.types: Optional[ContentList.Types] = payload.get("types") + + def to_dict(self): + return { + "friendly_name": self.friendly_name, + "variables": self.variables, + "language": self.language, + "types": self.types.to_dict() if self.types is not None else None, + } + + class FlowsPage(object): + """ + :ivar id: + :ivar next_page_id: + :ivar title: + :ivar subtitle: + :ivar layout: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.id: Optional[str] = payload.get("id") + self.next_page_id: Optional[str] = payload.get("next_page_id") + self.title: Optional[str] = payload.get("title") + self.subtitle: Optional[str] = payload.get("subtitle") + self.layout: Optional[List[ContentList.FlowsPageComponent]] = payload.get( + "layout" + ) + + def to_dict(self): + return { + "id": self.id, + "next_page_id": self.next_page_id, + "title": self.title, + "subtitle": self.subtitle, + "layout": ( + [layout.to_dict() for layout in self.layout] + if self.layout is not None + else None + ), + } + + class FlowsPageComponent(object): + """ + :ivar label: + :ivar type: + :ivar text: + :ivar options: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.label: Optional[str] = payload.get("label") + self.type: Optional[str] = payload.get("type") + self.text: Optional[str] = payload.get("text") + self.options: Optional[List[ContentList.FlowsPageComponentSelectItem]] = ( + payload.get("options") + ) + + def to_dict(self): + return { + "label": self.label, + "type": self.type, + "text": self.text, + "options": ( + [options.to_dict() for options in self.options] + if self.options is not None + else None + ), + } + + class FlowsPageComponentSelectItem(object): + """ + :ivar id: + :ivar title: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.id: Optional[str] = payload.get("id") + self.title: Optional[str] = payload.get("title") + + def to_dict(self): + return { + "id": self.id, + "title": self.title, + } + + class ListItem(object): + """ + :ivar id: + :ivar item: + :ivar description: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.id: Optional[str] = payload.get("id") + self.item: Optional[str] = payload.get("item") + self.description: Optional[str] = payload.get("description") + + def to_dict(self): + return { + "id": self.id, + "item": self.item, + "description": self.description, + } + + class QuickReplyAction(object): + """ + :ivar type: + :ivar title: + :ivar id: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.type: Optional["ContentInstance.QuickReplyActionType"] = payload.get( + "type" + ) + self.title: Optional[str] = payload.get("title") + self.id: Optional[str] = payload.get("id") + + def to_dict(self): + return { + "type": self.type, + "title": self.title, + "id": self.id, + } + + class TwilioCallToAction(object): + """ + :ivar body: + :ivar actions: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.body: Optional[str] = payload.get("body") + self.actions: Optional[List[ContentList.CallToActionAction]] = payload.get( + "actions" + ) + + def to_dict(self): + return { + "body": self.body, + "actions": ( + [actions.to_dict() for actions in self.actions] + if self.actions is not None + else None + ), + } + + class TwilioCard(object): + """ + :ivar title: + :ivar subtitle: + :ivar media: + :ivar actions: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.title: Optional[str] = payload.get("title") + self.subtitle: Optional[str] = payload.get("subtitle") + self.media: Optional[List[str]] = payload.get("media") + self.actions: Optional[List[ContentList.CardAction]] = payload.get( + "actions" + ) + + def to_dict(self): + return { + "title": self.title, + "subtitle": self.subtitle, + "media": self.media, + "actions": ( + [actions.to_dict() for actions in self.actions] + if self.actions is not None + else None + ), + } + + class TwilioCarousel(object): + """ + :ivar body: + :ivar cards: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.body: Optional[str] = payload.get("body") + self.cards: Optional[List[ContentList.CarouselCard]] = payload.get("cards") + + def to_dict(self): + return { + "body": self.body, + "cards": ( + [cards.to_dict() for cards in self.cards] + if self.cards is not None + else None + ), + } + + class TwilioCatalog(object): + """ + :ivar title: + :ivar body: + :ivar subtitle: + :ivar id: + :ivar items: + :ivar dynamic_items: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.title: Optional[str] = payload.get("title") + self.body: Optional[str] = payload.get("body") + self.subtitle: Optional[str] = payload.get("subtitle") + self.id: Optional[str] = payload.get("id") + self.items: Optional[List[ContentList.CatalogItem]] = payload.get("items") + self.dynamic_items: Optional[str] = payload.get("dynamic_items") + + def to_dict(self): + return { + "title": self.title, + "body": self.body, + "subtitle": self.subtitle, + "id": self.id, + "items": ( + [items.to_dict() for items in self.items] + if self.items is not None + else None + ), + "dynamic_items": self.dynamic_items, + } + + class TwilioFlows(object): + """ + :ivar body: + :ivar button_text: + :ivar subtitle: + :ivar media_url: + :ivar pages: + :ivar type: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.body: Optional[str] = payload.get("body") + self.button_text: Optional[str] = payload.get("button_text") + self.subtitle: Optional[str] = payload.get("subtitle") + self.media_url: Optional[str] = payload.get("media_url") + self.pages: Optional[List[ContentList.FlowsPage]] = payload.get("pages") + self.type: Optional[str] = payload.get("type") + + def to_dict(self): + return { + "body": self.body, + "button_text": self.button_text, + "subtitle": self.subtitle, + "media_url": self.media_url, + "pages": ( + [pages.to_dict() for pages in self.pages] + if self.pages is not None + else None + ), + "type": self.type, + } + + class TwilioListPicker(object): + """ + :ivar body: + :ivar button: + :ivar items: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.body: Optional[str] = payload.get("body") + self.button: Optional[str] = payload.get("button") + self.items: Optional[List[ContentList.ListItem]] = payload.get("items") + + def to_dict(self): + return { + "body": self.body, + "button": self.button, + "items": ( + [items.to_dict() for items in self.items] + if self.items is not None + else None + ), + } + + class TwilioLocation(object): + """ + :ivar latitude: + :ivar longitude: + :ivar label: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.latitude: Optional[float] = payload.get("latitude") + self.longitude: Optional[float] = payload.get("longitude") + self.label: Optional[str] = payload.get("label") + + def to_dict(self): + return { + "latitude": self.latitude, + "longitude": self.longitude, + "label": self.label, + } + + class TwilioMedia(object): + """ + :ivar body: + :ivar media: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.body: Optional[str] = payload.get("body") + self.media: Optional[List[str]] = payload.get("media") + + def to_dict(self): + return { + "body": self.body, + "media": self.media, + } + + class TwilioQuickReply(object): + """ + :ivar body: + :ivar actions: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.body: Optional[str] = payload.get("body") + self.actions: Optional[List[ContentList.QuickReplyAction]] = payload.get( + "actions" + ) + + def to_dict(self): + return { + "body": self.body, + "actions": ( + [actions.to_dict() for actions in self.actions] + if self.actions is not None + else None + ), + } + + class TwilioText(object): + """ + :ivar body: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.body: Optional[str] = payload.get("body") + + def to_dict(self): + return { + "body": self.body, + } + + class Types(object): + """ + :ivar twilio_text: + :ivar twilio_media: + :ivar twilio_location: + :ivar twilio_list_picker: + :ivar twilio_call_to_action: + :ivar twilio_quick_reply: + :ivar twilio_card: + :ivar twilio_catalog: + :ivar twilio_carousel: + :ivar twilio_flows: + :ivar whatsapp_card: + :ivar whatsapp_authentication: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.twilio_text: Optional[ContentList.TwilioText] = payload.get( + "twilio_text" + ) + self.twilio_media: Optional[ContentList.TwilioMedia] = payload.get( + "twilio_media" + ) + self.twilio_location: Optional[ContentList.TwilioLocation] = payload.get( + "twilio_location" + ) + self.twilio_list_picker: Optional[ContentList.TwilioListPicker] = ( + payload.get("twilio_list_picker") + ) + self.twilio_call_to_action: Optional[ContentList.TwilioCallToAction] = ( + payload.get("twilio_call_to_action") + ) + self.twilio_quick_reply: Optional[ContentList.TwilioQuickReply] = ( + payload.get("twilio_quick_reply") + ) + self.twilio_card: Optional[ContentList.TwilioCard] = payload.get( + "twilio_card" + ) + self.twilio_catalog: Optional[ContentList.TwilioCatalog] = payload.get( + "twilio_catalog" + ) + self.twilio_carousel: Optional[ContentList.TwilioCarousel] = payload.get( + "twilio_carousel" + ) + self.twilio_flows: Optional[ContentList.TwilioFlows] = payload.get( + "twilio_flows" + ) + self.whatsapp_card: Optional[ContentList.WhatsappCard] = payload.get( + "whatsapp_card" + ) + self.whatsapp_authentication: Optional[ + ContentList.WhatsappAuthentication + ] = payload.get("whatsapp_authentication") + + def to_dict(self): + return { + "twilio_text": ( + self.twilio_text.to_dict() if self.twilio_text is not None else None + ), + "twilio_media": ( + self.twilio_media.to_dict() + if self.twilio_media is not None + else None + ), + "twilio_location": ( + self.twilio_location.to_dict() + if self.twilio_location is not None + else None + ), + "twilio_list_picker": ( + self.twilio_list_picker.to_dict() + if self.twilio_list_picker is not None + else None + ), + "twilio_call_to_action": ( + self.twilio_call_to_action.to_dict() + if self.twilio_call_to_action is not None + else None + ), + "twilio_quick_reply": ( + self.twilio_quick_reply.to_dict() + if self.twilio_quick_reply is not None + else None + ), + "twilio_card": ( + self.twilio_card.to_dict() if self.twilio_card is not None else None + ), + "twilio_catalog": ( + self.twilio_catalog.to_dict() + if self.twilio_catalog is not None + else None + ), + "twilio_carousel": ( + self.twilio_carousel.to_dict() + if self.twilio_carousel is not None + else None + ), + "twilio_flows": ( + self.twilio_flows.to_dict() + if self.twilio_flows is not None + else None + ), + "whatsapp_card": ( + self.whatsapp_card.to_dict() + if self.whatsapp_card is not None + else None + ), + "whatsapp_authentication": ( + self.whatsapp_authentication.to_dict() + if self.whatsapp_authentication is not None + else None + ), + } + + class WhatsappAuthentication(object): + """ + :ivar add_security_recommendation: + :ivar code_expiration_minutes: + :ivar actions: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.add_security_recommendation: Optional[bool] = payload.get( + "add_security_recommendation" + ) + self.code_expiration_minutes: Optional[float] = payload.get( + "code_expiration_minutes" + ) + self.actions: Optional[List[ContentList.AuthenticationAction]] = ( + payload.get("actions") + ) + + def to_dict(self): + return { + "add_security_recommendation": self.add_security_recommendation, + "code_expiration_minutes": self.code_expiration_minutes, + "actions": ( + [actions.to_dict() for actions in self.actions] + if self.actions is not None + else None + ), + } + + class WhatsappCard(object): + """ + :ivar body: + :ivar footer: + :ivar media: + :ivar header_text: + :ivar actions: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.body: Optional[str] = payload.get("body") + self.footer: Optional[str] = payload.get("footer") + self.media: Optional[List[str]] = payload.get("media") + self.header_text: Optional[str] = payload.get("header_text") + self.actions: Optional[List[ContentList.CardAction]] = payload.get( + "actions" + ) + + def to_dict(self): + return { + "body": self.body, + "footer": self.footer, + "media": self.media, + "header_text": self.header_text, + "actions": ( + [actions.to_dict() for actions in self.actions] + if self.actions is not None + else None + ), + } + class AuthenticationActionType(object): COPY_CODE = "COPY_CODE" - class CallToActionActionType(object): - URL = "URL" - PHONE_NUMBER = "PHONE_NUMBER" - COPY_CODE = "COPY_CODE" - VOICE_CALL = "VOICE_CALL" - VOICE_CALL_REQUEST = "VOICE_CALL_REQUEST" + class CallToActionActionType(object): + URL = "URL" + PHONE_NUMBER = "PHONE_NUMBER" + COPY_CODE = "COPY_CODE" + VOICE_CALL = "VOICE_CALL" + VOICE_CALL_REQUEST = "VOICE_CALL_REQUEST" + + class CardActionType(object): + URL = "URL" + PHONE_NUMBER = "PHONE_NUMBER" + QUICK_REPLY = "QUICK_REPLY" + COPY_CODE = "COPY_CODE" + VOICE_CALL = "VOICE_CALL" + + class CarouselActionType(object): + URL = "URL" + PHONE_NUMBER = "PHONE_NUMBER" + QUICK_REPLY = "QUICK_REPLY" + + class QuickReplyActionType(object): + QUICK_REPLY = "QUICK_REPLY" + + """ + :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar sid: The unique string that that we created to identify the Content resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/usage/api/account) that created Content resource. + :ivar friendly_name: A string name used to describe the Content resource. Not visible to the end recipient. + :ivar language: Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in. + :ivar variables: Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}. + :ivar types: The [Content types](https://www.twilio.com/docs/content-api/content-types-overview) (e.g. twilio/text) for this Content resource. + :ivar url: The URL of the resource, relative to `https://content.twilio.com`. + :ivar links: A list of links related to the Content resource, such as approval_fetch and approval_create + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): + super().__init__(version) + + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.language: Optional[str] = payload.get("language") + self.variables: Optional[Dict[str, object]] = payload.get("variables") + self.types: Optional[Dict[str, object]] = payload.get("types") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") + + self._solution = { + "sid": sid or self.sid, + } + self._context: Optional[ContentContext] = None + + @property + def _proxy(self) -> "ContentContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: ContentContext for this ContentInstance + """ + if self._context is None: + self._context = ContentContext( + self._version, + sid=self._solution["sid"], + ) + return self._context + + def delete(self) -> bool: + """ + Deletes the ContentInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the ContentInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def fetch(self) -> "ContentInstance": + """ + Fetch the ContentInstance + + + :returns: The fetched ContentInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "ContentInstance": + """ + Asynchronous coroutine to fetch the ContentInstance + + + :returns: The fetched ContentInstance + """ + return await self._proxy.fetch_async() + + @property + def approval_create(self) -> ApprovalCreateList: + """ + Access the approval_create + """ + return self._proxy.approval_create + + @property + def approval_fetch(self) -> ApprovalFetchList: + """ + Access the approval_fetch + """ + return self._proxy.approval_fetch + + 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 ContentContext(InstanceContext): + + class AuthenticationAction(object): + """ + :ivar type: + :ivar copy_code_text: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.type: Optional["ContentInstance.AuthenticationActionType"] = ( + payload.get("type") + ) + self.copy_code_text: Optional[str] = payload.get("copy_code_text") + + def to_dict(self): + return { + "type": self.type, + "copy_code_text": self.copy_code_text, + } + + class CallToActionAction(object): + """ + :ivar type: + :ivar title: + :ivar url: + :ivar phone: + :ivar code: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.type: Optional["ContentInstance.CallToActionActionType"] = payload.get( + "type" + ) + self.title: Optional[str] = payload.get("title") + self.url: Optional[str] = payload.get("url") + self.phone: Optional[str] = payload.get("phone") + self.code: Optional[str] = payload.get("code") + + def to_dict(self): + return { + "type": self.type, + "title": self.title, + "url": self.url, + "phone": self.phone, + "code": self.code, + } + + class CardAction(object): + """ + :ivar type: + :ivar title: + :ivar url: + :ivar phone: + :ivar id: + :ivar code: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.type: Optional["ContentInstance.CardActionType"] = payload.get("type") + self.title: Optional[str] = payload.get("title") + self.url: Optional[str] = payload.get("url") + self.phone: Optional[str] = payload.get("phone") + self.id: Optional[str] = payload.get("id") + self.code: Optional[str] = payload.get("code") + + def to_dict(self): + return { + "type": self.type, + "title": self.title, + "url": self.url, + "phone": self.phone, + "id": self.id, + "code": self.code, + } + + class CarouselAction(object): + """ + :ivar type: + :ivar title: + :ivar url: + :ivar phone: + :ivar id: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.type: Optional["ContentInstance.CarouselActionType"] = payload.get( + "type" + ) + self.title: Optional[str] = payload.get("title") + self.url: Optional[str] = payload.get("url") + self.phone: Optional[str] = payload.get("phone") + self.id: Optional[str] = payload.get("id") + + def to_dict(self): + return { + "type": self.type, + "title": self.title, + "url": self.url, + "phone": self.phone, + "id": self.id, + } + + class CarouselCard(object): + """ + :ivar title: + :ivar body: + :ivar media: + :ivar actions: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.title: Optional[str] = payload.get("title") + self.body: Optional[str] = payload.get("body") + self.media: Optional[str] = payload.get("media") + self.actions: Optional[List[ContentList.CarouselAction]] = payload.get( + "actions" + ) + + def to_dict(self): + return { + "title": self.title, + "body": self.body, + "media": self.media, + "actions": ( + [actions.to_dict() for actions in self.actions] + if self.actions is not None + else None + ), + } + + class CatalogItem(object): + """ + :ivar id: + :ivar section_title: + :ivar name: + :ivar media_url: + :ivar price: + :ivar description: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.id: Optional[str] = payload.get("id") + self.section_title: Optional[str] = payload.get("section_title") + self.name: Optional[str] = payload.get("name") + self.media_url: Optional[str] = payload.get("media_url") + self.price: Optional[float] = payload.get("price") + self.description: Optional[str] = payload.get("description") + + def to_dict(self): + return { + "id": self.id, + "section_title": self.section_title, + "name": self.name, + "media_url": self.media_url, + "price": self.price, + "description": self.description, + } + + class ContentCreateRequest(object): + """ + :ivar friendly_name: User defined name of the content + :ivar variables: Key value pairs of variable name to value + :ivar language: Language code for the content + :ivar types: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.variables: Optional[dict[str, str]] = payload.get("variables") + self.language: Optional[str] = payload.get("language") + self.types: Optional[ContentList.Types] = payload.get("types") + + def to_dict(self): + return { + "friendly_name": self.friendly_name, + "variables": self.variables, + "language": self.language, + "types": self.types.to_dict() if self.types is not None else None, + } + + class FlowsPage(object): + """ + :ivar id: + :ivar next_page_id: + :ivar title: + :ivar subtitle: + :ivar layout: + """ - class CardActionType(object): - URL = "URL" - PHONE_NUMBER = "PHONE_NUMBER" - QUICK_REPLY = "QUICK_REPLY" - COPY_CODE = "COPY_CODE" - VOICE_CALL = "VOICE_CALL" + def __init__(self, payload: Dict[str, Any]): - class CarouselActionType(object): - URL = "URL" - PHONE_NUMBER = "PHONE_NUMBER" - QUICK_REPLY = "QUICK_REPLY" + self.id: Optional[str] = payload.get("id") + self.next_page_id: Optional[str] = payload.get("next_page_id") + self.title: Optional[str] = payload.get("title") + self.subtitle: Optional[str] = payload.get("subtitle") + self.layout: Optional[List[ContentList.FlowsPageComponent]] = payload.get( + "layout" + ) - class QuickReplyActionType(object): - QUICK_REPLY = "QUICK_REPLY" + def to_dict(self): + return { + "id": self.id, + "next_page_id": self.next_page_id, + "title": self.title, + "subtitle": self.subtitle, + "layout": ( + [layout.to_dict() for layout in self.layout] + if self.layout is not None + else None + ), + } - """ - :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - :ivar sid: The unique string that that we created to identify the Content resource. - :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/usage/api/account) that created Content resource. - :ivar friendly_name: A string name used to describe the Content resource. Not visible to the end recipient. - :ivar language: Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in. - :ivar variables: Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}. - :ivar types: The [Content types](https://www.twilio.com/docs/content-api/content-types-overview) (e.g. twilio/text) for this Content resource. - :ivar url: The URL of the resource, relative to `https://content.twilio.com`. - :ivar links: A list of links related to the Content resource, such as approval_fetch and approval_create - """ + class FlowsPageComponent(object): + """ + :ivar label: + :ivar type: + :ivar text: + :ivar options: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.label: Optional[str] = payload.get("label") + self.type: Optional[str] = payload.get("type") + self.text: Optional[str] = payload.get("text") + self.options: Optional[List[ContentList.FlowsPageComponentSelectItem]] = ( + payload.get("options") + ) + + def to_dict(self): + return { + "label": self.label, + "type": self.type, + "text": self.text, + "options": ( + [options.to_dict() for options in self.options] + if self.options is not None + else None + ), + } + + class FlowsPageComponentSelectItem(object): + """ + :ivar id: + :ivar title: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.id: Optional[str] = payload.get("id") + self.title: Optional[str] = payload.get("title") + + def to_dict(self): + return { + "id": self.id, + "title": self.title, + } + + class ListItem(object): + """ + :ivar id: + :ivar item: + :ivar description: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.id: Optional[str] = payload.get("id") + self.item: Optional[str] = payload.get("item") + self.description: Optional[str] = payload.get("description") + + def to_dict(self): + return { + "id": self.id, + "item": self.item, + "description": self.description, + } + + class QuickReplyAction(object): + """ + :ivar type: + :ivar title: + :ivar id: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.type: Optional["ContentInstance.QuickReplyActionType"] = payload.get( + "type" + ) + self.title: Optional[str] = payload.get("title") + self.id: Optional[str] = payload.get("id") + + def to_dict(self): + return { + "type": self.type, + "title": self.title, + "id": self.id, + } + + class TwilioCallToAction(object): + """ + :ivar body: + :ivar actions: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.body: Optional[str] = payload.get("body") + self.actions: Optional[List[ContentList.CallToActionAction]] = payload.get( + "actions" + ) + + def to_dict(self): + return { + "body": self.body, + "actions": ( + [actions.to_dict() for actions in self.actions] + if self.actions is not None + else None + ), + } + + class TwilioCard(object): + """ + :ivar title: + :ivar subtitle: + :ivar media: + :ivar actions: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.title: Optional[str] = payload.get("title") + self.subtitle: Optional[str] = payload.get("subtitle") + self.media: Optional[List[str]] = payload.get("media") + self.actions: Optional[List[ContentList.CardAction]] = payload.get( + "actions" + ) + + def to_dict(self): + return { + "title": self.title, + "subtitle": self.subtitle, + "media": self.media, + "actions": ( + [actions.to_dict() for actions in self.actions] + if self.actions is not None + else None + ), + } + + class TwilioCarousel(object): + """ + :ivar body: + :ivar cards: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.body: Optional[str] = payload.get("body") + self.cards: Optional[List[ContentList.CarouselCard]] = payload.get("cards") + + def to_dict(self): + return { + "body": self.body, + "cards": ( + [cards.to_dict() for cards in self.cards] + if self.cards is not None + else None + ), + } + + class TwilioCatalog(object): + """ + :ivar title: + :ivar body: + :ivar subtitle: + :ivar id: + :ivar items: + :ivar dynamic_items: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.title: Optional[str] = payload.get("title") + self.body: Optional[str] = payload.get("body") + self.subtitle: Optional[str] = payload.get("subtitle") + self.id: Optional[str] = payload.get("id") + self.items: Optional[List[ContentList.CatalogItem]] = payload.get("items") + self.dynamic_items: Optional[str] = payload.get("dynamic_items") + + def to_dict(self): + return { + "title": self.title, + "body": self.body, + "subtitle": self.subtitle, + "id": self.id, + "items": ( + [items.to_dict() for items in self.items] + if self.items is not None + else None + ), + "dynamic_items": self.dynamic_items, + } + + class TwilioFlows(object): + """ + :ivar body: + :ivar button_text: + :ivar subtitle: + :ivar media_url: + :ivar pages: + :ivar type: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.body: Optional[str] = payload.get("body") + self.button_text: Optional[str] = payload.get("button_text") + self.subtitle: Optional[str] = payload.get("subtitle") + self.media_url: Optional[str] = payload.get("media_url") + self.pages: Optional[List[ContentList.FlowsPage]] = payload.get("pages") + self.type: Optional[str] = payload.get("type") + + def to_dict(self): + return { + "body": self.body, + "button_text": self.button_text, + "subtitle": self.subtitle, + "media_url": self.media_url, + "pages": ( + [pages.to_dict() for pages in self.pages] + if self.pages is not None + else None + ), + "type": self.type, + } + + class TwilioListPicker(object): + """ + :ivar body: + :ivar button: + :ivar items: + """ - def __init__( - self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None - ): - super().__init__(version) + def __init__(self, payload: Dict[str, Any]): - self.date_created: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("date_created") - ) - self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("date_updated") - ) - self.sid: Optional[str] = payload.get("sid") - self.account_sid: Optional[str] = payload.get("account_sid") - self.friendly_name: Optional[str] = payload.get("friendly_name") - self.language: Optional[str] = payload.get("language") - self.variables: Optional[Dict[str, object]] = payload.get("variables") - self.types: Optional[Dict[str, object]] = payload.get("types") - self.url: Optional[str] = payload.get("url") - self.links: Optional[Dict[str, object]] = payload.get("links") + self.body: Optional[str] = payload.get("body") + self.button: Optional[str] = payload.get("button") + self.items: Optional[List[ContentList.ListItem]] = payload.get("items") - self._solution = { - "sid": sid or self.sid, - } - self._context: Optional[ContentContext] = None + def to_dict(self): + return { + "body": self.body, + "button": self.button, + "items": ( + [items.to_dict() for items in self.items] + if self.items is not None + else None + ), + } - @property - def _proxy(self) -> "ContentContext": + class TwilioLocation(object): """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ContentContext for this ContentInstance + :ivar latitude: + :ivar longitude: + :ivar label: """ - if self._context is None: - self._context = ContentContext( - self._version, - sid=self._solution["sid"], - ) - return self._context - def delete(self) -> bool: - """ - Deletes the ContentInstance + def __init__(self, payload: Dict[str, Any]): + self.latitude: Optional[float] = payload.get("latitude") + self.longitude: Optional[float] = payload.get("longitude") + self.label: Optional[str] = payload.get("label") - :returns: True if delete succeeds, False otherwise - """ - return self._proxy.delete() + def to_dict(self): + return { + "latitude": self.latitude, + "longitude": self.longitude, + "label": self.label, + } - async def delete_async(self) -> bool: + class TwilioMedia(object): + """ + :ivar body: + :ivar media: """ - Asynchronous coroutine that deletes the ContentInstance + def __init__(self, payload: Dict[str, Any]): - :returns: True if delete succeeds, False otherwise - """ - return await self._proxy.delete_async() + self.body: Optional[str] = payload.get("body") + self.media: Optional[List[str]] = payload.get("media") - def fetch(self) -> "ContentInstance": + def to_dict(self): + return { + "body": self.body, + "media": self.media, + } + + class TwilioQuickReply(object): + """ + :ivar body: + :ivar actions: """ - Fetch the ContentInstance + def __init__(self, payload: Dict[str, Any]): - :returns: The fetched ContentInstance - """ - return self._proxy.fetch() + self.body: Optional[str] = payload.get("body") + self.actions: Optional[List[ContentList.QuickReplyAction]] = payload.get( + "actions" + ) - async def fetch_async(self) -> "ContentInstance": + def to_dict(self): + return { + "body": self.body, + "actions": ( + [actions.to_dict() for actions in self.actions] + if self.actions is not None + else None + ), + } + + class TwilioText(object): + """ + :ivar body: """ - Asynchronous coroutine to fetch the ContentInstance + def __init__(self, payload: Dict[str, Any]): - :returns: The fetched ContentInstance - """ - return await self._proxy.fetch_async() + self.body: Optional[str] = payload.get("body") - @property - def approval_create(self) -> ApprovalCreateList: + def to_dict(self): + return { + "body": self.body, + } + + class Types(object): """ - Access the approval_create + :ivar twilio_text: + :ivar twilio_media: + :ivar twilio_location: + :ivar twilio_list_picker: + :ivar twilio_call_to_action: + :ivar twilio_quick_reply: + :ivar twilio_card: + :ivar twilio_catalog: + :ivar twilio_carousel: + :ivar twilio_flows: + :ivar whatsapp_card: + :ivar whatsapp_authentication: """ - return self._proxy.approval_create - @property - def approval_fetch(self) -> ApprovalFetchList: + def __init__(self, payload: Dict[str, Any]): + + self.twilio_text: Optional[ContentList.TwilioText] = payload.get( + "twilio_text" + ) + self.twilio_media: Optional[ContentList.TwilioMedia] = payload.get( + "twilio_media" + ) + self.twilio_location: Optional[ContentList.TwilioLocation] = payload.get( + "twilio_location" + ) + self.twilio_list_picker: Optional[ContentList.TwilioListPicker] = ( + payload.get("twilio_list_picker") + ) + self.twilio_call_to_action: Optional[ContentList.TwilioCallToAction] = ( + payload.get("twilio_call_to_action") + ) + self.twilio_quick_reply: Optional[ContentList.TwilioQuickReply] = ( + payload.get("twilio_quick_reply") + ) + self.twilio_card: Optional[ContentList.TwilioCard] = payload.get( + "twilio_card" + ) + self.twilio_catalog: Optional[ContentList.TwilioCatalog] = payload.get( + "twilio_catalog" + ) + self.twilio_carousel: Optional[ContentList.TwilioCarousel] = payload.get( + "twilio_carousel" + ) + self.twilio_flows: Optional[ContentList.TwilioFlows] = payload.get( + "twilio_flows" + ) + self.whatsapp_card: Optional[ContentList.WhatsappCard] = payload.get( + "whatsapp_card" + ) + self.whatsapp_authentication: Optional[ + ContentList.WhatsappAuthentication + ] = payload.get("whatsapp_authentication") + + def to_dict(self): + return { + "twilio_text": ( + self.twilio_text.to_dict() if self.twilio_text is not None else None + ), + "twilio_media": ( + self.twilio_media.to_dict() + if self.twilio_media is not None + else None + ), + "twilio_location": ( + self.twilio_location.to_dict() + if self.twilio_location is not None + else None + ), + "twilio_list_picker": ( + self.twilio_list_picker.to_dict() + if self.twilio_list_picker is not None + else None + ), + "twilio_call_to_action": ( + self.twilio_call_to_action.to_dict() + if self.twilio_call_to_action is not None + else None + ), + "twilio_quick_reply": ( + self.twilio_quick_reply.to_dict() + if self.twilio_quick_reply is not None + else None + ), + "twilio_card": ( + self.twilio_card.to_dict() if self.twilio_card is not None else None + ), + "twilio_catalog": ( + self.twilio_catalog.to_dict() + if self.twilio_catalog is not None + else None + ), + "twilio_carousel": ( + self.twilio_carousel.to_dict() + if self.twilio_carousel is not None + else None + ), + "twilio_flows": ( + self.twilio_flows.to_dict() + if self.twilio_flows is not None + else None + ), + "whatsapp_card": ( + self.whatsapp_card.to_dict() + if self.whatsapp_card is not None + else None + ), + "whatsapp_authentication": ( + self.whatsapp_authentication.to_dict() + if self.whatsapp_authentication is not None + else None + ), + } + + class WhatsappAuthentication(object): """ - Access the approval_fetch + :ivar add_security_recommendation: + :ivar code_expiration_minutes: + :ivar actions: """ - return self._proxy.approval_fetch - def __repr__(self) -> str: - """ - Provide a friendly representation + def __init__(self, payload: Dict[str, Any]): - :returns: Machine friendly representation + self.add_security_recommendation: Optional[bool] = payload.get( + "add_security_recommendation" + ) + self.code_expiration_minutes: Optional[float] = payload.get( + "code_expiration_minutes" + ) + self.actions: Optional[List[ContentList.AuthenticationAction]] = ( + payload.get("actions") + ) + + def to_dict(self): + return { + "add_security_recommendation": self.add_security_recommendation, + "code_expiration_minutes": self.code_expiration_minutes, + "actions": ( + [actions.to_dict() for actions in self.actions] + if self.actions is not None + else None + ), + } + + class WhatsappCard(object): + """ + :ivar body: + :ivar footer: + :ivar media: + :ivar header_text: + :ivar actions: """ - context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) - return "".format(context) + def __init__(self, payload: Dict[str, Any]): -class ContentContext(InstanceContext): + self.body: Optional[str] = payload.get("body") + self.footer: Optional[str] = payload.get("footer") + self.media: Optional[List[str]] = payload.get("media") + self.header_text: Optional[str] = payload.get("header_text") + self.actions: Optional[List[ContentList.CardAction]] = payload.get( + "actions" + ) + + def to_dict(self): + return { + "body": self.body, + "footer": self.footer, + "media": self.media, + "header_text": self.header_text, + "actions": ( + [actions.to_dict() for actions in self.actions] + if self.actions is not None + else None + ), + } def __init__(self, version: Version, sid: str): """ @@ -191,10 +1629,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -203,9 +1641,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> ContentInstance: @@ -216,10 +1656,11 @@ def fetch(self) -> ContentInstance: :returns: The fetched ContentInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ContentInstance( self._version, @@ -235,9 +1676,12 @@ async def fetch_async(self) -> ContentInstance: :returns: The fetched ContentInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ContentInstance( @@ -427,7 +1871,11 @@ def to_dict(self): "title": self.title, "body": self.body, "media": self.media, - "actions": [actions.to_dict() for actions in self.actions], + "actions": ( + [actions.to_dict() for actions in self.actions] + if self.actions is not None + else None + ), } class CatalogItem(object): @@ -479,7 +1927,7 @@ def to_dict(self): "friendly_name": self.friendly_name, "variables": self.variables, "language": self.language, - "types": self.types.to_dict(), + "types": self.types.to_dict() if self.types is not None else None, } class FlowsPage(object): @@ -507,7 +1955,11 @@ def to_dict(self): "next_page_id": self.next_page_id, "title": self.title, "subtitle": self.subtitle, - "layout": [layout.to_dict() for layout in self.layout], + "layout": ( + [layout.to_dict() for layout in self.layout] + if self.layout is not None + else None + ), } class FlowsPageComponent(object): @@ -532,7 +1984,11 @@ def to_dict(self): "label": self.label, "type": self.type, "text": self.text, - "options": [options.to_dict() for options in self.options], + "options": ( + [options.to_dict() for options in self.options] + if self.options is not None + else None + ), } class FlowsPageComponentSelectItem(object): @@ -610,7 +2066,11 @@ def __init__(self, payload: Dict[str, Any]): def to_dict(self): return { "body": self.body, - "actions": [actions.to_dict() for actions in self.actions], + "actions": ( + [actions.to_dict() for actions in self.actions] + if self.actions is not None + else None + ), } class TwilioCard(object): @@ -635,7 +2095,11 @@ def to_dict(self): "title": self.title, "subtitle": self.subtitle, "media": self.media, - "actions": [actions.to_dict() for actions in self.actions], + "actions": ( + [actions.to_dict() for actions in self.actions] + if self.actions is not None + else None + ), } class TwilioCarousel(object): @@ -652,7 +2116,11 @@ def __init__(self, payload: Dict[str, Any]): def to_dict(self): return { "body": self.body, - "cards": [cards.to_dict() for cards in self.cards], + "cards": ( + [cards.to_dict() for cards in self.cards] + if self.cards is not None + else None + ), } class TwilioCatalog(object): @@ -680,7 +2148,11 @@ def to_dict(self): "body": self.body, "subtitle": self.subtitle, "id": self.id, - "items": [items.to_dict() for items in self.items], + "items": ( + [items.to_dict() for items in self.items] + if self.items is not None + else None + ), "dynamic_items": self.dynamic_items, } @@ -709,7 +2181,11 @@ def to_dict(self): "button_text": self.button_text, "subtitle": self.subtitle, "media_url": self.media_url, - "pages": [pages.to_dict() for pages in self.pages], + "pages": ( + [pages.to_dict() for pages in self.pages] + if self.pages is not None + else None + ), "type": self.type, } @@ -730,7 +2206,11 @@ def to_dict(self): return { "body": self.body, "button": self.button, - "items": [items.to_dict() for items in self.items], + "items": ( + [items.to_dict() for items in self.items] + if self.items is not None + else None + ), } class TwilioLocation(object): @@ -786,7 +2266,11 @@ def __init__(self, payload: Dict[str, Any]): def to_dict(self): return { "body": self.body, - "actions": [actions.to_dict() for actions in self.actions], + "actions": ( + [actions.to_dict() for actions in self.actions] + if self.actions is not None + else None + ), } class TwilioText(object): @@ -860,18 +2344,62 @@ def __init__(self, payload: Dict[str, Any]): def to_dict(self): return { - "twilio_text": self.twilio_text.to_dict(), - "twilio_media": self.twilio_media.to_dict(), - "twilio_location": self.twilio_location.to_dict(), - "twilio_list_picker": self.twilio_list_picker.to_dict(), - "twilio_call_to_action": self.twilio_call_to_action.to_dict(), - "twilio_quick_reply": self.twilio_quick_reply.to_dict(), - "twilio_card": self.twilio_card.to_dict(), - "twilio_catalog": self.twilio_catalog.to_dict(), - "twilio_carousel": self.twilio_carousel.to_dict(), - "twilio_flows": self.twilio_flows.to_dict(), - "whatsapp_card": self.whatsapp_card.to_dict(), - "whatsapp_authentication": self.whatsapp_authentication.to_dict(), + "twilio_text": ( + self.twilio_text.to_dict() if self.twilio_text is not None else None + ), + "twilio_media": ( + self.twilio_media.to_dict() + if self.twilio_media is not None + else None + ), + "twilio_location": ( + self.twilio_location.to_dict() + if self.twilio_location is not None + else None + ), + "twilio_list_picker": ( + self.twilio_list_picker.to_dict() + if self.twilio_list_picker is not None + else None + ), + "twilio_call_to_action": ( + self.twilio_call_to_action.to_dict() + if self.twilio_call_to_action is not None + else None + ), + "twilio_quick_reply": ( + self.twilio_quick_reply.to_dict() + if self.twilio_quick_reply is not None + else None + ), + "twilio_card": ( + self.twilio_card.to_dict() if self.twilio_card is not None else None + ), + "twilio_catalog": ( + self.twilio_catalog.to_dict() + if self.twilio_catalog is not None + else None + ), + "twilio_carousel": ( + self.twilio_carousel.to_dict() + if self.twilio_carousel is not None + else None + ), + "twilio_flows": ( + self.twilio_flows.to_dict() + if self.twilio_flows is not None + else None + ), + "whatsapp_card": ( + self.whatsapp_card.to_dict() + if self.whatsapp_card is not None + else None + ), + "whatsapp_authentication": ( + self.whatsapp_authentication.to_dict() + if self.whatsapp_authentication is not None + else None + ), } class WhatsappAuthentication(object): @@ -897,7 +2425,11 @@ def to_dict(self): return { "add_security_recommendation": self.add_security_recommendation, "code_expiration_minutes": self.code_expiration_minutes, - "actions": [actions.to_dict() for actions in self.actions], + "actions": ( + [actions.to_dict() for actions in self.actions] + if self.actions is not None + else None + ), } class WhatsappCard(object): @@ -925,7 +2457,11 @@ def to_dict(self): "footer": self.footer, "media": self.media, "header_text": self.header_text, - "actions": [actions.to_dict() for actions in self.actions], + "actions": ( + [actions.to_dict() for actions in self.actions] + if self.actions is not None + else None + ), } def __init__(self, version: Version): @@ -950,8 +2486,11 @@ def create(self, content_create_request: ContentCreateRequest) -> ContentInstanc data = content_create_request.to_dict() headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -971,8 +2510,11 @@ async def create_async( data = content_create_request.to_dict() headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -1106,7 +2648,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ContentPage(self._version, response) async def page_async( @@ -1133,8 +2681,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ContentPage(self._version, response) diff --git a/twilio/rest/content/v1/content/approval_create.py b/twilio/rest/content/v1/content/approval_create.py index 4f22f2df14..9f34064e35 100644 --- a/twilio/rest/content/v1/content/approval_create.py +++ b/twilio/rest/content/v1/content/approval_create.py @@ -21,13 +21,31 @@ class ApprovalCreateInstance(InstanceResource): + + class ContentApprovalRequest(object): + """ + :ivar name: Name of the template. + :ivar category: A WhatsApp recognized template category. + """ + + def __init__(self, payload: Dict[str, Any]): + + 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, + } + """ - :ivar name: - :ivar category: - :ivar content_type: - :ivar status: - :ivar rejection_reason: - :ivar allow_category_change: + :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], content_sid: str): @@ -106,8 +124,11 @@ def create( data = content_approval_request.to_dict() headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -129,8 +150,11 @@ async def create_async( data = content_approval_request.to_dict() headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/content/v1/content/approval_fetch.py b/twilio/rest/content/v1/content/approval_fetch.py index f35ef6a48f..d3d00e5058 100644 --- a/twilio/rest/content/v1/content/approval_fetch.py +++ b/twilio/rest/content/v1/content/approval_fetch.py @@ -13,6 +13,7 @@ """ from typing import Any, Dict, Optional +from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -108,10 +109,11 @@ def fetch(self) -> ApprovalFetchInstance: :returns: The fetched ApprovalFetchInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ApprovalFetchInstance( self._version, @@ -127,9 +129,12 @@ async def fetch_async(self) -> ApprovalFetchInstance: :returns: The fetched ApprovalFetchInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ApprovalFetchInstance( diff --git a/twilio/rest/content/v1/content_and_approvals.py b/twilio/rest/content/v1/content_and_approvals.py index de40cfc172..c2a210665d 100644 --- a/twilio/rest/content/v1/content_and_approvals.py +++ b/twilio/rest/content/v1/content_and_approvals.py @@ -223,7 +223,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ContentAndApprovalsPage(self._version, response) async def page_async( @@ -250,8 +256,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ContentAndApprovalsPage(self._version, response) diff --git a/twilio/rest/content/v1/legacy_content.py b/twilio/rest/content/v1/legacy_content.py index cfb4ac698d..d32778e748 100644 --- a/twilio/rest/content/v1/legacy_content.py +++ b/twilio/rest/content/v1/legacy_content.py @@ -225,7 +225,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return LegacyContentPage(self._version, response) async def page_async( @@ -252,8 +258,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return LegacyContentPage(self._version, response) diff --git a/twilio/rest/content/v2/content.py b/twilio/rest/content/v2/content.py index c8abf4dcda..c2e2db7d8c 100644 --- a/twilio/rest/content/v2/content.py +++ b/twilio/rest/content/v2/content.py @@ -362,7 +362,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ContentPage(self._version, response) async def page_async( @@ -416,8 +422,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ContentPage(self._version, response) diff --git a/twilio/rest/content/v2/content_and_approvals.py b/twilio/rest/content/v2/content_and_approvals.py index 4c081b9e22..823bcfe083 100644 --- a/twilio/rest/content/v2/content_and_approvals.py +++ b/twilio/rest/content/v2/content_and_approvals.py @@ -362,7 +362,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ContentAndApprovalsPage(self._version, response) async def page_async( @@ -416,8 +422,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ContentAndApprovalsPage(self._version, response) diff --git a/twilio/rest/conversations/v1/address_configuration.py b/twilio/rest/conversations/v1/address_configuration.py index 58bd74be49..096f023889 100644 --- a/twilio/rest/conversations/v1/address_configuration.py +++ b/twilio/rest/conversations/v1/address_configuration.py @@ -251,10 +251,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -263,9 +263,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> AddressConfigurationInstance: @@ -276,10 +278,11 @@ def fetch(self) -> AddressConfigurationInstance: :returns: The fetched AddressConfigurationInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return AddressConfigurationInstance( self._version, @@ -295,9 +298,12 @@ async def fetch_async(self) -> AddressConfigurationInstance: :returns: The fetched AddressConfigurationInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return AddressConfigurationInstance( @@ -337,6 +343,7 @@ def update( :returns: The updated AddressConfigurationInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -354,11 +361,14 @@ def update( "AutoCreation.StudioRetryCount": auto_creation_studio_retry_count, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AddressConfigurationInstance( @@ -396,6 +406,7 @@ async def update_async( :returns: The updated AddressConfigurationInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -413,11 +424,14 @@ async def update_async( "AutoCreation.StudioRetryCount": auto_creation_studio_retry_count, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AddressConfigurationInstance( @@ -528,6 +542,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -594,6 +612,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -740,7 +762,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return AddressConfigurationPage(self._version, response) async def page_async( @@ -770,8 +798,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return AddressConfigurationPage(self._version, response) diff --git a/twilio/rest/conversations/v1/configuration/__init__.py b/twilio/rest/conversations/v1/configuration/__init__.py index 46f511aa1e..584082353f 100644 --- a/twilio/rest/conversations/v1/configuration/__init__.py +++ b/twilio/rest/conversations/v1/configuration/__init__.py @@ -162,10 +162,11 @@ def fetch(self) -> ConfigurationInstance: :returns: The fetched ConfigurationInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ConfigurationInstance( self._version, @@ -180,9 +181,12 @@ async def fetch_async(self) -> ConfigurationInstance: :returns: The fetched ConfigurationInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ConfigurationInstance( @@ -207,6 +211,7 @@ def update( :returns: The updated ConfigurationInstance """ + data = values.of( { "DefaultChatServiceSid": default_chat_service_sid, @@ -215,11 +220,14 @@ def update( "DefaultClosedTimer": default_closed_timer, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ConfigurationInstance(self._version, payload) @@ -241,6 +249,7 @@ async def update_async( :returns: The updated ConfigurationInstance """ + data = values.of( { "DefaultChatServiceSid": default_chat_service_sid, @@ -249,11 +258,14 @@ async def update_async( "DefaultClosedTimer": default_closed_timer, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ConfigurationInstance(self._version, payload) diff --git a/twilio/rest/conversations/v1/configuration/webhook.py b/twilio/rest/conversations/v1/configuration/webhook.py index 4ece54232c..183930708e 100644 --- a/twilio/rest/conversations/v1/configuration/webhook.py +++ b/twilio/rest/conversations/v1/configuration/webhook.py @@ -169,10 +169,11 @@ def fetch(self) -> WebhookInstance: :returns: The fetched WebhookInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return WebhookInstance( self._version, @@ -187,9 +188,12 @@ async def fetch_async(self) -> WebhookInstance: :returns: The fetched WebhookInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return WebhookInstance( @@ -216,6 +220,7 @@ def update( :returns: The updated WebhookInstance """ + data = values.of( { "Method": method, @@ -225,11 +230,14 @@ def update( "Target": target, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return WebhookInstance(self._version, payload) @@ -253,6 +261,7 @@ async def update_async( :returns: The updated WebhookInstance """ + data = values.of( { "Method": method, @@ -262,11 +271,14 @@ async def update_async( "Target": target, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return WebhookInstance(self._version, payload) diff --git a/twilio/rest/conversations/v1/conversation/__init__.py b/twilio/rest/conversations/v1/conversation/__init__.py index 4eb14b769c..d1f08cc2d8 100644 --- a/twilio/rest/conversations/v1/conversation/__init__.py +++ b/twilio/rest/conversations/v1/conversation/__init__.py @@ -320,6 +320,8 @@ def delete( } ) + headers = values.of({}) + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async( @@ -341,6 +343,8 @@ async def delete_async( } ) + headers = values.of({}) + return await self._version.delete_async( method="DELETE", uri=self._uri, headers=headers ) @@ -353,10 +357,11 @@ def fetch(self) -> ConversationInstance: :returns: The fetched ConversationInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ConversationInstance( self._version, @@ -372,9 +377,12 @@ async def fetch_async(self) -> ConversationInstance: :returns: The fetched ConversationInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ConversationInstance( @@ -418,6 +426,7 @@ def update( :returns: The updated ConversationInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -433,11 +442,20 @@ def update( "Bindings.Email.Name": bindings_email_name, } ) - headers = values.of( - { - "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, - } - ) + headers = values.of({}) + + if not ( + x_twilio_webhook_enabled is values.unset + or ( + isinstance(x_twilio_webhook_enabled, str) + and not x_twilio_webhook_enabled + ) + ): + headers["X-Twilio-Webhook-Enabled"] = x_twilio_webhook_enabled + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( method="POST", uri=self._uri, data=data, headers=headers @@ -480,6 +498,7 @@ async def update_async( :returns: The updated ConversationInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -495,11 +514,20 @@ async def update_async( "Bindings.Email.Name": bindings_email_name, } ) - headers = values.of( - { - "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, - } - ) + headers = values.of({}) + + if not ( + x_twilio_webhook_enabled is values.unset + or ( + isinstance(x_twilio_webhook_enabled, str) + and not x_twilio_webhook_enabled + ) + ): + headers["X-Twilio-Webhook-Enabled"] = x_twilio_webhook_enabled + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( method="POST", uri=self._uri, data=data, headers=headers @@ -643,6 +671,10 @@ def create( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -707,6 +739,10 @@ async def create_async( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -889,7 +925,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ConversationPage(self._version, response) async def page_async( @@ -925,8 +967,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ConversationPage(self._version, response) diff --git a/twilio/rest/conversations/v1/conversation/message/__init__.py b/twilio/rest/conversations/v1/conversation/message/__init__.py index 8488bee004..04e7fdf252 100644 --- a/twilio/rest/conversations/v1/conversation/message/__init__.py +++ b/twilio/rest/conversations/v1/conversation/message/__init__.py @@ -285,6 +285,8 @@ def delete( } ) + headers = values.of({}) + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async( @@ -306,6 +308,8 @@ async def delete_async( } ) + headers = values.of({}) + return await self._version.delete_async( method="DELETE", uri=self._uri, headers=headers ) @@ -318,10 +322,11 @@ def fetch(self) -> MessageInstance: :returns: The fetched MessageInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return MessageInstance( self._version, @@ -338,9 +343,12 @@ async def fetch_async(self) -> MessageInstance: :returns: The fetched MessageInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return MessageInstance( @@ -375,6 +383,7 @@ def update( :returns: The updated MessageInstance """ + data = values.of( { "Author": author, @@ -385,11 +394,20 @@ def update( "Subject": subject, } ) - headers = values.of( - { - "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, - } - ) + headers = values.of({}) + + if not ( + x_twilio_webhook_enabled is values.unset + or ( + isinstance(x_twilio_webhook_enabled, str) + and not x_twilio_webhook_enabled + ) + ): + headers["X-Twilio-Webhook-Enabled"] = x_twilio_webhook_enabled + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( method="POST", uri=self._uri, data=data, headers=headers @@ -427,6 +445,7 @@ async def update_async( :returns: The updated MessageInstance """ + data = values.of( { "Author": author, @@ -437,11 +456,20 @@ async def update_async( "Subject": subject, } ) - headers = values.of( - { - "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, - } - ) + headers = values.of({}) + + if not ( + x_twilio_webhook_enabled is values.unset + or ( + isinstance(x_twilio_webhook_enabled, str) + and not x_twilio_webhook_enabled + ) + ): + headers["X-Twilio-Webhook-Enabled"] = x_twilio_webhook_enabled + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( method="POST", uri=self._uri, data=data, headers=headers @@ -570,6 +598,10 @@ def create( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -630,6 +662,10 @@ async def create_async( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -778,7 +814,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return MessagePage(self._version, response, self._solution) async def page_async( @@ -808,8 +850,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return MessagePage(self._version, response, self._solution) diff --git a/twilio/rest/conversations/v1/conversation/message/delivery_receipt.py b/twilio/rest/conversations/v1/conversation/message/delivery_receipt.py index 16af7892e9..2ed297e059 100644 --- a/twilio/rest/conversations/v1/conversation/message/delivery_receipt.py +++ b/twilio/rest/conversations/v1/conversation/message/delivery_receipt.py @@ -158,10 +158,11 @@ def fetch(self) -> DeliveryReceiptInstance: :returns: The fetched DeliveryReceiptInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return DeliveryReceiptInstance( self._version, @@ -179,9 +180,12 @@ async def fetch_async(self) -> DeliveryReceiptInstance: :returns: The fetched DeliveryReceiptInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return DeliveryReceiptInstance( @@ -377,7 +381,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return DeliveryReceiptPage(self._version, response, self._solution) async def page_async( @@ -404,8 +414,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return DeliveryReceiptPage(self._version, response, self._solution) diff --git a/twilio/rest/conversations/v1/conversation/participant.py b/twilio/rest/conversations/v1/conversation/participant.py index 92f8e5de40..deb652641a 100644 --- a/twilio/rest/conversations/v1/conversation/participant.py +++ b/twilio/rest/conversations/v1/conversation/participant.py @@ -285,6 +285,8 @@ def delete( } ) + headers = values.of({}) + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async( @@ -306,6 +308,8 @@ async def delete_async( } ) + headers = values.of({}) + return await self._version.delete_async( method="DELETE", uri=self._uri, headers=headers ) @@ -318,10 +322,11 @@ def fetch(self) -> ParticipantInstance: :returns: The fetched ParticipantInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ParticipantInstance( self._version, @@ -338,9 +343,12 @@ async def fetch_async(self) -> ParticipantInstance: :returns: The fetched ParticipantInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ParticipantInstance( @@ -381,6 +389,7 @@ def update( :returns: The updated ParticipantInstance """ + data = values.of( { "DateCreated": serialize.iso8601_datetime(date_created), @@ -394,11 +403,20 @@ def update( "LastReadTimestamp": last_read_timestamp, } ) - headers = values.of( - { - "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, - } - ) + headers = values.of({}) + + if not ( + x_twilio_webhook_enabled is values.unset + or ( + isinstance(x_twilio_webhook_enabled, str) + and not x_twilio_webhook_enabled + ) + ): + headers["X-Twilio-Webhook-Enabled"] = x_twilio_webhook_enabled + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( method="POST", uri=self._uri, data=data, headers=headers @@ -442,6 +460,7 @@ async def update_async( :returns: The updated ParticipantInstance """ + data = values.of( { "DateCreated": serialize.iso8601_datetime(date_created), @@ -455,11 +474,20 @@ async def update_async( "LastReadTimestamp": last_read_timestamp, } ) - headers = values.of( - { - "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, - } - ) + headers = values.of({}) + + if not ( + x_twilio_webhook_enabled is values.unset + or ( + isinstance(x_twilio_webhook_enabled, str) + and not x_twilio_webhook_enabled + ) + ): + headers["X-Twilio-Webhook-Enabled"] = x_twilio_webhook_enabled + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( method="POST", uri=self._uri, data=data, headers=headers @@ -572,6 +600,10 @@ def create( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -629,6 +661,10 @@ async def create_async( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -764,7 +800,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ParticipantPage(self._version, response, self._solution) async def page_async( @@ -791,8 +833,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ParticipantPage(self._version, response, self._solution) diff --git a/twilio/rest/conversations/v1/conversation/webhook.py b/twilio/rest/conversations/v1/conversation/webhook.py index b961b832a5..837f88c26f 100644 --- a/twilio/rest/conversations/v1/conversation/webhook.py +++ b/twilio/rest/conversations/v1/conversation/webhook.py @@ -216,10 +216,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -228,9 +228,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> WebhookInstance: @@ -241,10 +243,11 @@ def fetch(self) -> WebhookInstance: :returns: The fetched WebhookInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return WebhookInstance( self._version, @@ -261,9 +264,12 @@ async def fetch_async(self) -> WebhookInstance: :returns: The fetched WebhookInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return WebhookInstance( @@ -292,6 +298,7 @@ def update( :returns: The updated WebhookInstance """ + data = values.of( { "Configuration.Url": configuration_url, @@ -305,11 +312,14 @@ def update( "Configuration.FlowSid": configuration_flow_sid, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return WebhookInstance( @@ -338,6 +348,7 @@ async def update_async( :returns: The updated WebhookInstance """ + data = values.of( { "Configuration.Url": configuration_url, @@ -351,11 +362,14 @@ async def update_async( "Configuration.FlowSid": configuration_flow_sid, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return WebhookInstance( @@ -457,6 +471,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -506,6 +524,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -641,7 +663,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return WebhookPage(self._version, response, self._solution) async def page_async( @@ -668,8 +696,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return WebhookPage(self._version, response, self._solution) diff --git a/twilio/rest/conversations/v1/conversation_with_participants.py b/twilio/rest/conversations/v1/conversation_with_participants.py index b50c2da1a7..a818a29ca4 100644 --- a/twilio/rest/conversations/v1/conversation_with_participants.py +++ b/twilio/rest/conversations/v1/conversation_with_participants.py @@ -159,6 +159,10 @@ def create( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -228,6 +232,10 @@ async def create_async( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/conversations/v1/credential.py b/twilio/rest/conversations/v1/credential.py index c8cd78ab05..f382458ba7 100644 --- a/twilio/rest/conversations/v1/credential.py +++ b/twilio/rest/conversations/v1/credential.py @@ -214,10 +214,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -226,9 +226,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> CredentialInstance: @@ -239,10 +241,11 @@ def fetch(self) -> CredentialInstance: :returns: The fetched CredentialInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return CredentialInstance( self._version, @@ -258,9 +261,12 @@ async def fetch_async(self) -> CredentialInstance: :returns: The fetched CredentialInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return CredentialInstance( @@ -292,6 +298,7 @@ def update( :returns: The updated CredentialInstance """ + data = values.of( { "Type": type, @@ -303,11 +310,14 @@ def update( "Secret": secret, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CredentialInstance(self._version, payload, sid=self._solution["sid"]) @@ -335,6 +345,7 @@ async def update_async( :returns: The updated CredentialInstance """ + data = values.of( { "Type": type, @@ -346,11 +357,14 @@ async def update_async( "Secret": secret, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CredentialInstance(self._version, payload, sid=self._solution["sid"]) @@ -434,6 +448,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -477,6 +495,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -610,7 +632,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return CredentialPage(self._version, response) async def page_async( @@ -637,8 +665,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return CredentialPage(self._version, response) diff --git a/twilio/rest/conversations/v1/participant_conversation.py b/twilio/rest/conversations/v1/participant_conversation.py index 7413047152..0938bd5421 100644 --- a/twilio/rest/conversations/v1/participant_conversation.py +++ b/twilio/rest/conversations/v1/participant_conversation.py @@ -285,7 +285,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ParticipantConversationPage(self._version, response) async def page_async( @@ -318,8 +324,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ParticipantConversationPage(self._version, response) diff --git a/twilio/rest/conversations/v1/role.py b/twilio/rest/conversations/v1/role.py index 301063800a..229e9b7dd4 100644 --- a/twilio/rest/conversations/v1/role.py +++ b/twilio/rest/conversations/v1/role.py @@ -173,10 +173,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -185,9 +185,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> RoleInstance: @@ -198,10 +200,11 @@ def fetch(self) -> RoleInstance: :returns: The fetched RoleInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return RoleInstance( self._version, @@ -217,9 +220,12 @@ async def fetch_async(self) -> RoleInstance: :returns: The fetched RoleInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return RoleInstance( @@ -236,16 +242,20 @@ def update(self, permission: List[str]) -> RoleInstance: :returns: The updated RoleInstance """ + data = values.of( { "Permission": serialize.map(permission, lambda e: e), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RoleInstance(self._version, payload, sid=self._solution["sid"]) @@ -258,16 +268,20 @@ async def update_async(self, permission: List[str]) -> RoleInstance: :returns: The updated RoleInstance """ + data = values.of( { "Permission": serialize.map(permission, lambda e: e), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RoleInstance(self._version, payload, sid=self._solution["sid"]) @@ -336,6 +350,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -364,6 +382,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -497,7 +519,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return RolePage(self._version, response) async def page_async( @@ -524,8 +552,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return RolePage(self._version, response) diff --git a/twilio/rest/conversations/v1/service/__init__.py b/twilio/rest/conversations/v1/service/__init__.py index 415c252290..3b92c87934 100644 --- a/twilio/rest/conversations/v1/service/__init__.py +++ b/twilio/rest/conversations/v1/service/__init__.py @@ -210,10 +210,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -222,9 +222,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> ServiceInstance: @@ -235,10 +237,11 @@ def fetch(self) -> ServiceInstance: :returns: The fetched ServiceInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ServiceInstance( self._version, @@ -254,9 +257,12 @@ async def fetch_async(self) -> ServiceInstance: :returns: The fetched ServiceInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ServiceInstance( @@ -407,6 +413,10 @@ def create(self, friendly_name: str) -> ServiceInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -429,6 +439,10 @@ async def create_async(self, friendly_name: str) -> ServiceInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -562,7 +576,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ServicePage(self._version, response) async def page_async( @@ -589,8 +609,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ServicePage(self._version, response) diff --git a/twilio/rest/conversations/v1/service/binding.py b/twilio/rest/conversations/v1/service/binding.py index 6e66844490..363dab91d0 100644 --- a/twilio/rest/conversations/v1/service/binding.py +++ b/twilio/rest/conversations/v1/service/binding.py @@ -166,10 +166,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -178,9 +178,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> BindingInstance: @@ -191,10 +193,11 @@ def fetch(self) -> BindingInstance: :returns: The fetched BindingInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return BindingInstance( self._version, @@ -211,9 +214,12 @@ async def fetch_async(self) -> BindingInstance: :returns: The fetched BindingInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return BindingInstance( @@ -429,7 +435,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return BindingPage(self._version, response, self._solution) async def page_async( @@ -462,8 +474,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return BindingPage(self._version, response, self._solution) diff --git a/twilio/rest/conversations/v1/service/configuration/__init__.py b/twilio/rest/conversations/v1/service/configuration/__init__.py index 9ca23a435f..e37c8888c8 100644 --- a/twilio/rest/conversations/v1/service/configuration/__init__.py +++ b/twilio/rest/conversations/v1/service/configuration/__init__.py @@ -178,10 +178,11 @@ def fetch(self) -> ConfigurationInstance: :returns: The fetched ConfigurationInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ConfigurationInstance( self._version, @@ -197,9 +198,12 @@ async def fetch_async(self) -> ConfigurationInstance: :returns: The fetched ConfigurationInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ConfigurationInstance( @@ -225,6 +229,7 @@ def update( :returns: The updated ConfigurationInstance """ + data = values.of( { "DefaultConversationCreatorRoleSid": default_conversation_creator_role_sid, @@ -235,11 +240,14 @@ def update( ), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ConfigurationInstance( @@ -263,6 +271,7 @@ async def update_async( :returns: The updated ConfigurationInstance """ + data = values.of( { "DefaultConversationCreatorRoleSid": default_conversation_creator_role_sid, @@ -273,11 +282,14 @@ async def update_async( ), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ConfigurationInstance( diff --git a/twilio/rest/conversations/v1/service/configuration/notification.py b/twilio/rest/conversations/v1/service/configuration/notification.py index 2dee2d4d29..6aced28115 100644 --- a/twilio/rest/conversations/v1/service/configuration/notification.py +++ b/twilio/rest/conversations/v1/service/configuration/notification.py @@ -225,10 +225,11 @@ def fetch(self) -> NotificationInstance: :returns: The fetched NotificationInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return NotificationInstance( self._version, @@ -244,9 +245,12 @@ async def fetch_async(self) -> NotificationInstance: :returns: The fetched NotificationInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return NotificationInstance( @@ -290,6 +294,7 @@ def update( :returns: The updated NotificationInstance """ + data = values.of( { "LogEnabled": serialize.boolean_to_string(log_enabled), @@ -315,11 +320,14 @@ def update( "NewMessage.WithMedia.Template": new_message_with_media_template, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return NotificationInstance( @@ -361,6 +369,7 @@ async def update_async( :returns: The updated NotificationInstance """ + data = values.of( { "LogEnabled": serialize.boolean_to_string(log_enabled), @@ -386,11 +395,14 @@ async def update_async( "NewMessage.WithMedia.Template": new_message_with_media_template, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return NotificationInstance( diff --git a/twilio/rest/conversations/v1/service/configuration/webhook.py b/twilio/rest/conversations/v1/service/configuration/webhook.py index aa4015361f..706f410550 100644 --- a/twilio/rest/conversations/v1/service/configuration/webhook.py +++ b/twilio/rest/conversations/v1/service/configuration/webhook.py @@ -172,10 +172,11 @@ def fetch(self) -> WebhookInstance: :returns: The fetched WebhookInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return WebhookInstance( self._version, @@ -191,9 +192,12 @@ async def fetch_async(self) -> WebhookInstance: :returns: The fetched WebhookInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return WebhookInstance( @@ -219,6 +223,7 @@ def update( :returns: The updated WebhookInstance """ + data = values.of( { "PreWebhookUrl": pre_webhook_url, @@ -227,11 +232,14 @@ def update( "Method": method, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return WebhookInstance( @@ -255,6 +263,7 @@ async def update_async( :returns: The updated WebhookInstance """ + data = values.of( { "PreWebhookUrl": pre_webhook_url, @@ -263,11 +272,14 @@ async def update_async( "Method": method, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return WebhookInstance( diff --git a/twilio/rest/conversations/v1/service/conversation/__init__.py b/twilio/rest/conversations/v1/service/conversation/__init__.py index 139bdcb5ca..0f28c4dfe2 100644 --- a/twilio/rest/conversations/v1/service/conversation/__init__.py +++ b/twilio/rest/conversations/v1/service/conversation/__init__.py @@ -332,6 +332,8 @@ def delete( } ) + headers = values.of({}) + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async( @@ -353,6 +355,8 @@ async def delete_async( } ) + headers = values.of({}) + return await self._version.delete_async( method="DELETE", uri=self._uri, headers=headers ) @@ -365,10 +369,11 @@ def fetch(self) -> ConversationInstance: :returns: The fetched ConversationInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ConversationInstance( self._version, @@ -385,9 +390,12 @@ async def fetch_async(self) -> ConversationInstance: :returns: The fetched ConversationInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ConversationInstance( @@ -432,6 +440,7 @@ def update( :returns: The updated ConversationInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -447,11 +456,20 @@ def update( "Bindings.Email.Name": bindings_email_name, } ) - headers = values.of( - { - "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, - } - ) + headers = values.of({}) + + if not ( + x_twilio_webhook_enabled is values.unset + or ( + isinstance(x_twilio_webhook_enabled, str) + and not x_twilio_webhook_enabled + ) + ): + headers["X-Twilio-Webhook-Enabled"] = x_twilio_webhook_enabled + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( method="POST", uri=self._uri, data=data, headers=headers @@ -499,6 +517,7 @@ async def update_async( :returns: The updated ConversationInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -514,11 +533,20 @@ async def update_async( "Bindings.Email.Name": bindings_email_name, } ) - headers = values.of( - { - "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, - } - ) + headers = values.of({}) + + if not ( + x_twilio_webhook_enabled is values.unset + or ( + isinstance(x_twilio_webhook_enabled, str) + and not x_twilio_webhook_enabled + ) + ): + headers["X-Twilio-Webhook-Enabled"] = x_twilio_webhook_enabled + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( method="POST", uri=self._uri, data=data, headers=headers @@ -679,6 +707,10 @@ def create( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -745,6 +777,10 @@ async def create_async( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -929,7 +965,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ConversationPage(self._version, response, self._solution) async def page_async( @@ -965,8 +1007,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ConversationPage(self._version, response, self._solution) diff --git a/twilio/rest/conversations/v1/service/conversation/message/__init__.py b/twilio/rest/conversations/v1/service/conversation/message/__init__.py index 32f480bc59..c4123afd34 100644 --- a/twilio/rest/conversations/v1/service/conversation/message/__init__.py +++ b/twilio/rest/conversations/v1/service/conversation/message/__init__.py @@ -294,6 +294,8 @@ def delete( } ) + headers = values.of({}) + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async( @@ -315,6 +317,8 @@ async def delete_async( } ) + headers = values.of({}) + return await self._version.delete_async( method="DELETE", uri=self._uri, headers=headers ) @@ -327,10 +331,11 @@ def fetch(self) -> MessageInstance: :returns: The fetched MessageInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return MessageInstance( self._version, @@ -348,9 +353,12 @@ async def fetch_async(self) -> MessageInstance: :returns: The fetched MessageInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return MessageInstance( @@ -386,6 +394,7 @@ def update( :returns: The updated MessageInstance """ + data = values.of( { "Author": author, @@ -396,11 +405,20 @@ def update( "Subject": subject, } ) - headers = values.of( - { - "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, - } - ) + headers = values.of({}) + + if not ( + x_twilio_webhook_enabled is values.unset + or ( + isinstance(x_twilio_webhook_enabled, str) + and not x_twilio_webhook_enabled + ) + ): + headers["X-Twilio-Webhook-Enabled"] = x_twilio_webhook_enabled + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( method="POST", uri=self._uri, data=data, headers=headers @@ -439,6 +457,7 @@ async def update_async( :returns: The updated MessageInstance """ + data = values.of( { "Author": author, @@ -449,11 +468,20 @@ async def update_async( "Subject": subject, } ) - headers = values.of( - { - "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, - } - ) + headers = values.of({}) + + if not ( + x_twilio_webhook_enabled is values.unset + or ( + isinstance(x_twilio_webhook_enabled, str) + and not x_twilio_webhook_enabled + ) + ): + headers["X-Twilio-Webhook-Enabled"] = x_twilio_webhook_enabled + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( method="POST", uri=self._uri, data=data, headers=headers @@ -589,6 +617,10 @@ def create( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -652,6 +684,10 @@ async def create_async( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -803,7 +839,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return MessagePage(self._version, response, self._solution) async def page_async( @@ -833,8 +875,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return MessagePage(self._version, response, self._solution) diff --git a/twilio/rest/conversations/v1/service/conversation/message/delivery_receipt.py b/twilio/rest/conversations/v1/service/conversation/message/delivery_receipt.py index b9bf8a70c8..939b631271 100644 --- a/twilio/rest/conversations/v1/service/conversation/message/delivery_receipt.py +++ b/twilio/rest/conversations/v1/service/conversation/message/delivery_receipt.py @@ -170,10 +170,11 @@ def fetch(self) -> DeliveryReceiptInstance: :returns: The fetched DeliveryReceiptInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return DeliveryReceiptInstance( self._version, @@ -192,9 +193,12 @@ async def fetch_async(self) -> DeliveryReceiptInstance: :returns: The fetched DeliveryReceiptInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return DeliveryReceiptInstance( @@ -398,7 +402,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return DeliveryReceiptPage(self._version, response, self._solution) async def page_async( @@ -425,8 +435,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return DeliveryReceiptPage(self._version, response, self._solution) diff --git a/twilio/rest/conversations/v1/service/conversation/participant.py b/twilio/rest/conversations/v1/service/conversation/participant.py index 530bce26fc..03a3cead7e 100644 --- a/twilio/rest/conversations/v1/service/conversation/participant.py +++ b/twilio/rest/conversations/v1/service/conversation/participant.py @@ -294,6 +294,8 @@ def delete( } ) + headers = values.of({}) + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async( @@ -315,6 +317,8 @@ async def delete_async( } ) + headers = values.of({}) + return await self._version.delete_async( method="DELETE", uri=self._uri, headers=headers ) @@ -327,10 +331,11 @@ def fetch(self) -> ParticipantInstance: :returns: The fetched ParticipantInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ParticipantInstance( self._version, @@ -348,9 +353,12 @@ async def fetch_async(self) -> ParticipantInstance: :returns: The fetched ParticipantInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ParticipantInstance( @@ -392,6 +400,7 @@ def update( :returns: The updated ParticipantInstance """ + data = values.of( { "DateCreated": serialize.iso8601_datetime(date_created), @@ -405,11 +414,20 @@ def update( "LastReadTimestamp": last_read_timestamp, } ) - headers = values.of( - { - "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, - } - ) + headers = values.of({}) + + if not ( + x_twilio_webhook_enabled is values.unset + or ( + isinstance(x_twilio_webhook_enabled, str) + and not x_twilio_webhook_enabled + ) + ): + headers["X-Twilio-Webhook-Enabled"] = x_twilio_webhook_enabled + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( method="POST", uri=self._uri, data=data, headers=headers @@ -454,6 +472,7 @@ async def update_async( :returns: The updated ParticipantInstance """ + data = values.of( { "DateCreated": serialize.iso8601_datetime(date_created), @@ -467,11 +486,20 @@ async def update_async( "LastReadTimestamp": last_read_timestamp, } ) - headers = values.of( - { - "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, - } - ) + headers = values.of({}) + + if not ( + x_twilio_webhook_enabled is values.unset + or ( + isinstance(x_twilio_webhook_enabled, str) + and not x_twilio_webhook_enabled + ) + ): + headers["X-Twilio-Webhook-Enabled"] = x_twilio_webhook_enabled + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( method="POST", uri=self._uri, data=data, headers=headers @@ -590,6 +618,10 @@ def create( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -650,6 +682,10 @@ async def create_async( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -788,7 +824,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ParticipantPage(self._version, response, self._solution) async def page_async( @@ -815,8 +857,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ParticipantPage(self._version, response, self._solution) diff --git a/twilio/rest/conversations/v1/service/conversation/webhook.py b/twilio/rest/conversations/v1/service/conversation/webhook.py index 327dc9f024..08ec93ce4e 100644 --- a/twilio/rest/conversations/v1/service/conversation/webhook.py +++ b/twilio/rest/conversations/v1/service/conversation/webhook.py @@ -225,10 +225,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -237,9 +237,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> WebhookInstance: @@ -250,10 +252,11 @@ def fetch(self) -> WebhookInstance: :returns: The fetched WebhookInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return WebhookInstance( self._version, @@ -271,9 +274,12 @@ async def fetch_async(self) -> WebhookInstance: :returns: The fetched WebhookInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return WebhookInstance( @@ -303,6 +309,7 @@ def update( :returns: The updated WebhookInstance """ + data = values.of( { "Configuration.Url": configuration_url, @@ -316,11 +323,14 @@ def update( "Configuration.FlowSid": configuration_flow_sid, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return WebhookInstance( @@ -350,6 +360,7 @@ async def update_async( :returns: The updated WebhookInstance """ + data = values.of( { "Configuration.Url": configuration_url, @@ -363,11 +374,14 @@ async def update_async( "Configuration.FlowSid": configuration_flow_sid, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return WebhookInstance( @@ -475,6 +489,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -527,6 +545,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -665,7 +687,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return WebhookPage(self._version, response, self._solution) async def page_async( @@ -692,8 +720,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return WebhookPage(self._version, response, self._solution) diff --git a/twilio/rest/conversations/v1/service/conversation_with_participants.py b/twilio/rest/conversations/v1/service/conversation_with_participants.py index ef1495debb..ff82a8ce35 100644 --- a/twilio/rest/conversations/v1/service/conversation_with_participants.py +++ b/twilio/rest/conversations/v1/service/conversation_with_participants.py @@ -176,6 +176,10 @@ def create( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -247,6 +251,10 @@ async def create_async( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/conversations/v1/service/participant_conversation.py b/twilio/rest/conversations/v1/service/participant_conversation.py index 2c3bebcc1e..8ec561a7d9 100644 --- a/twilio/rest/conversations/v1/service/participant_conversation.py +++ b/twilio/rest/conversations/v1/service/participant_conversation.py @@ -302,7 +302,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ParticipantConversationPage(self._version, response, self._solution) async def page_async( @@ -335,8 +341,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ParticipantConversationPage(self._version, response, self._solution) diff --git a/twilio/rest/conversations/v1/service/role.py b/twilio/rest/conversations/v1/service/role.py index 170512a2b2..0884fb008b 100644 --- a/twilio/rest/conversations/v1/service/role.py +++ b/twilio/rest/conversations/v1/service/role.py @@ -181,10 +181,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -193,9 +193,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> RoleInstance: @@ -206,10 +208,11 @@ def fetch(self) -> RoleInstance: :returns: The fetched RoleInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return RoleInstance( self._version, @@ -226,9 +229,12 @@ async def fetch_async(self) -> RoleInstance: :returns: The fetched RoleInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return RoleInstance( @@ -246,16 +252,20 @@ def update(self, permission: List[str]) -> RoleInstance: :returns: The updated RoleInstance """ + data = values.of( { "Permission": serialize.map(permission, lambda e: e), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RoleInstance( @@ -273,16 +283,20 @@ async def update_async(self, permission: List[str]) -> RoleInstance: :returns: The updated RoleInstance """ + data = values.of( { "Permission": serialize.map(permission, lambda e: e), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RoleInstance( @@ -363,6 +377,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -393,6 +411,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -528,7 +550,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return RolePage(self._version, response, self._solution) async def page_async( @@ -555,8 +583,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return RolePage(self._version, response, self._solution) diff --git a/twilio/rest/conversations/v1/service/user/__init__.py b/twilio/rest/conversations/v1/service/user/__init__.py index 4d4df0398d..b8cda74c8c 100644 --- a/twilio/rest/conversations/v1/service/user/__init__.py +++ b/twilio/rest/conversations/v1/service/user/__init__.py @@ -257,6 +257,8 @@ def delete( } ) + headers = values.of({}) + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async( @@ -278,6 +280,8 @@ async def delete_async( } ) + headers = values.of({}) + return await self._version.delete_async( method="DELETE", uri=self._uri, headers=headers ) @@ -290,10 +294,11 @@ def fetch(self) -> UserInstance: :returns: The fetched UserInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return UserInstance( self._version, @@ -310,9 +315,12 @@ async def fetch_async(self) -> UserInstance: :returns: The fetched UserInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return UserInstance( @@ -341,6 +349,7 @@ def update( :returns: The updated UserInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -348,11 +357,20 @@ def update( "RoleSid": role_sid, } ) - headers = values.of( - { - "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, - } - ) + headers = values.of({}) + + if not ( + x_twilio_webhook_enabled is values.unset + or ( + isinstance(x_twilio_webhook_enabled, str) + and not x_twilio_webhook_enabled + ) + ): + headers["X-Twilio-Webhook-Enabled"] = x_twilio_webhook_enabled + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( method="POST", uri=self._uri, data=data, headers=headers @@ -384,6 +402,7 @@ async def update_async( :returns: The updated UserInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -391,11 +410,20 @@ async def update_async( "RoleSid": role_sid, } ) - headers = values.of( - { - "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, - } - ) + headers = values.of({}) + + if not ( + x_twilio_webhook_enabled is values.unset + or ( + isinstance(x_twilio_webhook_enabled, str) + and not x_twilio_webhook_enabled + ) + ): + headers["X-Twilio-Webhook-Enabled"] = x_twilio_webhook_enabled + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( method="POST", uri=self._uri, data=data, headers=headers @@ -507,6 +535,10 @@ def create( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -552,6 +584,10 @@ async def create_async( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -687,7 +723,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return UserPage(self._version, response, self._solution) async def page_async( @@ -714,8 +756,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return UserPage(self._version, response, self._solution) diff --git a/twilio/rest/conversations/v1/service/user/user_conversation.py b/twilio/rest/conversations/v1/service/user/user_conversation.py index 7a836505b9..4f1727f8e8 100644 --- a/twilio/rest/conversations/v1/service/user/user_conversation.py +++ b/twilio/rest/conversations/v1/service/user/user_conversation.py @@ -247,10 +247,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -259,9 +259,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> UserConversationInstance: @@ -272,10 +274,11 @@ def fetch(self) -> UserConversationInstance: :returns: The fetched UserConversationInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return UserConversationInstance( self._version, @@ -293,9 +296,12 @@ async def fetch_async(self) -> UserConversationInstance: :returns: The fetched UserConversationInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return UserConversationInstance( @@ -323,6 +329,7 @@ def update( :returns: The updated UserConversationInstance """ + data = values.of( { "NotificationLevel": notification_level, @@ -330,11 +337,14 @@ def update( "LastReadMessageIndex": last_read_message_index, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return UserConversationInstance( @@ -362,6 +372,7 @@ async def update_async( :returns: The updated UserConversationInstance """ + data = values.of( { "NotificationLevel": notification_level, @@ -369,11 +380,14 @@ async def update_async( "LastReadMessageIndex": last_read_message_index, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return UserConversationInstance( @@ -569,7 +583,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return UserConversationPage(self._version, response, self._solution) async def page_async( @@ -596,8 +616,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return UserConversationPage(self._version, response, self._solution) diff --git a/twilio/rest/conversations/v1/user/__init__.py b/twilio/rest/conversations/v1/user/__init__.py index a05deeda43..fe5d12f095 100644 --- a/twilio/rest/conversations/v1/user/__init__.py +++ b/twilio/rest/conversations/v1/user/__init__.py @@ -247,6 +247,8 @@ def delete( } ) + headers = values.of({}) + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async( @@ -268,6 +270,8 @@ async def delete_async( } ) + headers = values.of({}) + return await self._version.delete_async( method="DELETE", uri=self._uri, headers=headers ) @@ -280,10 +284,11 @@ def fetch(self) -> UserInstance: :returns: The fetched UserInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return UserInstance( self._version, @@ -299,9 +304,12 @@ async def fetch_async(self) -> UserInstance: :returns: The fetched UserInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return UserInstance( @@ -329,6 +337,7 @@ def update( :returns: The updated UserInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -336,11 +345,20 @@ def update( "RoleSid": role_sid, } ) - headers = values.of( - { - "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, - } - ) + headers = values.of({}) + + if not ( + x_twilio_webhook_enabled is values.unset + or ( + isinstance(x_twilio_webhook_enabled, str) + and not x_twilio_webhook_enabled + ) + ): + headers["X-Twilio-Webhook-Enabled"] = x_twilio_webhook_enabled + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( method="POST", uri=self._uri, data=data, headers=headers @@ -367,6 +385,7 @@ async def update_async( :returns: The updated UserInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -374,11 +393,20 @@ async def update_async( "RoleSid": role_sid, } ) - headers = values.of( - { - "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, - } - ) + headers = values.of({}) + + if not ( + x_twilio_webhook_enabled is values.unset + or ( + isinstance(x_twilio_webhook_enabled, str) + and not x_twilio_webhook_enabled + ) + ): + headers["X-Twilio-Webhook-Enabled"] = x_twilio_webhook_enabled + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( method="POST", uri=self._uri, data=data, headers=headers @@ -477,6 +505,10 @@ def create( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -520,6 +552,10 @@ async def create_async( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -653,7 +689,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return UserPage(self._version, response) async def page_async( @@ -680,8 +722,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return UserPage(self._version, response) diff --git a/twilio/rest/conversations/v1/user/user_conversation.py b/twilio/rest/conversations/v1/user/user_conversation.py index e162441151..16ce2c2418 100644 --- a/twilio/rest/conversations/v1/user/user_conversation.py +++ b/twilio/rest/conversations/v1/user/user_conversation.py @@ -236,10 +236,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -248,9 +248,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> UserConversationInstance: @@ -261,10 +263,11 @@ def fetch(self) -> UserConversationInstance: :returns: The fetched UserConversationInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return UserConversationInstance( self._version, @@ -281,9 +284,12 @@ async def fetch_async(self) -> UserConversationInstance: :returns: The fetched UserConversationInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return UserConversationInstance( @@ -310,6 +316,7 @@ def update( :returns: The updated UserConversationInstance """ + data = values.of( { "NotificationLevel": notification_level, @@ -317,11 +324,14 @@ def update( "LastReadMessageIndex": last_read_message_index, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return UserConversationInstance( @@ -348,6 +358,7 @@ async def update_async( :returns: The updated UserConversationInstance """ + data = values.of( { "NotificationLevel": notification_level, @@ -355,11 +366,14 @@ async def update_async( "LastReadMessageIndex": last_read_message_index, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return UserConversationInstance( @@ -545,7 +559,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return UserConversationPage(self._version, response, self._solution) async def page_async( @@ -572,8 +592,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return UserConversationPage(self._version, response, self._solution) diff --git a/twilio/rest/events/v1/event_type.py b/twilio/rest/events/v1/event_type.py index a019a82a9e..7eaaeb03ba 100644 --- a/twilio/rest/events/v1/event_type.py +++ b/twilio/rest/events/v1/event_type.py @@ -127,10 +127,11 @@ def fetch(self) -> EventTypeInstance: :returns: The fetched EventTypeInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return EventTypeInstance( self._version, @@ -146,9 +147,12 @@ async def fetch_async(self) -> EventTypeInstance: :returns: The fetched EventTypeInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return EventTypeInstance( @@ -339,7 +343,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return EventTypePage(self._version, response) async def page_async( @@ -369,8 +379,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return EventTypePage(self._version, response) diff --git a/twilio/rest/events/v1/schema/__init__.py b/twilio/rest/events/v1/schema/__init__.py index c3b6593c03..2c7ffa6b28 100644 --- a/twilio/rest/events/v1/schema/__init__.py +++ b/twilio/rest/events/v1/schema/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime from typing import Any, Dict, Optional -from twilio.base import deserialize +from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -129,10 +129,11 @@ def fetch(self) -> SchemaInstance: :returns: The fetched SchemaInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return SchemaInstance( self._version, @@ -148,9 +149,12 @@ async def fetch_async(self) -> SchemaInstance: :returns: The fetched SchemaInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return SchemaInstance( diff --git a/twilio/rest/events/v1/schema/schema_version.py b/twilio/rest/events/v1/schema/schema_version.py index 3557cb2935..be000b9c0b 100644 --- a/twilio/rest/events/v1/schema/schema_version.py +++ b/twilio/rest/events/v1/schema/schema_version.py @@ -127,10 +127,11 @@ def fetch(self) -> SchemaVersionInstance: :returns: The fetched SchemaVersionInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return SchemaVersionInstance( self._version, @@ -147,9 +148,12 @@ async def fetch_async(self) -> SchemaVersionInstance: :returns: The fetched SchemaVersionInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return SchemaVersionInstance( @@ -333,7 +337,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return SchemaVersionPage(self._version, response, self._solution) async def page_async( @@ -360,8 +370,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return SchemaVersionPage(self._version, response, self._solution) diff --git a/twilio/rest/events/v1/sink/__init__.py b/twilio/rest/events/v1/sink/__init__.py index 9098c51bd7..886c2947f5 100644 --- a/twilio/rest/events/v1/sink/__init__.py +++ b/twilio/rest/events/v1/sink/__init__.py @@ -201,10 +201,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -213,9 +213,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> SinkInstance: @@ -226,10 +228,11 @@ def fetch(self) -> SinkInstance: :returns: The fetched SinkInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return SinkInstance( self._version, @@ -245,9 +248,12 @@ async def fetch_async(self) -> SinkInstance: :returns: The fetched SinkInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return SinkInstance( @@ -264,16 +270,20 @@ def update(self, description: str) -> SinkInstance: :returns: The updated SinkInstance """ + data = values.of( { "Description": description, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SinkInstance(self._version, payload, sid=self._solution["sid"]) @@ -286,16 +296,20 @@ async def update_async(self, description: str) -> SinkInstance: :returns: The updated SinkInstance """ + data = values.of( { "Description": description, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SinkInstance(self._version, payload, sid=self._solution["sid"]) @@ -391,6 +405,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -422,6 +440,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -583,7 +605,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return SinkPage(self._version, response) async def page_async( @@ -616,8 +644,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return SinkPage(self._version, response) diff --git a/twilio/rest/events/v1/sink/sink_test.py b/twilio/rest/events/v1/sink/sink_test.py index 150e7deabc..566106efca 100644 --- a/twilio/rest/events/v1/sink/sink_test.py +++ b/twilio/rest/events/v1/sink/sink_test.py @@ -72,6 +72,8 @@ def create(self) -> SinkTestInstance: headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Accept"] = "application/json" + payload = self._version.create(method="POST", uri=self._uri, headers=headers) return SinkTestInstance(self._version, payload, sid=self._solution["sid"]) @@ -86,6 +88,8 @@ async def create_async(self) -> SinkTestInstance: headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, headers=headers ) diff --git a/twilio/rest/events/v1/sink/sink_validate.py b/twilio/rest/events/v1/sink/sink_validate.py index 8c6565a007..53eef814c0 100644 --- a/twilio/rest/events/v1/sink/sink_validate.py +++ b/twilio/rest/events/v1/sink/sink_validate.py @@ -78,6 +78,10 @@ def create(self, test_id: str) -> SinkValidateInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -100,6 +104,10 @@ async def create_async(self, test_id: str) -> SinkValidateInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/events/v1/subscription/__init__.py b/twilio/rest/events/v1/subscription/__init__.py index 2f6d7e91a2..872c9ed7d0 100644 --- a/twilio/rest/events/v1/subscription/__init__.py +++ b/twilio/rest/events/v1/subscription/__init__.py @@ -188,10 +188,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -200,9 +200,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> SubscriptionInstance: @@ -213,10 +215,11 @@ def fetch(self) -> SubscriptionInstance: :returns: The fetched SubscriptionInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return SubscriptionInstance( self._version, @@ -232,9 +235,12 @@ async def fetch_async(self) -> SubscriptionInstance: :returns: The fetched SubscriptionInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return SubscriptionInstance( @@ -256,17 +262,21 @@ def update( :returns: The updated SubscriptionInstance """ + data = values.of( { "Description": description, "SinkSid": sink_sid, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SubscriptionInstance(self._version, payload, sid=self._solution["sid"]) @@ -284,17 +294,21 @@ async def update_async( :returns: The updated SubscriptionInstance """ + data = values.of( { "Description": description, "SinkSid": sink_sid, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SubscriptionInstance(self._version, payload, sid=self._solution["sid"]) @@ -375,6 +389,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -403,6 +421,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -549,7 +571,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return SubscriptionPage(self._version, response) async def page_async( @@ -579,8 +607,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return SubscriptionPage(self._version, response) diff --git a/twilio/rest/events/v1/subscription/subscribed_event.py b/twilio/rest/events/v1/subscription/subscribed_event.py index 8547fd486b..dae60ac206 100644 --- a/twilio/rest/events/v1/subscription/subscribed_event.py +++ b/twilio/rest/events/v1/subscription/subscribed_event.py @@ -171,10 +171,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -183,9 +183,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> SubscribedEventInstance: @@ -196,10 +198,11 @@ def fetch(self) -> SubscribedEventInstance: :returns: The fetched SubscribedEventInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return SubscribedEventInstance( self._version, @@ -216,9 +219,12 @@ async def fetch_async(self) -> SubscribedEventInstance: :returns: The fetched SubscribedEventInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return SubscribedEventInstance( @@ -238,16 +244,20 @@ def update( :returns: The updated SubscribedEventInstance """ + data = values.of( { "SchemaVersion": schema_version, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SubscribedEventInstance( @@ -267,16 +277,20 @@ async def update_async( :returns: The updated SubscribedEventInstance """ + data = values.of( { "SchemaVersion": schema_version, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SubscribedEventInstance( @@ -357,6 +371,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -385,6 +403,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -520,7 +542,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return SubscribedEventPage(self._version, response, self._solution) async def page_async( @@ -547,8 +575,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return SubscribedEventPage(self._version, response, self._solution) diff --git a/twilio/rest/flex_api/v1/assessments.py b/twilio/rest/flex_api/v1/assessments.py index b24d9113d4..130514b295 100644 --- a/twilio/rest/flex_api/v1/assessments.py +++ b/twilio/rest/flex_api/v1/assessments.py @@ -176,6 +176,7 @@ def update( :returns: The updated AssessmentsInstance """ + data = values.of( { "Offset": offset, @@ -183,11 +184,17 @@ def update( "AnswerId": answer_id, } ) - headers = values.of( - { - "Authorization": authorization, - } - ) + headers = values.of({}) + + if not ( + authorization is values.unset + or (isinstance(authorization, str) and not authorization) + ): + headers["Authorization"] = authorization + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( method="POST", uri=self._uri, data=data, headers=headers @@ -214,6 +221,7 @@ async def update_async( :returns: The updated AssessmentsInstance """ + data = values.of( { "Offset": offset, @@ -221,11 +229,17 @@ async def update_async( "AnswerId": answer_id, } ) - headers = values.of( - { - "Authorization": authorization, - } - ) + headers = values.of({}) + + if not ( + authorization is values.unset + or (isinstance(authorization, str) and not authorization) + ): + headers["Authorization"] = authorization + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( method="POST", uri=self._uri, data=data, headers=headers @@ -330,6 +344,10 @@ def create( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -389,6 +407,10 @@ async def create_async( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -556,7 +578,18 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of( + { + "Authorization": authorization, + "Content-Type": "application/x-www-form-urlencoded", + } + ) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return AssessmentsPage(self._version, response) async def page_async( @@ -589,8 +622,17 @@ async def page_async( } ) + headers = values.of( + { + "Authorization": authorization, + "Content-Type": "application/x-www-form-urlencoded", + } + ) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return AssessmentsPage(self._version, response) diff --git a/twilio/rest/flex_api/v1/channel.py b/twilio/rest/flex_api/v1/channel.py index bf4feb99e1..aa98ff8d31 100644 --- a/twilio/rest/flex_api/v1/channel.py +++ b/twilio/rest/flex_api/v1/channel.py @@ -142,10 +142,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -154,9 +154,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> ChannelInstance: @@ -167,10 +169,11 @@ def fetch(self) -> ChannelInstance: :returns: The fetched ChannelInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ChannelInstance( self._version, @@ -186,9 +189,12 @@ async def fetch_async(self) -> ChannelInstance: :returns: The fetched ChannelInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ChannelInstance( @@ -285,6 +291,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -337,6 +347,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -470,7 +484,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ChannelPage(self._version, response) async def page_async( @@ -497,8 +517,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ChannelPage(self._version, response) diff --git a/twilio/rest/flex_api/v1/configuration.py b/twilio/rest/flex_api/v1/configuration.py index bec7034cfe..28a66be036 100644 --- a/twilio/rest/flex_api/v1/configuration.py +++ b/twilio/rest/flex_api/v1/configuration.py @@ -304,7 +304,13 @@ def fetch( } ) - payload = self._version.fetch(method="GET", uri=self._uri, params=data) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch( + method="GET", uri=self._uri, params=data, headers=headers + ) return ConfigurationInstance( self._version, @@ -328,8 +334,12 @@ async def fetch_async( } ) + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ConfigurationInstance( @@ -347,12 +357,13 @@ def update( :returns: The updated ConfigurationInstance """ - data = values.of({}) - headers = values.of( - { - "body": body, - } - ) + data = body.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" payload = self._version.update( method="POST", uri=self._uri, data=data, headers=headers @@ -370,12 +381,13 @@ async def update_async( :returns: The updated ConfigurationInstance """ - data = values.of({}) - headers = values.of( - { - "body": body, - } - ) + data = body.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" payload = await self._version.update_async( method="POST", uri=self._uri, data=data, headers=headers diff --git a/twilio/rest/flex_api/v1/flex_flow.py b/twilio/rest/flex_api/v1/flex_flow.py index 531dd470b2..0ae2634666 100644 --- a/twilio/rest/flex_api/v1/flex_flow.py +++ b/twilio/rest/flex_api/v1/flex_flow.py @@ -302,10 +302,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -314,9 +314,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> FlexFlowInstance: @@ -327,10 +329,11 @@ def fetch(self) -> FlexFlowInstance: :returns: The fetched FlexFlowInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return FlexFlowInstance( self._version, @@ -346,9 +349,12 @@ async def fetch_async(self) -> FlexFlowInstance: :returns: The fetched FlexFlowInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return FlexFlowInstance( @@ -402,6 +408,7 @@ def update( :returns: The updated FlexFlowInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -425,11 +432,14 @@ def update( "Integration.RetryCount": integration_retry_count, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return FlexFlowInstance(self._version, payload, sid=self._solution["sid"]) @@ -479,6 +489,7 @@ async def update_async( :returns: The updated FlexFlowInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -502,11 +513,14 @@ async def update_async( "Integration.RetryCount": integration_retry_count, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return FlexFlowInstance(self._version, payload, sid=self._solution["sid"]) @@ -624,6 +638,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -701,6 +719,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -849,7 +871,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return FlexFlowPage(self._version, response) async def page_async( @@ -879,8 +907,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return FlexFlowPage(self._version, response) diff --git a/twilio/rest/flex_api/v1/insights_assessments_comment.py b/twilio/rest/flex_api/v1/insights_assessments_comment.py index faeb6ae62c..2b6c79343b 100644 --- a/twilio/rest/flex_api/v1/insights_assessments_comment.py +++ b/twilio/rest/flex_api/v1/insights_assessments_comment.py @@ -138,6 +138,10 @@ def create( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -185,6 +189,10 @@ async def create_async( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -367,7 +375,18 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of( + { + "Authorization": authorization, + "Content-Type": "application/x-www-form-urlencoded", + } + ) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return InsightsAssessmentsCommentPage(self._version, response) async def page_async( @@ -403,8 +422,17 @@ async def page_async( } ) + headers = values.of( + { + "Authorization": authorization, + "Content-Type": "application/x-www-form-urlencoded", + } + ) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return InsightsAssessmentsCommentPage(self._version, response) diff --git a/twilio/rest/flex_api/v1/insights_conversations.py b/twilio/rest/flex_api/v1/insights_conversations.py index d08608c7e4..efdcea203e 100644 --- a/twilio/rest/flex_api/v1/insights_conversations.py +++ b/twilio/rest/flex_api/v1/insights_conversations.py @@ -242,7 +242,18 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of( + { + "Authorization": authorization, + "Content-Type": "application/x-www-form-urlencoded", + } + ) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return InsightsConversationsPage(self._version, response) async def page_async( @@ -275,8 +286,17 @@ async def page_async( } ) + headers = values.of( + { + "Authorization": authorization, + "Content-Type": "application/x-www-form-urlencoded", + } + ) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return InsightsConversationsPage(self._version, response) diff --git a/twilio/rest/flex_api/v1/insights_questionnaires.py b/twilio/rest/flex_api/v1/insights_questionnaires.py index 1724e2a253..d21aff8242 100644 --- a/twilio/rest/flex_api/v1/insights_questionnaires.py +++ b/twilio/rest/flex_api/v1/insights_questionnaires.py @@ -221,6 +221,8 @@ def delete(self, authorization: Union[str, object] = values.unset) -> bool: } ) + headers = values.of({}) + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async( @@ -239,6 +241,8 @@ async def delete_async( } ) + headers = values.of({}) + return await self._version.delete_async( method="DELETE", uri=self._uri, headers=headers ) @@ -260,7 +264,13 @@ def fetch( } ) - payload = self._version.fetch(method="GET", uri=self._uri, params=data) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch( + method="GET", uri=self._uri, params=data, headers=headers + ) return InsightsQuestionnairesInstance( self._version, @@ -285,8 +295,12 @@ async def fetch_async( } ) + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return InsightsQuestionnairesInstance( @@ -314,6 +328,7 @@ def update( :returns: The updated InsightsQuestionnairesInstance """ + data = values.of( { "Active": serialize.boolean_to_string(active), @@ -322,11 +337,17 @@ def update( "QuestionSids": serialize.map(question_sids, lambda e: e), } ) - headers = values.of( - { - "Authorization": authorization, - } - ) + headers = values.of({}) + + if not ( + authorization is values.unset + or (isinstance(authorization, str) and not authorization) + ): + headers["Authorization"] = authorization + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( method="POST", uri=self._uri, data=data, headers=headers @@ -357,6 +378,7 @@ async def update_async( :returns: The updated InsightsQuestionnairesInstance """ + data = values.of( { "Active": serialize.boolean_to_string(active), @@ -365,11 +387,17 @@ async def update_async( "QuestionSids": serialize.map(question_sids, lambda e: e), } ) - headers = values.of( - { - "Authorization": authorization, - } - ) + headers = values.of({}) + + if not ( + authorization is values.unset + or (isinstance(authorization, str) and not authorization) + ): + headers["Authorization"] = authorization + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( method="POST", uri=self._uri, data=data, headers=headers @@ -458,6 +486,10 @@ def create( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -499,6 +531,10 @@ async def create_async( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -666,7 +702,18 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of( + { + "Authorization": authorization, + "Content-Type": "application/x-www-form-urlencoded", + } + ) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return InsightsQuestionnairesPage(self._version, response) async def page_async( @@ -699,8 +746,17 @@ async def page_async( } ) + headers = values.of( + { + "Authorization": authorization, + "Content-Type": "application/x-www-form-urlencoded", + } + ) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return InsightsQuestionnairesPage(self._version, response) diff --git a/twilio/rest/flex_api/v1/insights_questionnaires_category.py b/twilio/rest/flex_api/v1/insights_questionnaires_category.py index aba8eb8bdd..817a4753f9 100644 --- a/twilio/rest/flex_api/v1/insights_questionnaires_category.py +++ b/twilio/rest/flex_api/v1/insights_questionnaires_category.py @@ -165,6 +165,8 @@ def delete(self, authorization: Union[str, object] = values.unset) -> bool: } ) + headers = values.of({}) + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async( @@ -183,6 +185,8 @@ async def delete_async( } ) + headers = values.of({}) + return await self._version.delete_async( method="DELETE", uri=self._uri, headers=headers ) @@ -198,16 +202,23 @@ def update( :returns: The updated InsightsQuestionnairesCategoryInstance """ + data = values.of( { "Name": name, } ) - headers = values.of( - { - "Authorization": authorization, - } - ) + headers = values.of({}) + + if not ( + authorization is values.unset + or (isinstance(authorization, str) and not authorization) + ): + headers["Authorization"] = authorization + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( method="POST", uri=self._uri, data=data, headers=headers @@ -228,16 +239,23 @@ async def update_async( :returns: The updated InsightsQuestionnairesCategoryInstance """ + data = values.of( { "Name": name, } ) - headers = values.of( - { - "Authorization": authorization, - } - ) + headers = values.of({}) + + if not ( + authorization is values.unset + or (isinstance(authorization, str) and not authorization) + ): + headers["Authorization"] = authorization + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( method="POST", uri=self._uri, data=data, headers=headers @@ -317,6 +335,10 @@ def create( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -347,6 +369,10 @@ async def create_async( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -495,7 +521,18 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of( + { + "Authorization": authorization, + "Content-Type": "application/x-www-form-urlencoded", + } + ) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return InsightsQuestionnairesCategoryPage(self._version, response) async def page_async( @@ -525,8 +562,17 @@ async def page_async( } ) + headers = values.of( + { + "Authorization": authorization, + "Content-Type": "application/x-www-form-urlencoded", + } + ) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return InsightsQuestionnairesCategoryPage(self._version, response) diff --git a/twilio/rest/flex_api/v1/insights_questionnaires_question.py b/twilio/rest/flex_api/v1/insights_questionnaires_question.py index 363d5c07b1..33e2304599 100644 --- a/twilio/rest/flex_api/v1/insights_questionnaires_question.py +++ b/twilio/rest/flex_api/v1/insights_questionnaires_question.py @@ -205,6 +205,8 @@ def delete(self, authorization: Union[str, object] = values.unset) -> bool: } ) + headers = values.of({}) + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async( @@ -223,6 +225,8 @@ async def delete_async( } ) + headers = values.of({}) + return await self._version.delete_async( method="DELETE", uri=self._uri, headers=headers ) @@ -248,6 +252,7 @@ def update( :returns: The updated InsightsQuestionnairesQuestionInstance """ + data = values.of( { "AllowNa": serialize.boolean_to_string(allow_na), @@ -257,11 +262,17 @@ def update( "AnswerSetId": answer_set_id, } ) - headers = values.of( - { - "Authorization": authorization, - } - ) + headers = values.of({}) + + if not ( + authorization is values.unset + or (isinstance(authorization, str) and not authorization) + ): + headers["Authorization"] = authorization + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( method="POST", uri=self._uri, data=data, headers=headers @@ -292,6 +303,7 @@ async def update_async( :returns: The updated InsightsQuestionnairesQuestionInstance """ + data = values.of( { "AllowNa": serialize.boolean_to_string(allow_na), @@ -301,11 +313,17 @@ async def update_async( "AnswerSetId": answer_set_id, } ) - headers = values.of( - { - "Authorization": authorization, - } - ) + headers = values.of({}) + + if not ( + authorization is values.unset + or (isinstance(authorization, str) and not authorization) + ): + headers["Authorization"] = authorization + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( method="POST", uri=self._uri, data=data, headers=headers @@ -399,6 +417,10 @@ def create( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -443,6 +465,10 @@ async def create_async( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -610,7 +636,18 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of( + { + "Authorization": authorization, + "Content-Type": "application/x-www-form-urlencoded", + } + ) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return InsightsQuestionnairesQuestionPage(self._version, response) async def page_async( @@ -643,8 +680,17 @@ async def page_async( } ) + headers = values.of( + { + "Authorization": authorization, + "Content-Type": "application/x-www-form-urlencoded", + } + ) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return InsightsQuestionnairesQuestionPage(self._version, response) diff --git a/twilio/rest/flex_api/v1/insights_segments.py b/twilio/rest/flex_api/v1/insights_segments.py index 2d509802a9..7c98e81cff 100644 --- a/twilio/rest/flex_api/v1/insights_segments.py +++ b/twilio/rest/flex_api/v1/insights_segments.py @@ -301,7 +301,18 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of( + { + "Authorization": authorization, + "Content-Type": "application/x-www-form-urlencoded", + } + ) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return InsightsSegmentsPage(self._version, response) async def page_async( @@ -337,8 +348,17 @@ async def page_async( } ) + headers = values.of( + { + "Authorization": authorization, + "Content-Type": "application/x-www-form-urlencoded", + } + ) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return InsightsSegmentsPage(self._version, response) diff --git a/twilio/rest/flex_api/v1/insights_settings_answer_sets.py b/twilio/rest/flex_api/v1/insights_settings_answer_sets.py index d426e215a9..9b0e89e938 100644 --- a/twilio/rest/flex_api/v1/insights_settings_answer_sets.py +++ b/twilio/rest/flex_api/v1/insights_settings_answer_sets.py @@ -79,6 +79,8 @@ def fetch( } ) + headers["Accept"] = "application/json" + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return InsightsSettingsAnswerSetsInstance(self._version, payload) @@ -99,6 +101,8 @@ async def fetch_async( } ) + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( method="GET", uri=self._uri, headers=headers ) diff --git a/twilio/rest/flex_api/v1/insights_settings_comment.py b/twilio/rest/flex_api/v1/insights_settings_comment.py index 548b279181..18733a4957 100644 --- a/twilio/rest/flex_api/v1/insights_settings_comment.py +++ b/twilio/rest/flex_api/v1/insights_settings_comment.py @@ -73,6 +73,8 @@ def fetch( } ) + headers["Accept"] = "application/json" + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return InsightsSettingsCommentInstance(self._version, payload) @@ -93,6 +95,8 @@ async def fetch_async( } ) + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( method="GET", uri=self._uri, headers=headers ) diff --git a/twilio/rest/flex_api/v1/insights_user_roles.py b/twilio/rest/flex_api/v1/insights_user_roles.py index 9dbea5fa3b..19cb10b8e4 100644 --- a/twilio/rest/flex_api/v1/insights_user_roles.py +++ b/twilio/rest/flex_api/v1/insights_user_roles.py @@ -115,7 +115,13 @@ def fetch( } ) - payload = self._version.fetch(method="GET", uri=self._uri, params=data) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch( + method="GET", uri=self._uri, params=data, headers=headers + ) return InsightsUserRolesInstance( self._version, @@ -139,8 +145,12 @@ async def fetch_async( } ) + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return InsightsUserRolesInstance( diff --git a/twilio/rest/flex_api/v1/interaction/__init__.py b/twilio/rest/flex_api/v1/interaction/__init__.py index 468b3134eb..c67d9c026e 100644 --- a/twilio/rest/flex_api/v1/interaction/__init__.py +++ b/twilio/rest/flex_api/v1/interaction/__init__.py @@ -130,10 +130,11 @@ def fetch(self) -> InteractionInstance: :returns: The fetched InteractionInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return InteractionInstance( self._version, @@ -149,9 +150,12 @@ async def fetch_async(self) -> InteractionInstance: :returns: The fetched InteractionInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return InteractionInstance( @@ -220,6 +224,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -251,6 +259,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/flex_api/v1/interaction/interaction_channel/__init__.py b/twilio/rest/flex_api/v1/interaction/interaction_channel/__init__.py index a26dc0425e..781adb9797 100644 --- a/twilio/rest/flex_api/v1/interaction/interaction_channel/__init__.py +++ b/twilio/rest/flex_api/v1/interaction/interaction_channel/__init__.py @@ -213,10 +213,11 @@ def fetch(self) -> InteractionChannelInstance: :returns: The fetched InteractionChannelInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return InteractionChannelInstance( self._version, @@ -233,9 +234,12 @@ async def fetch_async(self) -> InteractionChannelInstance: :returns: The fetched InteractionChannelInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return InteractionChannelInstance( @@ -258,17 +262,21 @@ def update( :returns: The updated InteractionChannelInstance """ + data = values.of( { "Status": status, "Routing": serialize.object(routing), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return InteractionChannelInstance( @@ -291,17 +299,21 @@ async def update_async( :returns: The updated InteractionChannelInstance """ + data = values.of( { "Status": status, "Routing": serialize.object(routing), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return InteractionChannelInstance( @@ -513,7 +525,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return InteractionChannelPage(self._version, response, self._solution) async def page_async( @@ -540,8 +558,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return InteractionChannelPage(self._version, response, self._solution) diff --git a/twilio/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_invite.py b/twilio/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_invite.py index 2ffa14b1df..a81acd4fc4 100644 --- a/twilio/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_invite.py +++ b/twilio/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_invite.py @@ -124,6 +124,10 @@ def create(self, routing: object) -> InteractionChannelInviteInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -151,6 +155,10 @@ async def create_async(self, routing: object) -> InteractionChannelInviteInstanc ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -289,7 +297,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return InteractionChannelInvitePage(self._version, response, self._solution) async def page_async( @@ -316,8 +330,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return InteractionChannelInvitePage(self._version, response, self._solution) diff --git a/twilio/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_participant.py b/twilio/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_participant.py index 225ca3efaf..53d2d40dbf 100644 --- a/twilio/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_participant.py +++ b/twilio/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_participant.py @@ -163,16 +163,20 @@ def update( :returns: The updated InteractionChannelParticipantInstance """ + data = values.of( { "Status": status, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return InteractionChannelParticipantInstance( @@ -193,16 +197,20 @@ async def update_async( :returns: The updated InteractionChannelParticipantInstance """ + data = values.of( { "Status": status, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return InteractionChannelParticipantInstance( @@ -298,6 +306,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -334,6 +346,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -472,7 +488,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return InteractionChannelParticipantPage( self._version, response, self._solution ) @@ -501,8 +523,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return InteractionChannelParticipantPage( self._version, response, self._solution diff --git a/twilio/rest/flex_api/v1/plugin/__init__.py b/twilio/rest/flex_api/v1/plugin/__init__.py index b6baf8f935..2415c42710 100644 --- a/twilio/rest/flex_api/v1/plugin/__init__.py +++ b/twilio/rest/flex_api/v1/plugin/__init__.py @@ -198,7 +198,13 @@ def fetch(self, flex_metadata: Union[str, object] = values.unset) -> PluginInsta } ) - payload = self._version.fetch(method="GET", uri=self._uri, params=data) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch( + method="GET", uri=self._uri, params=data, headers=headers + ) return PluginInstance( self._version, @@ -223,8 +229,12 @@ async def fetch_async( } ) + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return PluginInstance( @@ -248,17 +258,24 @@ def update( :returns: The updated PluginInstance """ + data = values.of( { "FriendlyName": friendly_name, "Description": description, } ) - headers = values.of( - { - "Flex-Metadata": flex_metadata, - } - ) + headers = values.of({}) + + if not ( + flex_metadata is values.unset + or (isinstance(flex_metadata, str) and not flex_metadata) + ): + headers["Flex-Metadata"] = flex_metadata + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( method="POST", uri=self._uri, data=data, headers=headers @@ -281,17 +298,24 @@ async def update_async( :returns: The updated PluginInstance """ + data = values.of( { "FriendlyName": friendly_name, "Description": description, } ) - headers = values.of( - { - "Flex-Metadata": flex_metadata, - } - ) + headers = values.of({}) + + if not ( + flex_metadata is values.unset + or (isinstance(flex_metadata, str) and not flex_metadata) + ): + headers["Flex-Metadata"] = flex_metadata + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( method="POST", uri=self._uri, data=data, headers=headers @@ -385,6 +409,10 @@ def create( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -423,6 +451,10 @@ async def create_async( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -571,7 +603,18 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of( + { + "Flex-Metadata": flex_metadata, + "Content-Type": "application/x-www-form-urlencoded", + } + ) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return PluginPage(self._version, response) async def page_async( @@ -601,8 +644,17 @@ async def page_async( } ) + headers = values.of( + { + "Flex-Metadata": flex_metadata, + "Content-Type": "application/x-www-form-urlencoded", + } + ) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return PluginPage(self._version, response) diff --git a/twilio/rest/flex_api/v1/plugin/plugin_versions.py b/twilio/rest/flex_api/v1/plugin/plugin_versions.py index 3da4de3ac7..4d66ef572b 100644 --- a/twilio/rest/flex_api/v1/plugin/plugin_versions.py +++ b/twilio/rest/flex_api/v1/plugin/plugin_versions.py @@ -158,7 +158,13 @@ def fetch( } ) - payload = self._version.fetch(method="GET", uri=self._uri, params=data) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch( + method="GET", uri=self._uri, params=data, headers=headers + ) return PluginVersionsInstance( self._version, @@ -184,8 +190,12 @@ async def fetch_async( } ) + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return PluginVersionsInstance( @@ -287,6 +297,10 @@ def create( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -336,6 +350,10 @@ async def create_async( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -486,7 +504,18 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of( + { + "Flex-Metadata": flex_metadata, + "Content-Type": "application/x-www-form-urlencoded", + } + ) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return PluginVersionsPage(self._version, response, self._solution) async def page_async( @@ -516,8 +545,17 @@ async def page_async( } ) + headers = values.of( + { + "Flex-Metadata": flex_metadata, + "Content-Type": "application/x-www-form-urlencoded", + } + ) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return PluginVersionsPage(self._version, response, self._solution) diff --git a/twilio/rest/flex_api/v1/plugin_archive.py b/twilio/rest/flex_api/v1/plugin_archive.py index 68f9bce384..e7f526a919 100644 --- a/twilio/rest/flex_api/v1/plugin_archive.py +++ b/twilio/rest/flex_api/v1/plugin_archive.py @@ -138,12 +138,17 @@ def update( :returns: The updated PluginArchiveInstance """ + data = values.of({}) - headers = values.of( - { - "Flex-Metadata": flex_metadata, - } - ) + headers = values.of({}) + + if not ( + flex_metadata is values.unset + or (isinstance(flex_metadata, str) and not flex_metadata) + ): + headers["Flex-Metadata"] = flex_metadata + + headers["Accept"] = "application/json" payload = self._version.update( method="POST", uri=self._uri, data=data, headers=headers @@ -161,12 +166,17 @@ async def update_async( :returns: The updated PluginArchiveInstance """ + data = values.of({}) - headers = values.of( - { - "Flex-Metadata": flex_metadata, - } - ) + headers = values.of({}) + + if not ( + flex_metadata is values.unset + or (isinstance(flex_metadata, str) and not flex_metadata) + ): + headers["Flex-Metadata"] = flex_metadata + + headers["Accept"] = "application/json" payload = await self._version.update_async( method="POST", uri=self._uri, data=data, headers=headers diff --git a/twilio/rest/flex_api/v1/plugin_configuration/__init__.py b/twilio/rest/flex_api/v1/plugin_configuration/__init__.py index 9b76695243..b17d697e3b 100644 --- a/twilio/rest/flex_api/v1/plugin_configuration/__init__.py +++ b/twilio/rest/flex_api/v1/plugin_configuration/__init__.py @@ -154,7 +154,13 @@ def fetch( } ) - payload = self._version.fetch(method="GET", uri=self._uri, params=data) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch( + method="GET", uri=self._uri, params=data, headers=headers + ) return PluginConfigurationInstance( self._version, @@ -179,8 +185,12 @@ async def fetch_async( } ) + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return PluginConfigurationInstance( @@ -275,6 +285,10 @@ def create( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -313,6 +327,10 @@ async def create_async( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -461,7 +479,18 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of( + { + "Flex-Metadata": flex_metadata, + "Content-Type": "application/x-www-form-urlencoded", + } + ) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return PluginConfigurationPage(self._version, response) async def page_async( @@ -491,8 +520,17 @@ async def page_async( } ) + headers = values.of( + { + "Flex-Metadata": flex_metadata, + "Content-Type": "application/x-www-form-urlencoded", + } + ) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return PluginConfigurationPage(self._version, response) diff --git a/twilio/rest/flex_api/v1/plugin_configuration/configured_plugin.py b/twilio/rest/flex_api/v1/plugin_configuration/configured_plugin.py index 6e54012eb0..062a7db7b4 100644 --- a/twilio/rest/flex_api/v1/plugin_configuration/configured_plugin.py +++ b/twilio/rest/flex_api/v1/plugin_configuration/configured_plugin.py @@ -170,7 +170,13 @@ def fetch( } ) - payload = self._version.fetch(method="GET", uri=self._uri, params=data) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch( + method="GET", uri=self._uri, params=data, headers=headers + ) return ConfiguredPluginInstance( self._version, @@ -196,8 +202,12 @@ async def fetch_async( } ) + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ConfiguredPluginInstance( @@ -402,7 +412,18 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of( + { + "Flex-Metadata": flex_metadata, + "Content-Type": "application/x-www-form-urlencoded", + } + ) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ConfiguredPluginPage(self._version, response, self._solution) async def page_async( @@ -432,8 +453,17 @@ async def page_async( } ) + headers = values.of( + { + "Flex-Metadata": flex_metadata, + "Content-Type": "application/x-www-form-urlencoded", + } + ) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ConfiguredPluginPage(self._version, response, self._solution) diff --git a/twilio/rest/flex_api/v1/plugin_configuration_archive.py b/twilio/rest/flex_api/v1/plugin_configuration_archive.py index 97d2f8120d..3fec073333 100644 --- a/twilio/rest/flex_api/v1/plugin_configuration_archive.py +++ b/twilio/rest/flex_api/v1/plugin_configuration_archive.py @@ -136,12 +136,17 @@ def update( :returns: The updated PluginConfigurationArchiveInstance """ + data = values.of({}) - headers = values.of( - { - "Flex-Metadata": flex_metadata, - } - ) + headers = values.of({}) + + if not ( + flex_metadata is values.unset + or (isinstance(flex_metadata, str) and not flex_metadata) + ): + headers["Flex-Metadata"] = flex_metadata + + headers["Accept"] = "application/json" payload = self._version.update( method="POST", uri=self._uri, data=data, headers=headers @@ -161,12 +166,17 @@ async def update_async( :returns: The updated PluginConfigurationArchiveInstance """ + data = values.of({}) - headers = values.of( - { - "Flex-Metadata": flex_metadata, - } - ) + headers = values.of({}) + + if not ( + flex_metadata is values.unset + or (isinstance(flex_metadata, str) and not flex_metadata) + ): + headers["Flex-Metadata"] = flex_metadata + + headers["Accept"] = "application/json" payload = await self._version.update_async( method="POST", uri=self._uri, data=data, headers=headers diff --git a/twilio/rest/flex_api/v1/plugin_release.py b/twilio/rest/flex_api/v1/plugin_release.py index e339183297..0694b05f8b 100644 --- a/twilio/rest/flex_api/v1/plugin_release.py +++ b/twilio/rest/flex_api/v1/plugin_release.py @@ -136,7 +136,13 @@ def fetch( } ) - payload = self._version.fetch(method="GET", uri=self._uri, params=data) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch( + method="GET", uri=self._uri, params=data, headers=headers + ) return PluginReleaseInstance( self._version, @@ -161,8 +167,12 @@ async def fetch_async( } ) + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return PluginReleaseInstance( @@ -237,6 +247,10 @@ def create( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -267,6 +281,10 @@ async def create_async( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -415,7 +433,18 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of( + { + "Flex-Metadata": flex_metadata, + "Content-Type": "application/x-www-form-urlencoded", + } + ) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return PluginReleasePage(self._version, response) async def page_async( @@ -445,8 +474,17 @@ async def page_async( } ) + headers = values.of( + { + "Flex-Metadata": flex_metadata, + "Content-Type": "application/x-www-form-urlencoded", + } + ) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return PluginReleasePage(self._version, response) diff --git a/twilio/rest/flex_api/v1/plugin_version_archive.py b/twilio/rest/flex_api/v1/plugin_version_archive.py index ae8d2f3dff..be169d4d64 100644 --- a/twilio/rest/flex_api/v1/plugin_version_archive.py +++ b/twilio/rest/flex_api/v1/plugin_version_archive.py @@ -148,12 +148,17 @@ def update( :returns: The updated PluginVersionArchiveInstance """ + data = values.of({}) - headers = values.of( - { - "Flex-Metadata": flex_metadata, - } - ) + headers = values.of({}) + + if not ( + flex_metadata is values.unset + or (isinstance(flex_metadata, str) and not flex_metadata) + ): + headers["Flex-Metadata"] = flex_metadata + + headers["Accept"] = "application/json" payload = self._version.update( method="POST", uri=self._uri, data=data, headers=headers @@ -176,12 +181,17 @@ async def update_async( :returns: The updated PluginVersionArchiveInstance """ + data = values.of({}) - headers = values.of( - { - "Flex-Metadata": flex_metadata, - } - ) + headers = values.of({}) + + if not ( + flex_metadata is values.unset + or (isinstance(flex_metadata, str) and not flex_metadata) + ): + headers["Flex-Metadata"] = flex_metadata + + headers["Accept"] = "application/json" payload = await self._version.update_async( method="POST", uri=self._uri, data=data, headers=headers diff --git a/twilio/rest/flex_api/v1/provisioning_status.py b/twilio/rest/flex_api/v1/provisioning_status.py index 9cc9144dcc..2a7bc5b465 100644 --- a/twilio/rest/flex_api/v1/provisioning_status.py +++ b/twilio/rest/flex_api/v1/provisioning_status.py @@ -13,6 +13,7 @@ """ from typing import Any, Dict, Optional +from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -104,10 +105,11 @@ def fetch(self) -> ProvisioningStatusInstance: :returns: The fetched ProvisioningStatusInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ProvisioningStatusInstance( self._version, @@ -122,9 +124,12 @@ async def fetch_async(self) -> ProvisioningStatusInstance: :returns: The fetched ProvisioningStatusInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ProvisioningStatusInstance( diff --git a/twilio/rest/flex_api/v1/web_channel.py b/twilio/rest/flex_api/v1/web_channel.py index a96698f8cb..46e44fcecd 100644 --- a/twilio/rest/flex_api/v1/web_channel.py +++ b/twilio/rest/flex_api/v1/web_channel.py @@ -178,10 +178,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -190,9 +190,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> WebChannelInstance: @@ -203,10 +205,11 @@ def fetch(self) -> WebChannelInstance: :returns: The fetched WebChannelInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return WebChannelInstance( self._version, @@ -222,9 +225,12 @@ async def fetch_async(self) -> WebChannelInstance: :returns: The fetched WebChannelInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return WebChannelInstance( @@ -246,17 +252,21 @@ def update( :returns: The updated WebChannelInstance """ + data = values.of( { "ChatStatus": chat_status, "PostEngagementData": post_engagement_data, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return WebChannelInstance(self._version, payload, sid=self._solution["sid"]) @@ -274,17 +284,21 @@ async def update_async( :returns: The updated WebChannelInstance """ + data = values.of( { "ChatStatus": chat_status, "PostEngagementData": post_engagement_data, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return WebChannelInstance(self._version, payload, sid=self._solution["sid"]) @@ -365,6 +379,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -405,6 +423,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -538,7 +560,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return WebChannelPage(self._version, response) async def page_async( @@ -565,8 +593,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return WebChannelPage(self._version, response) diff --git a/twilio/rest/flex_api/v2/flex_user.py b/twilio/rest/flex_api/v2/flex_user.py index 0f5b1571f2..480a439b85 100644 --- a/twilio/rest/flex_api/v2/flex_user.py +++ b/twilio/rest/flex_api/v2/flex_user.py @@ -214,10 +214,11 @@ def fetch(self) -> FlexUserInstance: :returns: The fetched FlexUserInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return FlexUserInstance( self._version, @@ -234,9 +235,12 @@ async def fetch_async(self) -> FlexUserInstance: :returns: The fetched FlexUserInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return FlexUserInstance( @@ -267,6 +271,7 @@ def update( :returns: The updated FlexUserInstance """ + data = values.of( { "FirstName": first_name, @@ -277,11 +282,14 @@ def update( "Locale": locale, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return FlexUserInstance( @@ -312,6 +320,7 @@ async def update_async( :returns: The updated FlexUserInstance """ + data = values.of( { "FirstName": first_name, @@ -322,11 +331,14 @@ async def update_async( "Locale": locale, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return FlexUserInstance( diff --git a/twilio/rest/flex_api/v2/web_channels.py b/twilio/rest/flex_api/v2/web_channels.py index 153f59cae9..8e5aff8226 100644 --- a/twilio/rest/flex_api/v2/web_channels.py +++ b/twilio/rest/flex_api/v2/web_channels.py @@ -90,6 +90,10 @@ def create( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -131,6 +135,10 @@ async def create_async( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/frontline_api/v1/user.py b/twilio/rest/frontline_api/v1/user.py index 8c9dd93853..a45ed2ffee 100644 --- a/twilio/rest/frontline_api/v1/user.py +++ b/twilio/rest/frontline_api/v1/user.py @@ -170,10 +170,11 @@ def fetch(self) -> UserInstance: :returns: The fetched UserInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return UserInstance( self._version, @@ -189,9 +190,12 @@ async def fetch_async(self) -> UserInstance: :returns: The fetched UserInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return UserInstance( @@ -217,6 +221,7 @@ def update( :returns: The updated UserInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -225,11 +230,14 @@ def update( "IsAvailable": serialize.boolean_to_string(is_available), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return UserInstance(self._version, payload, sid=self._solution["sid"]) @@ -251,6 +259,7 @@ async def update_async( :returns: The updated UserInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -259,11 +268,14 @@ async def update_async( "IsAvailable": serialize.boolean_to_string(is_available), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return UserInstance(self._version, payload, sid=self._solution["sid"]) diff --git a/twilio/rest/iam/v1/__init__.py b/twilio/rest/iam/v1/__init__.py index 408de11acb..0c46947341 100644 --- a/twilio/rest/iam/v1/__init__.py +++ b/twilio/rest/iam/v1/__init__.py @@ -17,7 +17,7 @@ from twilio.base.domain import Domain from twilio.rest.iam.v1.api_key import ApiKeyList from twilio.rest.iam.v1.get_api_keys import GetApiKeysList -from twilio.rest.iam.v1.key import KeyList +from twilio.rest.iam.v1.new_api_key import NewApiKeyList class V1(Version): @@ -31,7 +31,7 @@ def __init__(self, domain: Domain): super().__init__(domain, "v1") self._api_key: Optional[ApiKeyList] = None self._get_api_keys: Optional[GetApiKeysList] = None - self._keys: Optional[KeyList] = None + self._new_api_key: Optional[NewApiKeyList] = None @property def api_key(self) -> ApiKeyList: @@ -46,10 +46,10 @@ def get_api_keys(self) -> GetApiKeysList: return self._get_api_keys @property - def keys(self) -> KeyList: - if self._keys is None: - self._keys = KeyList(self) - return self._keys + def new_api_key(self) -> NewApiKeyList: + if self._new_api_key is None: + self._new_api_key = NewApiKeyList(self) + return self._new_api_key def __repr__(self) -> str: """ diff --git a/twilio/rest/iam/v1/api_key.py b/twilio/rest/iam/v1/api_key.py index b94889fcca..f07512c09b 100644 --- a/twilio/rest/iam/v1/api_key.py +++ b/twilio/rest/iam/v1/api_key.py @@ -171,10 +171,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -183,9 +183,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> ApiKeyInstance: @@ -196,10 +198,11 @@ def fetch(self) -> ApiKeyInstance: :returns: The fetched ApiKeyInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ApiKeyInstance( self._version, @@ -215,9 +218,12 @@ async def fetch_async(self) -> ApiKeyInstance: :returns: The fetched ApiKeyInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ApiKeyInstance( @@ -239,17 +245,21 @@ def update( :returns: The updated ApiKeyInstance """ + data = values.of( { "FriendlyName": friendly_name, "Policy": serialize.object(policy), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ApiKeyInstance(self._version, payload, sid=self._solution["sid"]) @@ -267,17 +277,21 @@ async def update_async( :returns: The updated ApiKeyInstance """ + data = values.of( { "FriendlyName": friendly_name, "Policy": serialize.object(policy), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ApiKeyInstance(self._version, payload, sid=self._solution["sid"]) diff --git a/twilio/rest/iam/v1/get_api_keys.py b/twilio/rest/iam/v1/get_api_keys.py index 3a3e9bda76..03b29cdb38 100644 --- a/twilio/rest/iam/v1/get_api_keys.py +++ b/twilio/rest/iam/v1/get_api_keys.py @@ -226,7 +226,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return GetApiKeysPage(self._version, response) async def page_async( @@ -256,8 +262,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return GetApiKeysPage(self._version, response) diff --git a/twilio/rest/iam/v1/key.py b/twilio/rest/iam/v1/new_api_key.py similarity index 84% rename from twilio/rest/iam/v1/key.py rename to twilio/rest/iam/v1/new_api_key.py index 5adcbc6939..760ce79ca3 100644 --- a/twilio/rest/iam/v1/key.py +++ b/twilio/rest/iam/v1/new_api_key.py @@ -21,7 +21,7 @@ from twilio.base.version import Version -class KeyInstance(InstanceResource): +class NewApiKeyInstance(InstanceResource): class Keytype(object): RESTRICTED = "restricted" @@ -56,14 +56,14 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" -class KeyList(ListResource): +class NewApiKeyList(ListResource): def __init__(self, version: Version): """ - Initialize the KeyList + Initialize the NewApiKeyList :param version: Version that contains the resource @@ -76,18 +76,18 @@ def create( self, account_sid: str, friendly_name: Union[str, object] = values.unset, - key_type: Union["KeyInstance.Keytype", object] = values.unset, + key_type: Union["NewApiKeyInstance.Keytype", object] = values.unset, policy: Union[object, object] = values.unset, - ) -> KeyInstance: + ) -> NewApiKeyInstance: """ - Create the KeyInstance + Create the NewApiKeyInstance :param account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Payments resource. :param friendly_name: A descriptive string that you create to describe the resource. It can be up to 64 characters long. :param key_type: :param policy: The \\\\`Policy\\\\` object is a collection that specifies the allowed Twilio permissions for the restricted key. For more information on the permissions available with restricted API keys, refer to the [Twilio documentation](https://www.twilio.com/docs/iam/api-keys/restricted-api-keys#permissions-available-with-restricted-api-keys). - :returns: The created KeyInstance + :returns: The created NewApiKeyInstance """ data = values.of( @@ -100,28 +100,32 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) - return KeyInstance(self._version, payload) + return NewApiKeyInstance(self._version, payload) async def create_async( self, account_sid: str, friendly_name: Union[str, object] = values.unset, - key_type: Union["KeyInstance.Keytype", object] = values.unset, + key_type: Union["NewApiKeyInstance.Keytype", object] = values.unset, policy: Union[object, object] = values.unset, - ) -> KeyInstance: + ) -> NewApiKeyInstance: """ - Asynchronously create the KeyInstance + Asynchronously create the NewApiKeyInstance :param account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Payments resource. :param friendly_name: A descriptive string that you create to describe the resource. It can be up to 64 characters long. :param key_type: :param policy: The \\\\`Policy\\\\` object is a collection that specifies the allowed Twilio permissions for the restricted key. For more information on the permissions available with restricted API keys, refer to the [Twilio documentation](https://www.twilio.com/docs/iam/api-keys/restricted-api-keys#permissions-available-with-restricted-api-keys). - :returns: The created KeyInstance + :returns: The created NewApiKeyInstance """ data = values.of( @@ -134,11 +138,15 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) - return KeyInstance(self._version, payload) + return NewApiKeyInstance(self._version, payload) def __repr__(self) -> str: """ @@ -146,4 +154,4 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" diff --git a/twilio/rest/insights/v1/call/__init__.py b/twilio/rest/insights/v1/call/__init__.py index ff628b7d06..cb08aa58aa 100644 --- a/twilio/rest/insights/v1/call/__init__.py +++ b/twilio/rest/insights/v1/call/__init__.py @@ -13,6 +13,7 @@ """ from typing import Any, Dict, Optional +from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -146,10 +147,11 @@ def fetch(self) -> CallInstance: :returns: The fetched CallInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return CallInstance( self._version, @@ -165,9 +167,12 @@ async def fetch_async(self) -> CallInstance: :returns: The fetched CallInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return CallInstance( diff --git a/twilio/rest/insights/v1/call/annotation.py b/twilio/rest/insights/v1/call/annotation.py index d560003c0a..6e705d3916 100644 --- a/twilio/rest/insights/v1/call/annotation.py +++ b/twilio/rest/insights/v1/call/annotation.py @@ -209,10 +209,11 @@ def fetch(self) -> AnnotationInstance: :returns: The fetched AnnotationInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return AnnotationInstance( self._version, @@ -228,9 +229,12 @@ async def fetch_async(self) -> AnnotationInstance: :returns: The fetched AnnotationInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return AnnotationInstance( @@ -264,6 +268,7 @@ def update( :returns: The updated AnnotationInstance """ + data = values.of( { "AnsweredBy": answered_by, @@ -275,11 +280,14 @@ def update( "Incident": incident, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AnnotationInstance( @@ -311,6 +319,7 @@ async def update_async( :returns: The updated AnnotationInstance """ + data = values.of( { "AnsweredBy": answered_by, @@ -322,11 +331,14 @@ async def update_async( "Incident": incident, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AnnotationInstance( diff --git a/twilio/rest/insights/v1/call/call_summary.py b/twilio/rest/insights/v1/call/call_summary.py index 0e256b36c8..f11aa912ed 100644 --- a/twilio/rest/insights/v1/call/call_summary.py +++ b/twilio/rest/insights/v1/call/call_summary.py @@ -222,7 +222,13 @@ def fetch( } ) - payload = self._version.fetch(method="GET", uri=self._uri, params=data) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch( + method="GET", uri=self._uri, params=data, headers=headers + ) return CallSummaryInstance( self._version, @@ -250,8 +256,12 @@ async def fetch_async( } ) + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return CallSummaryInstance( diff --git a/twilio/rest/insights/v1/call/event.py b/twilio/rest/insights/v1/call/event.py index 89734f110a..98dce5eb71 100644 --- a/twilio/rest/insights/v1/call/event.py +++ b/twilio/rest/insights/v1/call/event.py @@ -259,7 +259,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return EventPage(self._version, response, self._solution) async def page_async( @@ -289,8 +295,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return EventPage(self._version, response, self._solution) diff --git a/twilio/rest/insights/v1/call/metric.py b/twilio/rest/insights/v1/call/metric.py index 3cf9decc53..77f770ae7c 100644 --- a/twilio/rest/insights/v1/call/metric.py +++ b/twilio/rest/insights/v1/call/metric.py @@ -271,7 +271,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return MetricPage(self._version, response, self._solution) async def page_async( @@ -304,8 +310,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return MetricPage(self._version, response, self._solution) diff --git a/twilio/rest/insights/v1/call_summaries.py b/twilio/rest/insights/v1/call_summaries.py index 35cf41aa49..45fcce98c1 100644 --- a/twilio/rest/insights/v1/call_summaries.py +++ b/twilio/rest/insights/v1/call_summaries.py @@ -797,7 +797,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return CallSummariesPage(self._version, response) async def page_async( @@ -924,8 +930,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return CallSummariesPage(self._version, response) diff --git a/twilio/rest/insights/v1/conference/__init__.py b/twilio/rest/insights/v1/conference/__init__.py index 63b8abbf9a..0f9bb118b5 100644 --- a/twilio/rest/insights/v1/conference/__init__.py +++ b/twilio/rest/insights/v1/conference/__init__.py @@ -240,10 +240,11 @@ def fetch(self) -> ConferenceInstance: :returns: The fetched ConferenceInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ConferenceInstance( self._version, @@ -259,9 +260,12 @@ async def fetch_async(self) -> ConferenceInstance: :returns: The fetched ConferenceInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ConferenceInstance( @@ -605,7 +609,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ConferencePage(self._version, response) async def page_async( @@ -662,8 +672,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ConferencePage(self._version, response) diff --git a/twilio/rest/insights/v1/conference/conference_participant.py b/twilio/rest/insights/v1/conference/conference_participant.py index 68faa690b3..203f950699 100644 --- a/twilio/rest/insights/v1/conference/conference_participant.py +++ b/twilio/rest/insights/v1/conference/conference_participant.py @@ -268,7 +268,13 @@ def fetch( } ) - payload = self._version.fetch(method="GET", uri=self._uri, params=data) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch( + method="GET", uri=self._uri, params=data, headers=headers + ) return ConferenceParticipantInstance( self._version, @@ -298,8 +304,12 @@ async def fetch_async( } ) + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ConferenceParticipantInstance( @@ -536,7 +546,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ConferenceParticipantPage(self._version, response, self._solution) async def page_async( @@ -572,8 +588,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ConferenceParticipantPage(self._version, response, self._solution) diff --git a/twilio/rest/insights/v1/room/__init__.py b/twilio/rest/insights/v1/room/__init__.py index abcc9f8c5b..0b987c020a 100644 --- a/twilio/rest/insights/v1/room/__init__.py +++ b/twilio/rest/insights/v1/room/__init__.py @@ -252,10 +252,11 @@ def fetch(self) -> RoomInstance: :returns: The fetched RoomInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return RoomInstance( self._version, @@ -271,9 +272,12 @@ async def fetch_async(self) -> RoomInstance: :returns: The fetched RoomInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return RoomInstance( @@ -542,7 +546,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return RoomPage(self._version, response) async def page_async( @@ -584,8 +594,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return RoomPage(self._version, response) diff --git a/twilio/rest/insights/v1/room/participant.py b/twilio/rest/insights/v1/room/participant.py index 6c2b8448cf..0791ec287c 100644 --- a/twilio/rest/insights/v1/room/participant.py +++ b/twilio/rest/insights/v1/room/participant.py @@ -193,10 +193,11 @@ def fetch(self) -> ParticipantInstance: :returns: The fetched ParticipantInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ParticipantInstance( self._version, @@ -213,9 +214,12 @@ async def fetch_async(self) -> ParticipantInstance: :returns: The fetched ParticipantInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ParticipantInstance( @@ -401,7 +405,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ParticipantPage(self._version, response, self._solution) async def page_async( @@ -428,8 +438,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ParticipantPage(self._version, response, self._solution) diff --git a/twilio/rest/insights/v1/setting.py b/twilio/rest/insights/v1/setting.py index c385fc424e..3c6b746f07 100644 --- a/twilio/rest/insights/v1/setting.py +++ b/twilio/rest/insights/v1/setting.py @@ -161,7 +161,13 @@ def fetch( } ) - payload = self._version.fetch(method="GET", uri=self._uri, params=data) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch( + method="GET", uri=self._uri, params=data, headers=headers + ) return SettingInstance( self._version, @@ -185,8 +191,12 @@ async def fetch_async( } ) + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return SettingInstance( @@ -209,6 +219,7 @@ def update( :returns: The updated SettingInstance """ + data = values.of( { "AdvancedFeatures": serialize.boolean_to_string(advanced_features), @@ -216,11 +227,14 @@ def update( "SubaccountSid": subaccount_sid, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SettingInstance(self._version, payload) @@ -240,6 +254,7 @@ async def update_async( :returns: The updated SettingInstance """ + data = values.of( { "AdvancedFeatures": serialize.boolean_to_string(advanced_features), @@ -247,11 +262,14 @@ async def update_async( "SubaccountSid": subaccount_sid, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SettingInstance(self._version, payload) diff --git a/twilio/rest/intelligence/v2/custom_operator.py b/twilio/rest/intelligence/v2/custom_operator.py index af5239b124..3dd73d47bb 100644 --- a/twilio/rest/intelligence/v2/custom_operator.py +++ b/twilio/rest/intelligence/v2/custom_operator.py @@ -201,10 +201,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -213,9 +213,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> CustomOperatorInstance: @@ -226,10 +228,11 @@ def fetch(self) -> CustomOperatorInstance: :returns: The fetched CustomOperatorInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return CustomOperatorInstance( self._version, @@ -245,9 +248,12 @@ async def fetch_async(self) -> CustomOperatorInstance: :returns: The fetched CustomOperatorInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return CustomOperatorInstance( @@ -271,17 +277,23 @@ def update( :returns: The updated CustomOperatorInstance """ + data = values.of( { "FriendlyName": friendly_name, "Config": serialize.object(config), } ) - headers = values.of( - { - "If-Match": if_match, - } - ) + headers = values.of({}) + + if not ( + if_match is values.unset or (isinstance(if_match, str) and not if_match) + ): + headers["If-Match"] = if_match + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( method="POST", uri=self._uri, data=data, headers=headers @@ -304,17 +316,23 @@ async def update_async( :returns: The updated CustomOperatorInstance """ + data = values.of( { "FriendlyName": friendly_name, "Config": serialize.object(config), } ) - headers = values.of( - { - "If-Match": if_match, - } - ) + headers = values.of({}) + + if not ( + if_match is values.unset or (isinstance(if_match, str) and not if_match) + ): + headers["If-Match"] = if_match + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( method="POST", uri=self._uri, data=data, headers=headers @@ -386,6 +404,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -414,6 +436,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -591,7 +617,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return CustomOperatorPage(self._version, response) async def page_async( @@ -626,8 +658,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return CustomOperatorPage(self._version, response) diff --git a/twilio/rest/intelligence/v2/operator.py b/twilio/rest/intelligence/v2/operator.py index 6618c4a6c0..984c46d724 100644 --- a/twilio/rest/intelligence/v2/operator.py +++ b/twilio/rest/intelligence/v2/operator.py @@ -142,10 +142,11 @@ def fetch(self) -> OperatorInstance: :returns: The fetched OperatorInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return OperatorInstance( self._version, @@ -161,9 +162,12 @@ async def fetch_async(self) -> OperatorInstance: :returns: The fetched OperatorInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return OperatorInstance( @@ -375,7 +379,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return OperatorPage(self._version, response) async def page_async( @@ -408,8 +418,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return OperatorPage(self._version, response) diff --git a/twilio/rest/intelligence/v2/operator_attachment.py b/twilio/rest/intelligence/v2/operator_attachment.py index 4ab8b48c10..6080bc5ebf 100644 --- a/twilio/rest/intelligence/v2/operator_attachment.py +++ b/twilio/rest/intelligence/v2/operator_attachment.py @@ -174,10 +174,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -186,9 +186,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def __repr__(self) -> str: diff --git a/twilio/rest/intelligence/v2/operator_attachments.py b/twilio/rest/intelligence/v2/operator_attachments.py index 2500ef7224..19a875f76b 100644 --- a/twilio/rest/intelligence/v2/operator_attachments.py +++ b/twilio/rest/intelligence/v2/operator_attachments.py @@ -13,6 +13,7 @@ """ from typing import Any, Dict, List, Optional +from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -111,10 +112,11 @@ def fetch(self) -> OperatorAttachmentsInstance: :returns: The fetched OperatorAttachmentsInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return OperatorAttachmentsInstance( self._version, @@ -130,9 +132,12 @@ async def fetch_async(self) -> OperatorAttachmentsInstance: :returns: The fetched OperatorAttachmentsInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return OperatorAttachmentsInstance( diff --git a/twilio/rest/intelligence/v2/operator_type.py b/twilio/rest/intelligence/v2/operator_type.py index f1f839fe79..b14e677ad2 100644 --- a/twilio/rest/intelligence/v2/operator_type.py +++ b/twilio/rest/intelligence/v2/operator_type.py @@ -164,10 +164,11 @@ def fetch(self) -> OperatorTypeInstance: :returns: The fetched OperatorTypeInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return OperatorTypeInstance( self._version, @@ -183,9 +184,12 @@ async def fetch_async(self) -> OperatorTypeInstance: :returns: The fetched OperatorTypeInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return OperatorTypeInstance( @@ -363,7 +367,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return OperatorTypePage(self._version, response) async def page_async( @@ -390,8 +400,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return OperatorTypePage(self._version, response) diff --git a/twilio/rest/intelligence/v2/prebuilt_operator.py b/twilio/rest/intelligence/v2/prebuilt_operator.py index e00ceecac5..50693f29c2 100644 --- a/twilio/rest/intelligence/v2/prebuilt_operator.py +++ b/twilio/rest/intelligence/v2/prebuilt_operator.py @@ -142,10 +142,11 @@ def fetch(self) -> PrebuiltOperatorInstance: :returns: The fetched PrebuiltOperatorInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return PrebuiltOperatorInstance( self._version, @@ -161,9 +162,12 @@ async def fetch_async(self) -> PrebuiltOperatorInstance: :returns: The fetched PrebuiltOperatorInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return PrebuiltOperatorInstance( @@ -385,7 +389,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return PrebuiltOperatorPage(self._version, response) async def page_async( @@ -420,8 +430,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return PrebuiltOperatorPage(self._version, response) diff --git a/twilio/rest/intelligence/v2/service.py b/twilio/rest/intelligence/v2/service.py index 8f5633d0fe..fac3eb8473 100644 --- a/twilio/rest/intelligence/v2/service.py +++ b/twilio/rest/intelligence/v2/service.py @@ -246,10 +246,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -258,9 +258,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> ServiceInstance: @@ -271,10 +273,11 @@ def fetch(self) -> ServiceInstance: :returns: The fetched ServiceInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ServiceInstance( self._version, @@ -290,9 +293,12 @@ async def fetch_async(self) -> ServiceInstance: :returns: The fetched ServiceInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ServiceInstance( @@ -328,6 +334,7 @@ def update( :returns: The updated ServiceInstance """ + data = values.of( { "AutoTranscribe": serialize.boolean_to_string(auto_transcribe), @@ -340,11 +347,16 @@ def update( "WebhookHttpMethod": webhook_http_method, } ) - headers = values.of( - { - "If-Match": if_match, - } - ) + headers = values.of({}) + + if not ( + if_match is values.unset or (isinstance(if_match, str) and not if_match) + ): + headers["If-Match"] = if_match + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( method="POST", uri=self._uri, data=data, headers=headers @@ -379,6 +391,7 @@ async def update_async( :returns: The updated ServiceInstance """ + data = values.of( { "AutoTranscribe": serialize.boolean_to_string(auto_transcribe), @@ -391,11 +404,16 @@ async def update_async( "WebhookHttpMethod": webhook_http_method, } ) - headers = values.of( - { - "If-Match": if_match, - } - ) + headers = values.of({}) + + if not ( + if_match is values.unset or (isinstance(if_match, str) and not if_match) + ): + headers["If-Match"] = if_match + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( method="POST", uri=self._uri, data=data, headers=headers @@ -488,6 +506,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -537,6 +559,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -670,7 +696,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ServicePage(self._version, response) async def page_async( @@ -697,8 +729,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ServicePage(self._version, response) diff --git a/twilio/rest/intelligence/v2/transcript/__init__.py b/twilio/rest/intelligence/v2/transcript/__init__.py index bc71542bc0..c2141bb5da 100644 --- a/twilio/rest/intelligence/v2/transcript/__init__.py +++ b/twilio/rest/intelligence/v2/transcript/__init__.py @@ -194,10 +194,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -206,9 +206,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> TranscriptInstance: @@ -219,10 +221,11 @@ def fetch(self) -> TranscriptInstance: :returns: The fetched TranscriptInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return TranscriptInstance( self._version, @@ -238,9 +241,12 @@ async def fetch_async(self) -> TranscriptInstance: :returns: The fetched TranscriptInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return TranscriptInstance( @@ -355,6 +361,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -389,6 +399,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -646,7 +660,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return TranscriptPage(self._version, response) async def page_async( @@ -697,8 +717,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return TranscriptPage(self._version, response) diff --git a/twilio/rest/intelligence/v2/transcript/media.py b/twilio/rest/intelligence/v2/transcript/media.py index 74d3ab9959..76bc448e9b 100644 --- a/twilio/rest/intelligence/v2/transcript/media.py +++ b/twilio/rest/intelligence/v2/transcript/media.py @@ -126,7 +126,13 @@ def fetch(self, redacted: Union[bool, object] = values.unset) -> MediaInstance: } ) - payload = self._version.fetch(method="GET", uri=self._uri, params=data) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch( + method="GET", uri=self._uri, params=data, headers=headers + ) return MediaInstance( self._version, @@ -151,8 +157,12 @@ async def fetch_async( } ) + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return MediaInstance( diff --git a/twilio/rest/intelligence/v2/transcript/operator_result.py b/twilio/rest/intelligence/v2/transcript/operator_result.py index 9d1d614f4d..4b607b39e8 100644 --- a/twilio/rest/intelligence/v2/transcript/operator_result.py +++ b/twilio/rest/intelligence/v2/transcript/operator_result.py @@ -187,7 +187,13 @@ def fetch( } ) - payload = self._version.fetch(method="GET", uri=self._uri, params=data) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch( + method="GET", uri=self._uri, params=data, headers=headers + ) return OperatorResultInstance( self._version, @@ -213,8 +219,12 @@ async def fetch_async( } ) + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return OperatorResultInstance( @@ -415,7 +425,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return OperatorResultPage(self._version, response, self._solution) async def page_async( @@ -445,8 +461,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return OperatorResultPage(self._version, response, self._solution) diff --git a/twilio/rest/intelligence/v2/transcript/sentence.py b/twilio/rest/intelligence/v2/transcript/sentence.py index 4a2229b8a4..f4fb0b3b92 100644 --- a/twilio/rest/intelligence/v2/transcript/sentence.py +++ b/twilio/rest/intelligence/v2/transcript/sentence.py @@ -267,7 +267,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return SentencePage(self._version, response, self._solution) async def page_async( @@ -300,8 +306,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return SentencePage(self._version, response, self._solution) diff --git a/twilio/rest/ip_messaging/v1/credential.py b/twilio/rest/ip_messaging/v1/credential.py index 279aef7860..4aa6d3fc63 100644 --- a/twilio/rest/ip_messaging/v1/credential.py +++ b/twilio/rest/ip_messaging/v1/credential.py @@ -208,10 +208,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -220,9 +220,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> CredentialInstance: @@ -233,10 +235,11 @@ def fetch(self) -> CredentialInstance: :returns: The fetched CredentialInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return CredentialInstance( self._version, @@ -252,9 +255,12 @@ async def fetch_async(self) -> CredentialInstance: :returns: The fetched CredentialInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return CredentialInstance( @@ -284,6 +290,7 @@ def update( :returns: The updated CredentialInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -294,11 +301,14 @@ def update( "Secret": secret, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CredentialInstance(self._version, payload, sid=self._solution["sid"]) @@ -324,6 +334,7 @@ async def update_async( :returns: The updated CredentialInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -334,11 +345,14 @@ async def update_async( "Secret": secret, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CredentialInstance(self._version, payload, sid=self._solution["sid"]) @@ -422,6 +436,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -465,6 +483,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -598,7 +620,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return CredentialPage(self._version, response) async def page_async( @@ -625,8 +653,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return CredentialPage(self._version, response) diff --git a/twilio/rest/ip_messaging/v1/service/__init__.py b/twilio/rest/ip_messaging/v1/service/__init__.py index e0b52e2738..3a77cf765e 100644 --- a/twilio/rest/ip_messaging/v1/service/__init__.py +++ b/twilio/rest/ip_messaging/v1/service/__init__.py @@ -554,10 +554,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -566,9 +566,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> ServiceInstance: @@ -579,10 +581,11 @@ def fetch(self) -> ServiceInstance: :returns: The fetched ServiceInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ServiceInstance( self._version, @@ -598,9 +601,12 @@ async def fetch_async(self) -> ServiceInstance: :returns: The fetched ServiceInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ServiceInstance( @@ -726,6 +732,7 @@ def update( :returns: The updated ServiceInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -794,11 +801,14 @@ def update( "Limits.UserChannels": limits_user_channels, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload, sid=self._solution["sid"]) @@ -920,6 +930,7 @@ async def update_async( :returns: The updated ServiceInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -988,11 +999,14 @@ async def update_async( "Limits.UserChannels": limits_user_channels, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload, sid=self._solution["sid"]) @@ -1091,6 +1105,10 @@ def create(self, friendly_name: str) -> ServiceInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -1113,6 +1131,10 @@ async def create_async(self, friendly_name: str) -> ServiceInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -1246,7 +1268,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ServicePage(self._version, response) async def page_async( @@ -1273,8 +1301,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ServicePage(self._version, response) diff --git a/twilio/rest/ip_messaging/v1/service/channel/__init__.py b/twilio/rest/ip_messaging/v1/service/channel/__init__.py index 57d2d245ec..14423c9e38 100644 --- a/twilio/rest/ip_messaging/v1/service/channel/__init__.py +++ b/twilio/rest/ip_messaging/v1/service/channel/__init__.py @@ -241,10 +241,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -253,9 +253,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> ChannelInstance: @@ -266,10 +268,11 @@ def fetch(self) -> ChannelInstance: :returns: The fetched ChannelInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ChannelInstance( self._version, @@ -286,9 +289,12 @@ async def fetch_async(self) -> ChannelInstance: :returns: The fetched ChannelInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ChannelInstance( @@ -313,6 +319,7 @@ def update( :returns: The updated ChannelInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -320,11 +327,14 @@ def update( "Attributes": attributes, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ChannelInstance( @@ -349,6 +359,7 @@ async def update_async( :returns: The updated ChannelInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -356,11 +367,14 @@ async def update_async( "Attributes": attributes, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ChannelInstance( @@ -486,6 +500,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -522,6 +540,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -670,7 +692,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ChannelPage(self._version, response, self._solution) async def page_async( @@ -700,8 +728,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ChannelPage(self._version, response, self._solution) diff --git a/twilio/rest/ip_messaging/v1/service/channel/invite.py b/twilio/rest/ip_messaging/v1/service/channel/invite.py index f4c3476edb..d348540346 100644 --- a/twilio/rest/ip_messaging/v1/service/channel/invite.py +++ b/twilio/rest/ip_messaging/v1/service/channel/invite.py @@ -163,10 +163,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -175,9 +175,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> InviteInstance: @@ -188,10 +190,11 @@ def fetch(self) -> InviteInstance: :returns: The fetched InviteInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return InviteInstance( self._version, @@ -209,9 +212,12 @@ async def fetch_async(self) -> InviteInstance: :returns: The fetched InviteInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return InviteInstance( @@ -298,6 +304,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -329,6 +339,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -480,7 +494,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return InvitePage(self._version, response, self._solution) async def page_async( @@ -510,8 +530,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return InvitePage(self._version, response, self._solution) diff --git a/twilio/rest/ip_messaging/v1/service/channel/member.py b/twilio/rest/ip_messaging/v1/service/channel/member.py index 4452699ceb..26a68650ef 100644 --- a/twilio/rest/ip_messaging/v1/service/channel/member.py +++ b/twilio/rest/ip_messaging/v1/service/channel/member.py @@ -205,10 +205,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -217,9 +217,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> MemberInstance: @@ -230,10 +232,11 @@ def fetch(self) -> MemberInstance: :returns: The fetched MemberInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return MemberInstance( self._version, @@ -251,9 +254,12 @@ async def fetch_async(self) -> MemberInstance: :returns: The fetched MemberInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return MemberInstance( @@ -277,17 +283,21 @@ def update( :returns: The updated MemberInstance """ + data = values.of( { "RoleSid": role_sid, "LastConsumedMessageIndex": last_consumed_message_index, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return MemberInstance( @@ -311,17 +321,21 @@ async def update_async( :returns: The updated MemberInstance """ + data = values.of( { "RoleSid": role_sid, "LastConsumedMessageIndex": last_consumed_message_index, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return MemberInstance( @@ -408,6 +422,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -439,6 +457,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -590,7 +612,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return MemberPage(self._version, response, self._solution) async def page_async( @@ -620,8 +648,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return MemberPage(self._version, response, self._solution) diff --git a/twilio/rest/ip_messaging/v1/service/channel/message.py b/twilio/rest/ip_messaging/v1/service/channel/message.py index 5d3f2eb577..ad7c05d8a1 100644 --- a/twilio/rest/ip_messaging/v1/service/channel/message.py +++ b/twilio/rest/ip_messaging/v1/service/channel/message.py @@ -210,10 +210,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -222,9 +222,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> MessageInstance: @@ -235,10 +237,11 @@ def fetch(self) -> MessageInstance: :returns: The fetched MessageInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return MessageInstance( self._version, @@ -256,9 +259,12 @@ async def fetch_async(self) -> MessageInstance: :returns: The fetched MessageInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return MessageInstance( @@ -282,17 +288,21 @@ def update( :returns: The updated MessageInstance """ + data = values.of( { "Body": body, "Attributes": attributes, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return MessageInstance( @@ -316,17 +326,21 @@ async def update_async( :returns: The updated MessageInstance """ + data = values.of( { "Body": body, "Attributes": attributes, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return MessageInstance( @@ -418,6 +432,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -454,6 +472,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -605,7 +627,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return MessagePage(self._version, response, self._solution) async def page_async( @@ -635,8 +663,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return MessagePage(self._version, response, self._solution) diff --git a/twilio/rest/ip_messaging/v1/service/role.py b/twilio/rest/ip_messaging/v1/service/role.py index 5f5b19cfe9..d5d0628032 100644 --- a/twilio/rest/ip_messaging/v1/service/role.py +++ b/twilio/rest/ip_messaging/v1/service/role.py @@ -181,10 +181,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -193,9 +193,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> RoleInstance: @@ -206,10 +208,11 @@ def fetch(self) -> RoleInstance: :returns: The fetched RoleInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return RoleInstance( self._version, @@ -226,9 +229,12 @@ async def fetch_async(self) -> RoleInstance: :returns: The fetched RoleInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return RoleInstance( @@ -246,16 +252,20 @@ def update(self, permission: List[str]) -> RoleInstance: :returns: The updated RoleInstance """ + data = values.of( { "Permission": serialize.map(permission, lambda e: e), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RoleInstance( @@ -273,16 +283,20 @@ async def update_async(self, permission: List[str]) -> RoleInstance: :returns: The updated RoleInstance """ + data = values.of( { "Permission": serialize.map(permission, lambda e: e), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RoleInstance( @@ -363,6 +377,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -393,6 +411,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -528,7 +550,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return RolePage(self._version, response, self._solution) async def page_async( @@ -555,8 +583,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return RolePage(self._version, response, self._solution) diff --git a/twilio/rest/ip_messaging/v1/service/user/__init__.py b/twilio/rest/ip_messaging/v1/service/user/__init__.py index 91364d8f96..5f37f2d3aa 100644 --- a/twilio/rest/ip_messaging/v1/service/user/__init__.py +++ b/twilio/rest/ip_messaging/v1/service/user/__init__.py @@ -216,10 +216,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -228,9 +228,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> UserInstance: @@ -241,10 +243,11 @@ def fetch(self) -> UserInstance: :returns: The fetched UserInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return UserInstance( self._version, @@ -261,9 +264,12 @@ async def fetch_async(self) -> UserInstance: :returns: The fetched UserInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return UserInstance( @@ -288,6 +294,7 @@ def update( :returns: The updated UserInstance """ + data = values.of( { "RoleSid": role_sid, @@ -295,11 +302,14 @@ def update( "FriendlyName": friendly_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return UserInstance( @@ -324,6 +334,7 @@ async def update_async( :returns: The updated UserInstance """ + data = values.of( { "RoleSid": role_sid, @@ -331,11 +342,14 @@ async def update_async( "FriendlyName": friendly_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return UserInstance( @@ -435,6 +449,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -471,6 +489,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -606,7 +628,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return UserPage(self._version, response, self._solution) async def page_async( @@ -633,8 +661,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return UserPage(self._version, response, self._solution) diff --git a/twilio/rest/ip_messaging/v1/service/user/user_channel.py b/twilio/rest/ip_messaging/v1/service/user/user_channel.py index 192aafb380..4245449869 100644 --- a/twilio/rest/ip_messaging/v1/service/user/user_channel.py +++ b/twilio/rest/ip_messaging/v1/service/user/user_channel.py @@ -247,7 +247,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return UserChannelPage(self._version, response, self._solution) async def page_async( @@ -274,8 +280,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return UserChannelPage(self._version, response, self._solution) diff --git a/twilio/rest/ip_messaging/v2/credential.py b/twilio/rest/ip_messaging/v2/credential.py index 5d4e14f983..065c5048e9 100644 --- a/twilio/rest/ip_messaging/v2/credential.py +++ b/twilio/rest/ip_messaging/v2/credential.py @@ -208,10 +208,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -220,9 +220,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> CredentialInstance: @@ -233,10 +235,11 @@ def fetch(self) -> CredentialInstance: :returns: The fetched CredentialInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return CredentialInstance( self._version, @@ -252,9 +255,12 @@ async def fetch_async(self) -> CredentialInstance: :returns: The fetched CredentialInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return CredentialInstance( @@ -284,6 +290,7 @@ def update( :returns: The updated CredentialInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -294,11 +301,14 @@ def update( "Secret": secret, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CredentialInstance(self._version, payload, sid=self._solution["sid"]) @@ -324,6 +334,7 @@ async def update_async( :returns: The updated CredentialInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -334,11 +345,14 @@ async def update_async( "Secret": secret, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CredentialInstance(self._version, payload, sid=self._solution["sid"]) @@ -422,6 +436,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -465,6 +483,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -598,7 +620,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return CredentialPage(self._version, response) async def page_async( @@ -625,8 +653,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return CredentialPage(self._version, response) diff --git a/twilio/rest/ip_messaging/v2/service/__init__.py b/twilio/rest/ip_messaging/v2/service/__init__.py index 3475811625..a303f10f33 100644 --- a/twilio/rest/ip_messaging/v2/service/__init__.py +++ b/twilio/rest/ip_messaging/v2/service/__init__.py @@ -437,10 +437,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -449,9 +449,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> ServiceInstance: @@ -462,10 +464,11 @@ def fetch(self) -> ServiceInstance: :returns: The fetched ServiceInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ServiceInstance( self._version, @@ -481,9 +484,12 @@ async def fetch_async(self) -> ServiceInstance: :returns: The fetched ServiceInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ServiceInstance( @@ -565,6 +571,7 @@ def update( :returns: The updated ServiceInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -614,11 +621,14 @@ def update( ), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload, sid=self._solution["sid"]) @@ -696,6 +706,7 @@ async def update_async( :returns: The updated ServiceInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -745,11 +756,14 @@ async def update_async( ), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload, sid=self._solution["sid"]) @@ -860,6 +874,10 @@ def create(self, friendly_name: str) -> ServiceInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -882,6 +900,10 @@ async def create_async(self, friendly_name: str) -> ServiceInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -1015,7 +1037,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ServicePage(self._version, response) async def page_async( @@ -1042,8 +1070,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ServicePage(self._version, response) diff --git a/twilio/rest/ip_messaging/v2/service/binding.py b/twilio/rest/ip_messaging/v2/service/binding.py index 24c4f65a4b..af9018af9f 100644 --- a/twilio/rest/ip_messaging/v2/service/binding.py +++ b/twilio/rest/ip_messaging/v2/service/binding.py @@ -166,10 +166,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -178,9 +178,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> BindingInstance: @@ -191,10 +193,11 @@ def fetch(self) -> BindingInstance: :returns: The fetched BindingInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return BindingInstance( self._version, @@ -211,9 +214,12 @@ async def fetch_async(self) -> BindingInstance: :returns: The fetched BindingInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return BindingInstance( @@ -429,7 +435,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return BindingPage(self._version, response, self._solution) async def page_async( @@ -462,8 +474,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return BindingPage(self._version, response, self._solution) diff --git a/twilio/rest/ip_messaging/v2/service/channel/__init__.py b/twilio/rest/ip_messaging/v2/service/channel/__init__.py index 29ee9ddd64..8220a4be9c 100644 --- a/twilio/rest/ip_messaging/v2/service/channel/__init__.py +++ b/twilio/rest/ip_messaging/v2/service/channel/__init__.py @@ -310,6 +310,8 @@ def delete( } ) + headers = values.of({}) + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async( @@ -331,6 +333,8 @@ async def delete_async( } ) + headers = values.of({}) + return await self._version.delete_async( method="DELETE", uri=self._uri, headers=headers ) @@ -343,10 +347,11 @@ def fetch(self) -> ChannelInstance: :returns: The fetched ChannelInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ChannelInstance( self._version, @@ -363,9 +368,12 @@ async def fetch_async(self) -> ChannelInstance: :returns: The fetched ChannelInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ChannelInstance( @@ -400,6 +408,7 @@ def update( :returns: The updated ChannelInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -410,11 +419,20 @@ def update( "CreatedBy": created_by, } ) - headers = values.of( - { - "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, - } - ) + headers = values.of({}) + + if not ( + x_twilio_webhook_enabled is values.unset + or ( + isinstance(x_twilio_webhook_enabled, str) + and not x_twilio_webhook_enabled + ) + ): + headers["X-Twilio-Webhook-Enabled"] = x_twilio_webhook_enabled + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( method="POST", uri=self._uri, data=data, headers=headers @@ -452,6 +470,7 @@ async def update_async( :returns: The updated ChannelInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -462,11 +481,20 @@ async def update_async( "CreatedBy": created_by, } ) - headers = values.of( - { - "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, - } - ) + headers = values.of({}) + + if not ( + x_twilio_webhook_enabled is values.unset + or ( + isinstance(x_twilio_webhook_enabled, str) + and not x_twilio_webhook_enabled + ) + ): + headers["X-Twilio-Webhook-Enabled"] = x_twilio_webhook_enabled + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( method="POST", uri=self._uri, data=data, headers=headers @@ -626,6 +654,10 @@ def create( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -680,6 +712,10 @@ async def create_async( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -828,7 +864,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ChannelPage(self._version, response, self._solution) async def page_async( @@ -858,8 +900,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ChannelPage(self._version, response, self._solution) diff --git a/twilio/rest/ip_messaging/v2/service/channel/invite.py b/twilio/rest/ip_messaging/v2/service/channel/invite.py index a40c47a125..4fa3c187fc 100644 --- a/twilio/rest/ip_messaging/v2/service/channel/invite.py +++ b/twilio/rest/ip_messaging/v2/service/channel/invite.py @@ -163,10 +163,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -175,9 +175,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> InviteInstance: @@ -188,10 +190,11 @@ def fetch(self) -> InviteInstance: :returns: The fetched InviteInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return InviteInstance( self._version, @@ -209,9 +212,12 @@ async def fetch_async(self) -> InviteInstance: :returns: The fetched InviteInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return InviteInstance( @@ -298,6 +304,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -329,6 +339,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -480,7 +494,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return InvitePage(self._version, response, self._solution) async def page_async( @@ -510,8 +530,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return InvitePage(self._version, response, self._solution) diff --git a/twilio/rest/ip_messaging/v2/service/channel/member.py b/twilio/rest/ip_messaging/v2/service/channel/member.py index 9511a2bf6b..6456d3be20 100644 --- a/twilio/rest/ip_messaging/v2/service/channel/member.py +++ b/twilio/rest/ip_messaging/v2/service/channel/member.py @@ -274,6 +274,8 @@ def delete( } ) + headers = values.of({}) + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async( @@ -295,6 +297,8 @@ async def delete_async( } ) + headers = values.of({}) + return await self._version.delete_async( method="DELETE", uri=self._uri, headers=headers ) @@ -307,10 +311,11 @@ def fetch(self) -> MemberInstance: :returns: The fetched MemberInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return MemberInstance( self._version, @@ -328,9 +333,12 @@ async def fetch_async(self) -> MemberInstance: :returns: The fetched MemberInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return MemberInstance( @@ -366,6 +374,7 @@ def update( :returns: The updated MemberInstance """ + data = values.of( { "RoleSid": role_sid, @@ -378,11 +387,20 @@ def update( "Attributes": attributes, } ) - headers = values.of( - { - "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, - } - ) + headers = values.of({}) + + if not ( + x_twilio_webhook_enabled is values.unset + or ( + isinstance(x_twilio_webhook_enabled, str) + and not x_twilio_webhook_enabled + ) + ): + headers["X-Twilio-Webhook-Enabled"] = x_twilio_webhook_enabled + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( method="POST", uri=self._uri, data=data, headers=headers @@ -421,6 +439,7 @@ async def update_async( :returns: The updated MemberInstance """ + data = values.of( { "RoleSid": role_sid, @@ -433,11 +452,20 @@ async def update_async( "Attributes": attributes, } ) - headers = values.of( - { - "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, - } - ) + headers = values.of({}) + + if not ( + x_twilio_webhook_enabled is values.unset + or ( + isinstance(x_twilio_webhook_enabled, str) + and not x_twilio_webhook_enabled + ) + ): + headers["X-Twilio-Webhook-Enabled"] = x_twilio_webhook_enabled + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( method="POST", uri=self._uri, data=data, headers=headers @@ -555,6 +583,10 @@ def create( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -614,6 +646,10 @@ async def create_async( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -765,7 +801,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return MemberPage(self._version, response, self._solution) async def page_async( @@ -795,8 +837,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return MemberPage(self._version, response, self._solution) diff --git a/twilio/rest/ip_messaging/v2/service/channel/message.py b/twilio/rest/ip_messaging/v2/service/channel/message.py index 7420117113..838b3c7271 100644 --- a/twilio/rest/ip_messaging/v2/service/channel/message.py +++ b/twilio/rest/ip_messaging/v2/service/channel/message.py @@ -282,6 +282,8 @@ def delete( } ) + headers = values.of({}) + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async( @@ -303,6 +305,8 @@ async def delete_async( } ) + headers = values.of({}) + return await self._version.delete_async( method="DELETE", uri=self._uri, headers=headers ) @@ -315,10 +319,11 @@ def fetch(self) -> MessageInstance: :returns: The fetched MessageInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return MessageInstance( self._version, @@ -336,9 +341,12 @@ async def fetch_async(self) -> MessageInstance: :returns: The fetched MessageInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return MessageInstance( @@ -374,6 +382,7 @@ def update( :returns: The updated MessageInstance """ + data = values.of( { "Body": body, @@ -384,11 +393,20 @@ def update( "From": from_, } ) - headers = values.of( - { - "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, - } - ) + headers = values.of({}) + + if not ( + x_twilio_webhook_enabled is values.unset + or ( + isinstance(x_twilio_webhook_enabled, str) + and not x_twilio_webhook_enabled + ) + ): + headers["X-Twilio-Webhook-Enabled"] = x_twilio_webhook_enabled + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( method="POST", uri=self._uri, data=data, headers=headers @@ -427,6 +445,7 @@ async def update_async( :returns: The updated MessageInstance """ + data = values.of( { "Body": body, @@ -437,11 +456,20 @@ async def update_async( "From": from_, } ) - headers = values.of( - { - "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, - } - ) + headers = values.of({}) + + if not ( + x_twilio_webhook_enabled is values.unset + or ( + isinstance(x_twilio_webhook_enabled, str) + and not x_twilio_webhook_enabled + ) + ): + headers["X-Twilio-Webhook-Enabled"] = x_twilio_webhook_enabled + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( method="POST", uri=self._uri, data=data, headers=headers @@ -557,6 +585,10 @@ def create( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -614,6 +646,10 @@ async def create_async( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -765,7 +801,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return MessagePage(self._version, response, self._solution) async def page_async( @@ -795,8 +837,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return MessagePage(self._version, response, self._solution) diff --git a/twilio/rest/ip_messaging/v2/service/channel/webhook.py b/twilio/rest/ip_messaging/v2/service/channel/webhook.py index db23dd66af..3c7570fd0e 100644 --- a/twilio/rest/ip_messaging/v2/service/channel/webhook.py +++ b/twilio/rest/ip_messaging/v2/service/channel/webhook.py @@ -231,10 +231,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -243,9 +243,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> WebhookInstance: @@ -256,10 +258,11 @@ def fetch(self) -> WebhookInstance: :returns: The fetched WebhookInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return WebhookInstance( self._version, @@ -277,9 +280,12 @@ async def fetch_async(self) -> WebhookInstance: :returns: The fetched WebhookInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return WebhookInstance( @@ -311,6 +317,7 @@ def update( :returns: The updated WebhookInstance """ + data = values.of( { "Configuration.Url": configuration_url, @@ -325,11 +332,14 @@ def update( "Configuration.RetryCount": configuration_retry_count, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return WebhookInstance( @@ -361,6 +371,7 @@ async def update_async( :returns: The updated WebhookInstance """ + data = values.of( { "Configuration.Url": configuration_url, @@ -375,11 +386,14 @@ async def update_async( "Configuration.RetryCount": configuration_retry_count, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return WebhookInstance( @@ -487,6 +501,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -539,6 +557,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -677,7 +699,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return WebhookPage(self._version, response, self._solution) async def page_async( @@ -704,8 +732,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return WebhookPage(self._version, response, self._solution) diff --git a/twilio/rest/ip_messaging/v2/service/role.py b/twilio/rest/ip_messaging/v2/service/role.py index 0acf77983b..32f70c2272 100644 --- a/twilio/rest/ip_messaging/v2/service/role.py +++ b/twilio/rest/ip_messaging/v2/service/role.py @@ -181,10 +181,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -193,9 +193,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> RoleInstance: @@ -206,10 +208,11 @@ def fetch(self) -> RoleInstance: :returns: The fetched RoleInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return RoleInstance( self._version, @@ -226,9 +229,12 @@ async def fetch_async(self) -> RoleInstance: :returns: The fetched RoleInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return RoleInstance( @@ -246,16 +252,20 @@ def update(self, permission: List[str]) -> RoleInstance: :returns: The updated RoleInstance """ + data = values.of( { "Permission": serialize.map(permission, lambda e: e), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RoleInstance( @@ -273,16 +283,20 @@ async def update_async(self, permission: List[str]) -> RoleInstance: :returns: The updated RoleInstance """ + data = values.of( { "Permission": serialize.map(permission, lambda e: e), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RoleInstance( @@ -363,6 +377,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -393,6 +411,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -528,7 +550,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return RolePage(self._version, response, self._solution) async def page_async( @@ -555,8 +583,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return RolePage(self._version, response, self._solution) diff --git a/twilio/rest/ip_messaging/v2/service/user/__init__.py b/twilio/rest/ip_messaging/v2/service/user/__init__.py index 3af3121fab..f5f1454c72 100644 --- a/twilio/rest/ip_messaging/v2/service/user/__init__.py +++ b/twilio/rest/ip_messaging/v2/service/user/__init__.py @@ -240,10 +240,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -252,9 +252,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> UserInstance: @@ -265,10 +267,11 @@ def fetch(self) -> UserInstance: :returns: The fetched UserInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return UserInstance( self._version, @@ -285,9 +288,12 @@ async def fetch_async(self) -> UserInstance: :returns: The fetched UserInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return UserInstance( @@ -316,6 +322,7 @@ def update( :returns: The updated UserInstance """ + data = values.of( { "RoleSid": role_sid, @@ -323,11 +330,20 @@ def update( "FriendlyName": friendly_name, } ) - headers = values.of( - { - "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, - } - ) + headers = values.of({}) + + if not ( + x_twilio_webhook_enabled is values.unset + or ( + isinstance(x_twilio_webhook_enabled, str) + and not x_twilio_webhook_enabled + ) + ): + headers["X-Twilio-Webhook-Enabled"] = x_twilio_webhook_enabled + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( method="POST", uri=self._uri, data=data, headers=headers @@ -359,6 +375,7 @@ async def update_async( :returns: The updated UserInstance """ + data = values.of( { "RoleSid": role_sid, @@ -366,11 +383,20 @@ async def update_async( "FriendlyName": friendly_name, } ) - headers = values.of( - { - "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, - } - ) + headers = values.of({}) + + if not ( + x_twilio_webhook_enabled is values.unset + or ( + isinstance(x_twilio_webhook_enabled, str) + and not x_twilio_webhook_enabled + ) + ): + headers["X-Twilio-Webhook-Enabled"] = x_twilio_webhook_enabled + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( method="POST", uri=self._uri, data=data, headers=headers @@ -495,6 +521,10 @@ def create( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -540,6 +570,10 @@ async def create_async( } ) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -675,7 +709,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return UserPage(self._version, response, self._solution) async def page_async( @@ -702,8 +742,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return UserPage(self._version, response, self._solution) diff --git a/twilio/rest/ip_messaging/v2/service/user/user_binding.py b/twilio/rest/ip_messaging/v2/service/user/user_binding.py index 575a295cbb..4f1d9f10a7 100644 --- a/twilio/rest/ip_messaging/v2/service/user/user_binding.py +++ b/twilio/rest/ip_messaging/v2/service/user/user_binding.py @@ -173,10 +173,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -185,9 +185,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> UserBindingInstance: @@ -198,10 +200,11 @@ def fetch(self) -> UserBindingInstance: :returns: The fetched UserBindingInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return UserBindingInstance( self._version, @@ -219,9 +222,12 @@ async def fetch_async(self) -> UserBindingInstance: :returns: The fetched UserBindingInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return UserBindingInstance( @@ -440,7 +446,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return UserBindingPage(self._version, response, self._solution) async def page_async( @@ -472,8 +484,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return UserBindingPage(self._version, response, self._solution) diff --git a/twilio/rest/ip_messaging/v2/service/user/user_channel.py b/twilio/rest/ip_messaging/v2/service/user/user_channel.py index d89e6cb80d..5cb544fc3f 100644 --- a/twilio/rest/ip_messaging/v2/service/user/user_channel.py +++ b/twilio/rest/ip_messaging/v2/service/user/user_channel.py @@ -227,10 +227,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -239,9 +239,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> UserChannelInstance: @@ -252,10 +254,11 @@ def fetch(self) -> UserChannelInstance: :returns: The fetched UserChannelInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return UserChannelInstance( self._version, @@ -273,9 +276,12 @@ async def fetch_async(self) -> UserChannelInstance: :returns: The fetched UserChannelInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return UserChannelInstance( @@ -303,6 +309,7 @@ def update( :returns: The updated UserChannelInstance """ + data = values.of( { "NotificationLevel": notification_level, @@ -312,11 +319,14 @@ def update( ), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return UserChannelInstance( @@ -344,6 +354,7 @@ async def update_async( :returns: The updated UserChannelInstance """ + data = values.of( { "NotificationLevel": notification_level, @@ -353,11 +364,14 @@ async def update_async( ), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return UserChannelInstance( @@ -551,7 +565,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return UserChannelPage(self._version, response, self._solution) async def page_async( @@ -578,8 +598,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return UserChannelPage(self._version, response, self._solution) diff --git a/twilio/rest/lookups/v1/phone_number.py b/twilio/rest/lookups/v1/phone_number.py index fe521c73e9..ace46b67bd 100644 --- a/twilio/rest/lookups/v1/phone_number.py +++ b/twilio/rest/lookups/v1/phone_number.py @@ -167,9 +167,16 @@ def fetch( "AddOns": serialize.map(add_ons, lambda e: e), } ) + data.update(serialize.prefixed_collapsible_map(add_ons_data, "AddOns")) - payload = self._version.fetch(method="GET", uri=self._uri, params=data) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch( + method="GET", uri=self._uri, params=data, headers=headers + ) return PhoneNumberInstance( self._version, @@ -202,10 +209,15 @@ async def fetch_async( "AddOns": serialize.map(add_ons, lambda e: e), } ) + data.update(serialize.prefixed_collapsible_map(add_ons_data, "AddOns")) + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return PhoneNumberInstance( diff --git a/twilio/rest/lookups/v2/phone_number.py b/twilio/rest/lookups/v2/phone_number.py index d9c73c22d8..ac1b3257ef 100644 --- a/twilio/rest/lookups/v2/phone_number.py +++ b/twilio/rest/lookups/v2/phone_number.py @@ -300,7 +300,13 @@ def fetch( } ) - payload = self._version.fetch(method="GET", uri=self._uri, params=data) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch( + method="GET", uri=self._uri, params=data, headers=headers + ) return PhoneNumberInstance( self._version, @@ -365,8 +371,12 @@ async def fetch_async( } ) + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return PhoneNumberInstance( diff --git a/twilio/rest/marketplace/v1/available_add_on/__init__.py b/twilio/rest/marketplace/v1/available_add_on/__init__.py index 6f6713ee17..297d5dd6f3 100644 --- a/twilio/rest/marketplace/v1/available_add_on/__init__.py +++ b/twilio/rest/marketplace/v1/available_add_on/__init__.py @@ -132,10 +132,11 @@ def fetch(self) -> AvailableAddOnInstance: :returns: The fetched AvailableAddOnInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return AvailableAddOnInstance( self._version, @@ -151,9 +152,12 @@ async def fetch_async(self) -> AvailableAddOnInstance: :returns: The fetched AvailableAddOnInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return AvailableAddOnInstance( @@ -343,7 +347,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return AvailableAddOnPage(self._version, response) async def page_async( @@ -370,8 +380,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return AvailableAddOnPage(self._version, response) diff --git a/twilio/rest/marketplace/v1/available_add_on/available_add_on_extension.py b/twilio/rest/marketplace/v1/available_add_on/available_add_on_extension.py index 1113d9313c..a8973a08b0 100644 --- a/twilio/rest/marketplace/v1/available_add_on/available_add_on_extension.py +++ b/twilio/rest/marketplace/v1/available_add_on/available_add_on_extension.py @@ -128,10 +128,11 @@ def fetch(self) -> AvailableAddOnExtensionInstance: :returns: The fetched AvailableAddOnExtensionInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return AvailableAddOnExtensionInstance( self._version, @@ -148,9 +149,12 @@ async def fetch_async(self) -> AvailableAddOnExtensionInstance: :returns: The fetched AvailableAddOnExtensionInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return AvailableAddOnExtensionInstance( @@ -342,7 +346,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return AvailableAddOnExtensionPage(self._version, response, self._solution) async def page_async( @@ -369,8 +379,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return AvailableAddOnExtensionPage(self._version, response, self._solution) diff --git a/twilio/rest/marketplace/v1/installed_add_on/__init__.py b/twilio/rest/marketplace/v1/installed_add_on/__init__.py index df67c01d8c..8fedfb9b41 100644 --- a/twilio/rest/marketplace/v1/installed_add_on/__init__.py +++ b/twilio/rest/marketplace/v1/installed_add_on/__init__.py @@ -205,10 +205,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -217,9 +217,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> InstalledAddOnInstance: @@ -230,10 +232,11 @@ def fetch(self) -> InstalledAddOnInstance: :returns: The fetched InstalledAddOnInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return InstalledAddOnInstance( self._version, @@ -249,9 +252,12 @@ async def fetch_async(self) -> InstalledAddOnInstance: :returns: The fetched InstalledAddOnInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return InstalledAddOnInstance( @@ -273,17 +279,21 @@ def update( :returns: The updated InstalledAddOnInstance """ + data = values.of( { "Configuration": serialize.object(configuration), "UniqueName": unique_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return InstalledAddOnInstance(self._version, payload, sid=self._solution["sid"]) @@ -301,17 +311,21 @@ async def update_async( :returns: The updated InstalledAddOnInstance """ + data = values.of( { "Configuration": serialize.object(configuration), "UniqueName": unique_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return InstalledAddOnInstance(self._version, payload, sid=self._solution["sid"]) @@ -412,6 +426,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -448,6 +466,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -581,7 +603,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return InstalledAddOnPage(self._version, response) async def page_async( @@ -608,8 +636,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return InstalledAddOnPage(self._version, response) diff --git a/twilio/rest/marketplace/v1/installed_add_on/installed_add_on_extension.py b/twilio/rest/marketplace/v1/installed_add_on/installed_add_on_extension.py index c53a6ca510..88f160ed29 100644 --- a/twilio/rest/marketplace/v1/installed_add_on/installed_add_on_extension.py +++ b/twilio/rest/marketplace/v1/installed_add_on/installed_add_on_extension.py @@ -154,10 +154,11 @@ def fetch(self) -> InstalledAddOnExtensionInstance: :returns: The fetched InstalledAddOnExtensionInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return InstalledAddOnExtensionInstance( self._version, @@ -174,9 +175,12 @@ async def fetch_async(self) -> InstalledAddOnExtensionInstance: :returns: The fetched InstalledAddOnExtensionInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return InstalledAddOnExtensionInstance( @@ -194,16 +198,20 @@ def update(self, enabled: bool) -> InstalledAddOnExtensionInstance: :returns: The updated InstalledAddOnExtensionInstance """ + data = values.of( { "Enabled": serialize.boolean_to_string(enabled), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return InstalledAddOnExtensionInstance( @@ -221,16 +229,20 @@ async def update_async(self, enabled: bool) -> InstalledAddOnExtensionInstance: :returns: The updated InstalledAddOnExtensionInstance """ + data = values.of( { "Enabled": serialize.boolean_to_string(enabled), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return InstalledAddOnExtensionInstance( @@ -422,7 +434,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return InstalledAddOnExtensionPage(self._version, response, self._solution) async def page_async( @@ -449,8 +467,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return InstalledAddOnExtensionPage(self._version, response, self._solution) diff --git a/twilio/rest/marketplace/v1/installed_add_on/installed_add_on_usage.py b/twilio/rest/marketplace/v1/installed_add_on/installed_add_on_usage.py index 47a9a7c13b..1a54756496 100644 --- a/twilio/rest/marketplace/v1/installed_add_on/installed_add_on_usage.py +++ b/twilio/rest/marketplace/v1/installed_add_on/installed_add_on_usage.py @@ -21,9 +21,57 @@ class InstalledAddOnUsageInstance(InstanceResource): + + class MarketplaceV1InstalledAddOnInstalledAddOnUsage(object): + """ + :ivar total_submitted: Total amount in local currency that was billed in this request. Aggregates all billable_items that were successfully submitted. + :ivar billable_items: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.total_submitted: Optional[float] = deserialize.decimal( + payload.get("total_submitted") + ) + self.billable_items: Optional[ + List[ + InstalledAddOnUsageList.MarketplaceV1InstalledAddOnInstalledAddOnUsageBillableItems + ] + ] = payload.get("billable_items") + + def to_dict(self): + return { + "total_submitted": self.total_submitted, + "billable_items": ( + [billable_items.to_dict() for billable_items in self.billable_items] + if self.billable_items is not None + else None + ), + } + + class MarketplaceV1InstalledAddOnInstalledAddOnUsageBillableItems(object): + """ + :ivar quantity: Total amount in local currency that was billed for this Billing Item. Can be any floating number greater than 0. + :ivar sid: BillingSid to use for billing. + :ivar submitted: Whether the billing event was successfully generated for this Billable Item. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.quantity: Optional[float] = payload.get("quantity") + self.sid: Optional[str] = payload.get("sid") + self.submitted: Optional[bool] = payload.get("submitted") + + def to_dict(self): + return { + "quantity": self.quantity, + "sid": self.sid, + "submitted": self.submitted, + } + """ :ivar total_submitted: Total amount in local currency that was billed in this request. Aggregates all billable_items that were successfully submitted. - :ivar billable_items: + :ivar billable_items: """ def __init__( @@ -74,9 +122,31 @@ def __init__(self, payload: Dict[str, Any]): def to_dict(self): return { "total_submitted": self.total_submitted, - "billable_items": [ - billable_items.to_dict() for billable_items in self.billable_items - ], + "billable_items": ( + [billable_items.to_dict() for billable_items in self.billable_items] + if self.billable_items is not None + else None + ), + } + + class MarketplaceV1InstalledAddOnInstalledAddOnUsageBillableItems(object): + """ + :ivar quantity: Total amount in local currency that was billed for this Billing Item. Can be any floating number greater than 0. + :ivar sid: BillingSid to use for billing. + :ivar submitted: Whether the billing event was successfully generated for this Billable Item. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.quantity: Optional[float] = payload.get("quantity") + self.sid: Optional[str] = payload.get("sid") + self.submitted: Optional[bool] = payload.get("submitted") + + def to_dict(self): + return { + "quantity": self.quantity, + "sid": self.sid, + "submitted": self.submitted, } def __init__(self, version: Version, installed_add_on_sid: str): @@ -111,8 +181,11 @@ def create( data = marketplace_v1_installed_add_on_installed_add_on_usage.to_dict() headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -137,8 +210,11 @@ async def create_async( data = marketplace_v1_installed_add_on_installed_add_on_usage.to_dict() headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/marketplace/v1/module_data_management.py b/twilio/rest/marketplace/v1/module_data_management.py index 8ef224cec1..2dbdfe055f 100644 --- a/twilio/rest/marketplace/v1/module_data_management.py +++ b/twilio/rest/marketplace/v1/module_data_management.py @@ -187,10 +187,11 @@ def fetch(self) -> ModuleDataManagementInstance: :returns: The fetched ModuleDataManagementInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ModuleDataManagementInstance( self._version, @@ -206,9 +207,12 @@ async def fetch_async(self) -> ModuleDataManagementInstance: :returns: The fetched ModuleDataManagementInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ModuleDataManagementInstance( @@ -240,6 +244,7 @@ def update( :returns: The updated ModuleDataManagementInstance """ + data = values.of( { "ModuleInfo": module_info, @@ -251,11 +256,14 @@ def update( "Pricing": pricing, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ModuleDataManagementInstance( @@ -285,6 +293,7 @@ async def update_async( :returns: The updated ModuleDataManagementInstance """ + data = values.of( { "ModuleInfo": module_info, @@ -296,11 +305,14 @@ async def update_async( "Pricing": pricing, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ModuleDataManagementInstance( diff --git a/twilio/rest/marketplace/v1/referral_conversion.py b/twilio/rest/marketplace/v1/referral_conversion.py index 47bb191ed7..9d9f3c2fa9 100644 --- a/twilio/rest/marketplace/v1/referral_conversion.py +++ b/twilio/rest/marketplace/v1/referral_conversion.py @@ -21,8 +21,25 @@ class ReferralConversionInstance(InstanceResource): + + class CreateReferralConversionRequest(object): + """ + :ivar referral_account_sid: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.referral_account_sid: Optional[str] = payload.get( + "referral_account_sid" + ) + + def to_dict(self): + return { + "referral_account_sid": self.referral_account_sid, + } + """ - :ivar converted_account_sid: + :ivar converted_account_sid: """ def __init__(self, version: Version, payload: Dict[str, Any]): @@ -82,8 +99,11 @@ def create( data = create_referral_conversion_request.to_dict() headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -103,8 +123,11 @@ async def create_async( data = create_referral_conversion_request.to_dict() headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/messaging/v1/brand_registration/__init__.py b/twilio/rest/messaging/v1/brand_registration/__init__.py index b6ac290064..e8c2ac40d5 100644 --- a/twilio/rest/messaging/v1/brand_registration/__init__.py +++ b/twilio/rest/messaging/v1/brand_registration/__init__.py @@ -225,10 +225,11 @@ def fetch(self) -> BrandRegistrationInstance: :returns: The fetched BrandRegistrationInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return BrandRegistrationInstance( self._version, @@ -244,9 +245,12 @@ async def fetch_async(self) -> BrandRegistrationInstance: :returns: The fetched BrandRegistrationInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return BrandRegistrationInstance( @@ -262,12 +266,14 @@ def update(self) -> BrandRegistrationInstance: :returns: The updated BrandRegistrationInstance """ + data = values.of({}) + headers = values.of({}) + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return BrandRegistrationInstance( @@ -281,12 +287,14 @@ async def update_async(self) -> BrandRegistrationInstance: :returns: The updated BrandRegistrationInstance """ + data = values.of({}) + headers = values.of({}) + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return BrandRegistrationInstance( @@ -392,6 +400,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -431,6 +443,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -564,7 +580,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return BrandRegistrationPage(self._version, response) async def page_async( @@ -591,8 +613,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return BrandRegistrationPage(self._version, response) diff --git a/twilio/rest/messaging/v1/brand_registration/brand_registration_otp.py b/twilio/rest/messaging/v1/brand_registration/brand_registration_otp.py index 74631cea78..415dec9589 100644 --- a/twilio/rest/messaging/v1/brand_registration/brand_registration_otp.py +++ b/twilio/rest/messaging/v1/brand_registration/brand_registration_otp.py @@ -80,6 +80,8 @@ def create(self) -> BrandRegistrationOtpInstance: headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Accept"] = "application/json" + payload = self._version.create(method="POST", uri=self._uri, headers=headers) return BrandRegistrationOtpInstance( @@ -98,6 +100,8 @@ async def create_async(self) -> BrandRegistrationOtpInstance: headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, headers=headers ) diff --git a/twilio/rest/messaging/v1/brand_registration/brand_vetting.py b/twilio/rest/messaging/v1/brand_registration/brand_vetting.py index 37fe4ed8d4..680be65037 100644 --- a/twilio/rest/messaging/v1/brand_registration/brand_vetting.py +++ b/twilio/rest/messaging/v1/brand_registration/brand_vetting.py @@ -147,10 +147,11 @@ def fetch(self) -> BrandVettingInstance: :returns: The fetched BrandVettingInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return BrandVettingInstance( self._version, @@ -167,9 +168,12 @@ async def fetch_async(self) -> BrandVettingInstance: :returns: The fetched BrandVettingInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return BrandVettingInstance( @@ -252,6 +256,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -282,6 +290,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -444,7 +456,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return BrandVettingPage(self._version, response, self._solution) async def page_async( @@ -476,8 +494,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return BrandVettingPage(self._version, response, self._solution) diff --git a/twilio/rest/messaging/v1/deactivations.py b/twilio/rest/messaging/v1/deactivations.py index 6616d87df5..e2cbf17a94 100644 --- a/twilio/rest/messaging/v1/deactivations.py +++ b/twilio/rest/messaging/v1/deactivations.py @@ -112,7 +112,13 @@ def fetch(self, date: Union[date, object] = values.unset) -> DeactivationsInstan } ) - payload = self._version.fetch(method="GET", uri=self._uri, params=data) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch( + method="GET", uri=self._uri, params=data, headers=headers + ) return DeactivationsInstance( self._version, @@ -136,8 +142,12 @@ async def fetch_async( } ) + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return DeactivationsInstance( diff --git a/twilio/rest/messaging/v1/domain_certs.py b/twilio/rest/messaging/v1/domain_certs.py index 3acc8a18ff..6da256cdb0 100644 --- a/twilio/rest/messaging/v1/domain_certs.py +++ b/twilio/rest/messaging/v1/domain_certs.py @@ -174,10 +174,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -186,9 +186,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> DomainCertsInstance: @@ -199,10 +201,11 @@ def fetch(self) -> DomainCertsInstance: :returns: The fetched DomainCertsInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return DomainCertsInstance( self._version, @@ -218,9 +221,12 @@ async def fetch_async(self) -> DomainCertsInstance: :returns: The fetched DomainCertsInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return DomainCertsInstance( @@ -237,16 +243,20 @@ def update(self, tls_cert: str) -> DomainCertsInstance: :returns: The updated DomainCertsInstance """ + data = values.of( { "TlsCert": tls_cert, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return DomainCertsInstance( @@ -261,16 +271,20 @@ async def update_async(self, tls_cert: str) -> DomainCertsInstance: :returns: The updated DomainCertsInstance """ + data = values.of( { "TlsCert": tls_cert, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return DomainCertsInstance( diff --git a/twilio/rest/messaging/v1/domain_config.py b/twilio/rest/messaging/v1/domain_config.py index 25d69342d0..ed70351077 100644 --- a/twilio/rest/messaging/v1/domain_config.py +++ b/twilio/rest/messaging/v1/domain_config.py @@ -179,10 +179,11 @@ def fetch(self) -> DomainConfigInstance: :returns: The fetched DomainConfigInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return DomainConfigInstance( self._version, @@ -198,9 +199,12 @@ async def fetch_async(self) -> DomainConfigInstance: :returns: The fetched DomainConfigInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return DomainConfigInstance( @@ -226,6 +230,7 @@ def update( :returns: The updated DomainConfigInstance """ + data = values.of( { "FallbackUrl": fallback_url, @@ -234,11 +239,14 @@ def update( "DisableHttps": serialize.boolean_to_string(disable_https), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return DomainConfigInstance( @@ -262,6 +270,7 @@ async def update_async( :returns: The updated DomainConfigInstance """ + data = values.of( { "FallbackUrl": fallback_url, @@ -270,11 +279,14 @@ async def update_async( "DisableHttps": serialize.boolean_to_string(disable_https), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return DomainConfigInstance( diff --git a/twilio/rest/messaging/v1/domain_config_messaging_service.py b/twilio/rest/messaging/v1/domain_config_messaging_service.py index 178ebd544e..2bcd4aa88c 100644 --- a/twilio/rest/messaging/v1/domain_config_messaging_service.py +++ b/twilio/rest/messaging/v1/domain_config_messaging_service.py @@ -14,7 +14,7 @@ from datetime import datetime from typing import Any, Dict, Optional -from twilio.base import deserialize +from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -134,10 +134,11 @@ def fetch(self) -> DomainConfigMessagingServiceInstance: :returns: The fetched DomainConfigMessagingServiceInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return DomainConfigMessagingServiceInstance( self._version, @@ -153,9 +154,12 @@ async def fetch_async(self) -> DomainConfigMessagingServiceInstance: :returns: The fetched DomainConfigMessagingServiceInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return DomainConfigMessagingServiceInstance( diff --git a/twilio/rest/messaging/v1/external_campaign.py b/twilio/rest/messaging/v1/external_campaign.py index ebc115ee74..eed039a6cc 100644 --- a/twilio/rest/messaging/v1/external_campaign.py +++ b/twilio/rest/messaging/v1/external_campaign.py @@ -89,6 +89,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -120,6 +124,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/messaging/v1/linkshortening_messaging_service.py b/twilio/rest/messaging/v1/linkshortening_messaging_service.py index 94ebfa6173..ac69842a0c 100644 --- a/twilio/rest/messaging/v1/linkshortening_messaging_service.py +++ b/twilio/rest/messaging/v1/linkshortening_messaging_service.py @@ -177,10 +177,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -189,9 +189,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def __repr__(self) -> str: diff --git a/twilio/rest/messaging/v1/linkshortening_messaging_service_domain_association.py b/twilio/rest/messaging/v1/linkshortening_messaging_service_domain_association.py index a1252d2b35..4c0b52bddf 100644 --- a/twilio/rest/messaging/v1/linkshortening_messaging_service_domain_association.py +++ b/twilio/rest/messaging/v1/linkshortening_messaging_service_domain_association.py @@ -13,6 +13,7 @@ """ from typing import Any, Dict, Optional +from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -122,10 +123,11 @@ def fetch(self) -> LinkshorteningMessagingServiceDomainAssociationInstance: :returns: The fetched LinkshorteningMessagingServiceDomainAssociationInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return LinkshorteningMessagingServiceDomainAssociationInstance( self._version, @@ -143,9 +145,12 @@ async def fetch_async( :returns: The fetched LinkshorteningMessagingServiceDomainAssociationInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return LinkshorteningMessagingServiceDomainAssociationInstance( diff --git a/twilio/rest/messaging/v1/request_managed_cert.py b/twilio/rest/messaging/v1/request_managed_cert.py index fd79b5a686..81ccf9486c 100644 --- a/twilio/rest/messaging/v1/request_managed_cert.py +++ b/twilio/rest/messaging/v1/request_managed_cert.py @@ -132,12 +132,14 @@ def update(self) -> RequestManagedCertInstance: :returns: The updated RequestManagedCertInstance """ + data = values.of({}) + headers = values.of({}) + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RequestManagedCertInstance( @@ -151,12 +153,14 @@ async def update_async(self) -> RequestManagedCertInstance: :returns: The updated RequestManagedCertInstance """ + data = values.of({}) + headers = values.of({}) + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RequestManagedCertInstance( diff --git a/twilio/rest/messaging/v1/service/__init__.py b/twilio/rest/messaging/v1/service/__init__.py index 0fbb3dd10b..197bdf65f9 100644 --- a/twilio/rest/messaging/v1/service/__init__.py +++ b/twilio/rest/messaging/v1/service/__init__.py @@ -371,10 +371,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -383,9 +383,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> ServiceInstance: @@ -396,10 +398,11 @@ def fetch(self) -> ServiceInstance: :returns: The fetched ServiceInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ServiceInstance( self._version, @@ -415,9 +418,12 @@ async def fetch_async(self) -> ServiceInstance: :returns: The fetched ServiceInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ServiceInstance( @@ -469,6 +475,7 @@ def update( :returns: The updated ServiceInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -495,11 +502,14 @@ def update( ), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload, sid=self._solution["sid"]) @@ -547,6 +557,7 @@ async def update_async( :returns: The updated ServiceInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -573,11 +584,14 @@ async def update_async( ), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload, sid=self._solution["sid"]) @@ -768,6 +782,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -846,6 +864,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -979,7 +1001,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ServicePage(self._version, response) async def page_async( @@ -1006,8 +1034,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ServicePage(self._version, response) diff --git a/twilio/rest/messaging/v1/service/alpha_sender.py b/twilio/rest/messaging/v1/service/alpha_sender.py index 0173c98099..2ba4c2a45c 100644 --- a/twilio/rest/messaging/v1/service/alpha_sender.py +++ b/twilio/rest/messaging/v1/service/alpha_sender.py @@ -152,10 +152,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -164,9 +164,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> AlphaSenderInstance: @@ -177,10 +179,11 @@ def fetch(self) -> AlphaSenderInstance: :returns: The fetched AlphaSenderInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return AlphaSenderInstance( self._version, @@ -197,9 +200,12 @@ async def fetch_async(self) -> AlphaSenderInstance: :returns: The fetched AlphaSenderInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return AlphaSenderInstance( @@ -274,6 +280,10 @@ def create(self, alpha_sender: str) -> AlphaSenderInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -298,6 +308,10 @@ async def create_async(self, alpha_sender: str) -> AlphaSenderInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -433,7 +447,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return AlphaSenderPage(self._version, response, self._solution) async def page_async( @@ -460,8 +480,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return AlphaSenderPage(self._version, response, self._solution) diff --git a/twilio/rest/messaging/v1/service/channel_sender.py b/twilio/rest/messaging/v1/service/channel_sender.py index 0a0d5c98de..9d708a2fba 100644 --- a/twilio/rest/messaging/v1/service/channel_sender.py +++ b/twilio/rest/messaging/v1/service/channel_sender.py @@ -154,10 +154,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -166,9 +166,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> ChannelSenderInstance: @@ -179,10 +181,11 @@ def fetch(self) -> ChannelSenderInstance: :returns: The fetched ChannelSenderInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ChannelSenderInstance( self._version, @@ -199,9 +202,12 @@ async def fetch_async(self) -> ChannelSenderInstance: :returns: The fetched ChannelSenderInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ChannelSenderInstance( @@ -280,6 +286,10 @@ def create(self, sid: str) -> ChannelSenderInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -306,6 +316,10 @@ async def create_async(self, sid: str) -> ChannelSenderInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -443,7 +457,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ChannelSenderPage(self._version, response, self._solution) async def page_async( @@ -470,8 +490,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ChannelSenderPage(self._version, response, self._solution) diff --git a/twilio/rest/messaging/v1/service/phone_number.py b/twilio/rest/messaging/v1/service/phone_number.py index 10d30ab7fa..11b806583e 100644 --- a/twilio/rest/messaging/v1/service/phone_number.py +++ b/twilio/rest/messaging/v1/service/phone_number.py @@ -154,10 +154,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -166,9 +166,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> PhoneNumberInstance: @@ -179,10 +181,11 @@ def fetch(self) -> PhoneNumberInstance: :returns: The fetched PhoneNumberInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return PhoneNumberInstance( self._version, @@ -199,9 +202,12 @@ async def fetch_async(self) -> PhoneNumberInstance: :returns: The fetched PhoneNumberInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return PhoneNumberInstance( @@ -276,6 +282,10 @@ def create(self, phone_number_sid: str) -> PhoneNumberInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -300,6 +310,10 @@ async def create_async(self, phone_number_sid: str) -> PhoneNumberInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -435,7 +449,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return PhoneNumberPage(self._version, response, self._solution) async def page_async( @@ -462,8 +482,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return PhoneNumberPage(self._version, response, self._solution) diff --git a/twilio/rest/messaging/v1/service/short_code.py b/twilio/rest/messaging/v1/service/short_code.py index c8f1b3e3c8..172c78dbb9 100644 --- a/twilio/rest/messaging/v1/service/short_code.py +++ b/twilio/rest/messaging/v1/service/short_code.py @@ -152,10 +152,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -164,9 +164,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> ShortCodeInstance: @@ -177,10 +179,11 @@ def fetch(self) -> ShortCodeInstance: :returns: The fetched ShortCodeInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ShortCodeInstance( self._version, @@ -197,9 +200,12 @@ async def fetch_async(self) -> ShortCodeInstance: :returns: The fetched ShortCodeInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ShortCodeInstance( @@ -274,6 +280,10 @@ def create(self, short_code_sid: str) -> ShortCodeInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -298,6 +308,10 @@ async def create_async(self, short_code_sid: str) -> ShortCodeInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -433,7 +447,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ShortCodePage(self._version, response, self._solution) async def page_async( @@ -460,8 +480,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ShortCodePage(self._version, response, self._solution) diff --git a/twilio/rest/messaging/v1/service/us_app_to_person.py b/twilio/rest/messaging/v1/service/us_app_to_person.py index ad31c6a4b7..dd451f5c59 100644 --- a/twilio/rest/messaging/v1/service/us_app_to_person.py +++ b/twilio/rest/messaging/v1/service/us_app_to_person.py @@ -264,10 +264,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -276,9 +276,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> UsAppToPersonInstance: @@ -289,10 +291,11 @@ def fetch(self) -> UsAppToPersonInstance: :returns: The fetched UsAppToPersonInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return UsAppToPersonInstance( self._version, @@ -309,9 +312,12 @@ async def fetch_async(self) -> UsAppToPersonInstance: :returns: The fetched UsAppToPersonInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return UsAppToPersonInstance( @@ -344,6 +350,7 @@ def update( :returns: The updated UsAppToPersonInstance """ + data = values.of( { "HasEmbeddedLinks": serialize.boolean_to_string(has_embedded_links), @@ -355,11 +362,14 @@ def update( "DirectLending": serialize.boolean_to_string(direct_lending), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return UsAppToPersonInstance( @@ -392,6 +402,7 @@ async def update_async( :returns: The updated UsAppToPersonInstance """ + data = values.of( { "HasEmbeddedLinks": serialize.boolean_to_string(has_embedded_links), @@ -403,11 +414,14 @@ async def update_async( "DirectLending": serialize.boolean_to_string(direct_lending), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return UsAppToPersonInstance( @@ -534,6 +548,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -608,6 +626,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -745,7 +767,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return UsAppToPersonPage(self._version, response, self._solution) async def page_async( @@ -772,8 +800,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return UsAppToPersonPage(self._version, response, self._solution) diff --git a/twilio/rest/messaging/v1/service/us_app_to_person_usecase.py b/twilio/rest/messaging/v1/service/us_app_to_person_usecase.py index 1f0d857047..bf9e48e626 100644 --- a/twilio/rest/messaging/v1/service/us_app_to_person_usecase.py +++ b/twilio/rest/messaging/v1/service/us_app_to_person_usecase.py @@ -81,6 +81,8 @@ def fetch( """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Accept"] = "application/json" + params = values.of( { "BrandRegistrationSid": brand_registration_sid, @@ -108,6 +110,8 @@ async def fetch_async( """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Accept"] = "application/json" + params = values.of( { "BrandRegistrationSid": brand_registration_sid, diff --git a/twilio/rest/messaging/v1/tollfree_verification.py b/twilio/rest/messaging/v1/tollfree_verification.py index 98887c7663..d052bd4cde 100644 --- a/twilio/rest/messaging/v1/tollfree_verification.py +++ b/twilio/rest/messaging/v1/tollfree_verification.py @@ -399,10 +399,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -411,9 +411,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> TollfreeVerificationInstance: @@ -424,10 +426,11 @@ def fetch(self) -> TollfreeVerificationInstance: :returns: The fetched TollfreeVerificationInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return TollfreeVerificationInstance( self._version, @@ -443,9 +446,12 @@ async def fetch_async(self) -> TollfreeVerificationInstance: :returns: The fetched TollfreeVerificationInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return TollfreeVerificationInstance( @@ -507,6 +513,7 @@ def update( :returns: The updated TollfreeVerificationInstance """ + data = values.of( { "BusinessName": business_name, @@ -532,11 +539,14 @@ def update( "EditReason": edit_reason, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return TollfreeVerificationInstance( @@ -596,6 +606,7 @@ async def update_async( :returns: The updated TollfreeVerificationInstance """ + data = values.of( { "BusinessName": business_name, @@ -621,11 +632,14 @@ async def update_async( "EditReason": edit_reason, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return TollfreeVerificationInstance( @@ -759,6 +773,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -850,6 +868,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -1047,7 +1069,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return TollfreeVerificationPage(self._version, response) async def page_async( @@ -1086,8 +1114,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return TollfreeVerificationPage(self._version, response) diff --git a/twilio/rest/messaging/v1/usecase.py b/twilio/rest/messaging/v1/usecase.py index 118c9c895e..fe811e0c84 100644 --- a/twilio/rest/messaging/v1/usecase.py +++ b/twilio/rest/messaging/v1/usecase.py @@ -62,6 +62,8 @@ def fetch(self) -> UsecaseInstance: """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Accept"] = "application/json" + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return UsecaseInstance(self._version, payload) @@ -75,6 +77,8 @@ async def fetch_async(self) -> UsecaseInstance: """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( method="GET", uri=self._uri, headers=headers ) diff --git a/twilio/rest/microvisor/v1/account_config.py b/twilio/rest/microvisor/v1/account_config.py index 0abe5f9288..7faba8acb1 100644 --- a/twilio/rest/microvisor/v1/account_config.py +++ b/twilio/rest/microvisor/v1/account_config.py @@ -156,10 +156,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -168,9 +168,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> AccountConfigInstance: @@ -181,10 +183,11 @@ def fetch(self) -> AccountConfigInstance: :returns: The fetched AccountConfigInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return AccountConfigInstance( self._version, @@ -200,9 +203,12 @@ async def fetch_async(self) -> AccountConfigInstance: :returns: The fetched AccountConfigInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return AccountConfigInstance( @@ -219,16 +225,20 @@ def update(self, value: str) -> AccountConfigInstance: :returns: The updated AccountConfigInstance """ + data = values.of( { "Value": value, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AccountConfigInstance(self._version, payload, key=self._solution["key"]) @@ -241,16 +251,20 @@ async def update_async(self, value: str) -> AccountConfigInstance: :returns: The updated AccountConfigInstance """ + data = values.of( { "Value": value, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AccountConfigInstance(self._version, payload, key=self._solution["key"]) @@ -315,6 +329,10 @@ def create(self, key: str, value: str) -> AccountConfigInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -339,6 +357,10 @@ async def create_async(self, key: str, value: str) -> AccountConfigInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -472,7 +494,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return AccountConfigPage(self._version, response) async def page_async( @@ -499,8 +527,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return AccountConfigPage(self._version, response) diff --git a/twilio/rest/microvisor/v1/account_secret.py b/twilio/rest/microvisor/v1/account_secret.py index e85a78bc58..13ca961e61 100644 --- a/twilio/rest/microvisor/v1/account_secret.py +++ b/twilio/rest/microvisor/v1/account_secret.py @@ -154,10 +154,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -166,9 +166,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> AccountSecretInstance: @@ -179,10 +181,11 @@ def fetch(self) -> AccountSecretInstance: :returns: The fetched AccountSecretInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return AccountSecretInstance( self._version, @@ -198,9 +201,12 @@ async def fetch_async(self) -> AccountSecretInstance: :returns: The fetched AccountSecretInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return AccountSecretInstance( @@ -217,16 +223,20 @@ def update(self, value: str) -> AccountSecretInstance: :returns: The updated AccountSecretInstance """ + data = values.of( { "Value": value, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AccountSecretInstance(self._version, payload, key=self._solution["key"]) @@ -239,16 +249,20 @@ async def update_async(self, value: str) -> AccountSecretInstance: :returns: The updated AccountSecretInstance """ + data = values.of( { "Value": value, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AccountSecretInstance(self._version, payload, key=self._solution["key"]) @@ -313,6 +327,10 @@ def create(self, key: str, value: str) -> AccountSecretInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -337,6 +355,10 @@ async def create_async(self, key: str, value: str) -> AccountSecretInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -470,7 +492,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return AccountSecretPage(self._version, response) async def page_async( @@ -497,8 +525,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return AccountSecretPage(self._version, response) diff --git a/twilio/rest/microvisor/v1/app/__init__.py b/twilio/rest/microvisor/v1/app/__init__.py index 0c91fe3c50..8cfbbe68df 100644 --- a/twilio/rest/microvisor/v1/app/__init__.py +++ b/twilio/rest/microvisor/v1/app/__init__.py @@ -152,10 +152,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -164,9 +164,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> AppInstance: @@ -177,10 +179,11 @@ def fetch(self) -> AppInstance: :returns: The fetched AppInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return AppInstance( self._version, @@ -196,9 +199,12 @@ async def fetch_async(self) -> AppInstance: :returns: The fetched AppInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return AppInstance( @@ -388,7 +394,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return AppPage(self._version, response) async def page_async( @@ -415,8 +427,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return AppPage(self._version, response) diff --git a/twilio/rest/microvisor/v1/app/app_manifest.py b/twilio/rest/microvisor/v1/app/app_manifest.py index 4f9eab075e..0412cadcc1 100644 --- a/twilio/rest/microvisor/v1/app/app_manifest.py +++ b/twilio/rest/microvisor/v1/app/app_manifest.py @@ -13,6 +13,7 @@ """ from typing import Any, Dict, Optional +from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -108,10 +109,11 @@ def fetch(self) -> AppManifestInstance: :returns: The fetched AppManifestInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return AppManifestInstance( self._version, @@ -127,9 +129,12 @@ async def fetch_async(self) -> AppManifestInstance: :returns: The fetched AppManifestInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return AppManifestInstance( diff --git a/twilio/rest/microvisor/v1/device/__init__.py b/twilio/rest/microvisor/v1/device/__init__.py index 42a17340f6..a3b3089162 100644 --- a/twilio/rest/microvisor/v1/device/__init__.py +++ b/twilio/rest/microvisor/v1/device/__init__.py @@ -194,10 +194,11 @@ def fetch(self) -> DeviceInstance: :returns: The fetched DeviceInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return DeviceInstance( self._version, @@ -213,9 +214,12 @@ async def fetch_async(self) -> DeviceInstance: :returns: The fetched DeviceInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return DeviceInstance( @@ -241,6 +245,7 @@ def update( :returns: The updated DeviceInstance """ + data = values.of( { "UniqueName": unique_name, @@ -249,11 +254,14 @@ def update( "RestartApp": serialize.boolean_to_string(restart_app), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return DeviceInstance(self._version, payload, sid=self._solution["sid"]) @@ -275,6 +283,7 @@ async def update_async( :returns: The updated DeviceInstance """ + data = values.of( { "UniqueName": unique_name, @@ -283,11 +292,14 @@ async def update_async( "RestartApp": serialize.boolean_to_string(restart_app), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return DeviceInstance(self._version, payload, sid=self._solution["sid"]) @@ -485,7 +497,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return DevicePage(self._version, response) async def page_async( @@ -512,8 +530,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return DevicePage(self._version, response) diff --git a/twilio/rest/microvisor/v1/device/device_config.py b/twilio/rest/microvisor/v1/device/device_config.py index b4759e90b0..b87063f53f 100644 --- a/twilio/rest/microvisor/v1/device/device_config.py +++ b/twilio/rest/microvisor/v1/device/device_config.py @@ -166,10 +166,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -178,9 +178,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> DeviceConfigInstance: @@ -191,10 +193,11 @@ def fetch(self) -> DeviceConfigInstance: :returns: The fetched DeviceConfigInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return DeviceConfigInstance( self._version, @@ -211,9 +214,12 @@ async def fetch_async(self) -> DeviceConfigInstance: :returns: The fetched DeviceConfigInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return DeviceConfigInstance( @@ -231,16 +237,20 @@ def update(self, value: str) -> DeviceConfigInstance: :returns: The updated DeviceConfigInstance """ + data = values.of( { "Value": value, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return DeviceConfigInstance( @@ -258,16 +268,20 @@ async def update_async(self, value: str) -> DeviceConfigInstance: :returns: The updated DeviceConfigInstance """ + data = values.of( { "Value": value, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return DeviceConfigInstance( @@ -344,6 +358,10 @@ def create(self, key: str, value: str) -> DeviceConfigInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -370,6 +388,10 @@ async def create_async(self, key: str, value: str) -> DeviceConfigInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -505,7 +527,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return DeviceConfigPage(self._version, response, self._solution) async def page_async( @@ -532,8 +560,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return DeviceConfigPage(self._version, response, self._solution) diff --git a/twilio/rest/microvisor/v1/device/device_secret.py b/twilio/rest/microvisor/v1/device/device_secret.py index f89a6c0e96..30b805ea6b 100644 --- a/twilio/rest/microvisor/v1/device/device_secret.py +++ b/twilio/rest/microvisor/v1/device/device_secret.py @@ -164,10 +164,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -176,9 +176,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> DeviceSecretInstance: @@ -189,10 +191,11 @@ def fetch(self) -> DeviceSecretInstance: :returns: The fetched DeviceSecretInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return DeviceSecretInstance( self._version, @@ -209,9 +212,12 @@ async def fetch_async(self) -> DeviceSecretInstance: :returns: The fetched DeviceSecretInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return DeviceSecretInstance( @@ -229,16 +235,20 @@ def update(self, value: str) -> DeviceSecretInstance: :returns: The updated DeviceSecretInstance """ + data = values.of( { "Value": value, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return DeviceSecretInstance( @@ -256,16 +266,20 @@ async def update_async(self, value: str) -> DeviceSecretInstance: :returns: The updated DeviceSecretInstance """ + data = values.of( { "Value": value, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return DeviceSecretInstance( @@ -342,6 +356,10 @@ def create(self, key: str, value: str) -> DeviceSecretInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -368,6 +386,10 @@ async def create_async(self, key: str, value: str) -> DeviceSecretInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -503,7 +525,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return DeviceSecretPage(self._version, response, self._solution) async def page_async( @@ -530,8 +558,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return DeviceSecretPage(self._version, response, self._solution) diff --git a/twilio/rest/monitor/v1/alert.py b/twilio/rest/monitor/v1/alert.py index ef8cf39dda..829e633643 100644 --- a/twilio/rest/monitor/v1/alert.py +++ b/twilio/rest/monitor/v1/alert.py @@ -149,10 +149,11 @@ def fetch(self) -> AlertInstance: :returns: The fetched AlertInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return AlertInstance( self._version, @@ -168,9 +169,12 @@ async def fetch_async(self) -> AlertInstance: :returns: The fetched AlertInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return AlertInstance( @@ -397,7 +401,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return AlertPage(self._version, response) async def page_async( @@ -433,8 +443,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return AlertPage(self._version, response) diff --git a/twilio/rest/monitor/v1/event.py b/twilio/rest/monitor/v1/event.py index 6b67a9c029..31716b8813 100644 --- a/twilio/rest/monitor/v1/event.py +++ b/twilio/rest/monitor/v1/event.py @@ -135,10 +135,11 @@ def fetch(self) -> EventInstance: :returns: The fetched EventInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return EventInstance( self._version, @@ -154,9 +155,12 @@ async def fetch_async(self) -> EventInstance: :returns: The fetched EventInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return EventInstance( @@ -428,7 +432,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return EventPage(self._version, response) async def page_async( @@ -473,8 +483,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return EventPage(self._version, response) diff --git a/twilio/rest/notify/v1/credential.py b/twilio/rest/notify/v1/credential.py index d894a9a702..9ca59927cb 100644 --- a/twilio/rest/notify/v1/credential.py +++ b/twilio/rest/notify/v1/credential.py @@ -208,10 +208,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -220,9 +220,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> CredentialInstance: @@ -233,10 +235,11 @@ def fetch(self) -> CredentialInstance: :returns: The fetched CredentialInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return CredentialInstance( self._version, @@ -252,9 +255,12 @@ async def fetch_async(self) -> CredentialInstance: :returns: The fetched CredentialInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return CredentialInstance( @@ -284,6 +290,7 @@ def update( :returns: The updated CredentialInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -294,11 +301,14 @@ def update( "Secret": secret, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CredentialInstance(self._version, payload, sid=self._solution["sid"]) @@ -324,6 +334,7 @@ async def update_async( :returns: The updated CredentialInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -334,11 +345,14 @@ async def update_async( "Secret": secret, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CredentialInstance(self._version, payload, sid=self._solution["sid"]) @@ -422,6 +436,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -465,6 +483,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -598,7 +620,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return CredentialPage(self._version, response) async def page_async( @@ -625,8 +653,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return CredentialPage(self._version, response) diff --git a/twilio/rest/notify/v1/service/__init__.py b/twilio/rest/notify/v1/service/__init__.py index 2654c97c14..e097e69a67 100644 --- a/twilio/rest/notify/v1/service/__init__.py +++ b/twilio/rest/notify/v1/service/__init__.py @@ -305,10 +305,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -317,9 +317,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> ServiceInstance: @@ -330,10 +332,11 @@ def fetch(self) -> ServiceInstance: :returns: The fetched ServiceInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ServiceInstance( self._version, @@ -349,9 +352,12 @@ async def fetch_async(self) -> ServiceInstance: :returns: The fetched ServiceInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ServiceInstance( @@ -397,6 +403,7 @@ def update( :returns: The updated ServiceInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -417,11 +424,14 @@ def update( ), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload, sid=self._solution["sid"]) @@ -463,6 +473,7 @@ async def update_async( :returns: The updated ServiceInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -483,11 +494,14 @@ async def update_async( ), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload, sid=self._solution["sid"]) @@ -618,6 +632,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -684,6 +702,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -832,7 +854,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ServicePage(self._version, response) async def page_async( @@ -862,8 +890,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ServicePage(self._version, response) diff --git a/twilio/rest/notify/v1/service/binding.py b/twilio/rest/notify/v1/service/binding.py index 845f720dc2..33b1a4aac0 100644 --- a/twilio/rest/notify/v1/service/binding.py +++ b/twilio/rest/notify/v1/service/binding.py @@ -173,10 +173,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -185,9 +185,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> BindingInstance: @@ -198,10 +200,11 @@ def fetch(self) -> BindingInstance: :returns: The fetched BindingInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return BindingInstance( self._version, @@ -218,9 +221,12 @@ async def fetch_async(self) -> BindingInstance: :returns: The fetched BindingInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return BindingInstance( @@ -316,6 +322,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -361,6 +371,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -560,7 +574,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return BindingPage(self._version, response, self._solution) async def page_async( @@ -599,8 +619,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return BindingPage(self._version, response, self._solution) diff --git a/twilio/rest/notify/v1/service/notification.py b/twilio/rest/notify/v1/service/notification.py index ec31b423a1..4d228e864f 100644 --- a/twilio/rest/notify/v1/service/notification.py +++ b/twilio/rest/notify/v1/service/notification.py @@ -182,6 +182,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -260,6 +264,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/numbers/v1/__init__.py b/twilio/rest/numbers/v1/__init__.py index 043364c3d5..68f078a88d 100644 --- a/twilio/rest/numbers/v1/__init__.py +++ b/twilio/rest/numbers/v1/__init__.py @@ -28,12 +28,10 @@ from twilio.rest.numbers.v1.porting_webhook_configuration_delete import ( PortingWebhookConfigurationDeleteList, ) -from twilio.rest.numbers.v1.porting_webhook_configuration_fetch import ( - PortingWebhookConfigurationFetchList, -) from twilio.rest.numbers.v1.signing_request_configuration import ( SigningRequestConfigurationList, ) +from twilio.rest.numbers.v1.webhook import WebhookList class V1(Version): @@ -58,12 +56,10 @@ def __init__(self, domain: Domain): self._porting_webhook_configurations_delete: Optional[ PortingWebhookConfigurationDeleteList ] = None - self._porting_webhook_configuration_fetch: Optional[ - PortingWebhookConfigurationFetchList - ] = None self._signing_request_configurations: Optional[ SigningRequestConfigurationList ] = None + self._webhook: Optional[WebhookList] = None @property def bulk_eligibilities(self) -> BulkEligibilityList: @@ -111,22 +107,18 @@ def porting_webhook_configurations_delete( ) return self._porting_webhook_configurations_delete - @property - def porting_webhook_configuration_fetch( - self, - ) -> PortingWebhookConfigurationFetchList: - if self._porting_webhook_configuration_fetch is None: - self._porting_webhook_configuration_fetch = ( - PortingWebhookConfigurationFetchList(self) - ) - return self._porting_webhook_configuration_fetch - @property def signing_request_configurations(self) -> SigningRequestConfigurationList: if self._signing_request_configurations is None: self._signing_request_configurations = SigningRequestConfigurationList(self) return self._signing_request_configurations + @property + def webhook(self) -> WebhookList: + if self._webhook is None: + self._webhook = WebhookList(self) + return self._webhook + def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/numbers/v1/bulk_eligibility.py b/twilio/rest/numbers/v1/bulk_eligibility.py index 97b358b71e..766032f7c4 100644 --- a/twilio/rest/numbers/v1/bulk_eligibility.py +++ b/twilio/rest/numbers/v1/bulk_eligibility.py @@ -127,10 +127,11 @@ def fetch(self) -> BulkEligibilityInstance: :returns: The fetched BulkEligibilityInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return BulkEligibilityInstance( self._version, @@ -146,9 +147,12 @@ async def fetch_async(self) -> BulkEligibilityInstance: :returns: The fetched BulkEligibilityInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return BulkEligibilityInstance( @@ -193,8 +197,11 @@ def create( data = body.to_dict() headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -214,8 +221,11 @@ async def create_async( data = body.to_dict() headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/numbers/v1/eligibility.py b/twilio/rest/numbers/v1/eligibility.py index 007a019f5b..8c5af0ac64 100644 --- a/twilio/rest/numbers/v1/eligibility.py +++ b/twilio/rest/numbers/v1/eligibility.py @@ -64,8 +64,11 @@ def create(self, body: Union[object, object] = values.unset) -> EligibilityInsta data = body.to_dict() headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -85,8 +88,11 @@ async def create_async( data = body.to_dict() headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/numbers/v1/porting_port_in.py b/twilio/rest/numbers/v1/porting_port_in.py index 02844a09b4..bfca5762e0 100644 --- a/twilio/rest/numbers/v1/porting_port_in.py +++ b/twilio/rest/numbers/v1/porting_port_in.py @@ -164,10 +164,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -176,9 +176,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> PortingPortInInstance: @@ -189,10 +191,11 @@ def fetch(self) -> PortingPortInInstance: :returns: The fetched PortingPortInInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return PortingPortInInstance( self._version, @@ -208,9 +211,12 @@ async def fetch_async(self) -> PortingPortInInstance: :returns: The fetched PortingPortInInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return PortingPortInInstance( @@ -255,8 +261,11 @@ def create( data = body.to_dict() headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -276,8 +285,11 @@ async def create_async( data = body.to_dict() headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/numbers/v1/porting_port_in_phone_number.py b/twilio/rest/numbers/v1/porting_port_in_phone_number.py index c494961ef6..cc8120f78f 100644 --- a/twilio/rest/numbers/v1/porting_port_in_phone_number.py +++ b/twilio/rest/numbers/v1/porting_port_in_phone_number.py @@ -14,7 +14,7 @@ from datetime import datetime from typing import Any, Dict, Optional -from twilio.base import deserialize +from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -187,10 +187,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -199,9 +199,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> PortingPortInPhoneNumberInstance: @@ -212,10 +214,11 @@ def fetch(self) -> PortingPortInPhoneNumberInstance: :returns: The fetched PortingPortInPhoneNumberInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return PortingPortInPhoneNumberInstance( self._version, @@ -232,9 +235,12 @@ async def fetch_async(self) -> PortingPortInPhoneNumberInstance: :returns: The fetched PortingPortInPhoneNumberInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return PortingPortInPhoneNumberInstance( diff --git a/twilio/rest/numbers/v1/porting_portability.py b/twilio/rest/numbers/v1/porting_portability.py index 826a69a243..351cd541af 100644 --- a/twilio/rest/numbers/v1/porting_portability.py +++ b/twilio/rest/numbers/v1/porting_portability.py @@ -170,7 +170,13 @@ def fetch( } ) - payload = self._version.fetch(method="GET", uri=self._uri, params=data) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch( + method="GET", uri=self._uri, params=data, headers=headers + ) return PortingPortabilityInstance( self._version, @@ -199,8 +205,12 @@ async def fetch_async( } ) + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return PortingPortabilityInstance( diff --git a/twilio/rest/numbers/v1/porting_webhook_configuration.py b/twilio/rest/numbers/v1/porting_webhook_configuration.py index ec36777a61..cfd9e1d0a8 100644 --- a/twilio/rest/numbers/v1/porting_webhook_configuration.py +++ b/twilio/rest/numbers/v1/porting_webhook_configuration.py @@ -72,8 +72,11 @@ def create( data = body.to_dict() headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -93,8 +96,11 @@ async def create_async( data = body.to_dict() headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/numbers/v1/porting_webhook_configuration_delete.py b/twilio/rest/numbers/v1/porting_webhook_configuration_delete.py index 73d3477972..11572f1846 100644 --- a/twilio/rest/numbers/v1/porting_webhook_configuration_delete.py +++ b/twilio/rest/numbers/v1/porting_webhook_configuration_delete.py @@ -12,6 +12,7 @@ Do not edit the class manually. """ +from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.list_resource import ListResource @@ -48,10 +49,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -60,9 +61,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def __repr__(self) -> str: diff --git a/twilio/rest/numbers/v1/signing_request_configuration.py b/twilio/rest/numbers/v1/signing_request_configuration.py index a144a09fe6..fcfcd7777b 100644 --- a/twilio/rest/numbers/v1/signing_request_configuration.py +++ b/twilio/rest/numbers/v1/signing_request_configuration.py @@ -102,8 +102,11 @@ def create( data = body.to_dict() headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -123,8 +126,11 @@ async def create_async( data = body.to_dict() headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -288,7 +294,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return SigningRequestConfigurationPage(self._version, response) async def page_async( @@ -321,8 +333,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return SigningRequestConfigurationPage(self._version, response) diff --git a/twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py b/twilio/rest/numbers/v1/webhook.py similarity index 77% rename from twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py rename to twilio/rest/numbers/v1/webhook.py index 89b8064bdb..69bd556326 100644 --- a/twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py +++ b/twilio/rest/numbers/v1/webhook.py @@ -21,7 +21,7 @@ from twilio.base.version import Version -class PortingWebhookConfigurationFetchInstance(InstanceResource): +class WebhookInstance(InstanceResource): """ :ivar url: The URL of the webhook configuration request :ivar port_in_target_url: The complete webhook url that will be called when a notification event for port in request or port in phone number happens @@ -52,14 +52,14 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" -class PortingWebhookConfigurationFetchList(ListResource): +class WebhookList(ListResource): def __init__(self, version: Version): """ - Initialize the PortingWebhookConfigurationFetchList + Initialize the WebhookList :param version: Version that contains the resource @@ -68,33 +68,37 @@ def __init__(self, version: Version): self._uri = "/Porting/Configuration/Webhook" - def fetch(self) -> PortingWebhookConfigurationFetchInstance: + def fetch(self) -> WebhookInstance: """ - Asynchronously fetch the PortingWebhookConfigurationFetchInstance + Asynchronously fetch the WebhookInstance - :returns: The fetched PortingWebhookConfigurationFetchInstance + :returns: The fetched WebhookInstance """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Accept"] = "application/json" + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) - return PortingWebhookConfigurationFetchInstance(self._version, payload) + return WebhookInstance(self._version, payload) - async def fetch_async(self) -> PortingWebhookConfigurationFetchInstance: + async def fetch_async(self) -> WebhookInstance: """ - Asynchronously fetch the PortingWebhookConfigurationFetchInstance + Asynchronously fetch the WebhookInstance - :returns: The fetched PortingWebhookConfigurationFetchInstance + :returns: The fetched WebhookInstance """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( method="GET", uri=self._uri, headers=headers ) - return PortingWebhookConfigurationFetchInstance(self._version, payload) + return WebhookInstance(self._version, payload) def __repr__(self) -> str: """ @@ -102,4 +106,4 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" diff --git a/twilio/rest/numbers/v2/authorization_document/__init__.py b/twilio/rest/numbers/v2/authorization_document/__init__.py index f56071878e..033a32cfd7 100644 --- a/twilio/rest/numbers/v2/authorization_document/__init__.py +++ b/twilio/rest/numbers/v2/authorization_document/__init__.py @@ -170,10 +170,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -182,9 +182,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> AuthorizationDocumentInstance: @@ -195,10 +197,11 @@ def fetch(self) -> AuthorizationDocumentInstance: :returns: The fetched AuthorizationDocumentInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return AuthorizationDocumentInstance( self._version, @@ -214,9 +217,12 @@ async def fetch_async(self) -> AuthorizationDocumentInstance: :returns: The fetched AuthorizationDocumentInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return AuthorizationDocumentInstance( @@ -315,6 +321,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -357,6 +367,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -518,7 +532,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return AuthorizationDocumentPage(self._version, response) async def page_async( @@ -551,8 +571,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return AuthorizationDocumentPage(self._version, response) diff --git a/twilio/rest/numbers/v2/authorization_document/dependent_hosted_number_order.py b/twilio/rest/numbers/v2/authorization_document/dependent_hosted_number_order.py index 7fc558fee2..36f961f5ef 100644 --- a/twilio/rest/numbers/v2/authorization_document/dependent_hosted_number_order.py +++ b/twilio/rest/numbers/v2/authorization_document/dependent_hosted_number_order.py @@ -350,7 +350,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return DependentHostedNumberOrderPage(self._version, response, self._solution) async def page_async( @@ -391,8 +397,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return DependentHostedNumberOrderPage(self._version, response, self._solution) diff --git a/twilio/rest/numbers/v2/bulk_hosted_number_order.py b/twilio/rest/numbers/v2/bulk_hosted_number_order.py index 325ffe8e73..7259c801d2 100644 --- a/twilio/rest/numbers/v2/bulk_hosted_number_order.py +++ b/twilio/rest/numbers/v2/bulk_hosted_number_order.py @@ -160,7 +160,13 @@ def fetch( } ) - payload = self._version.fetch(method="GET", uri=self._uri, params=data) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch( + method="GET", uri=self._uri, params=data, headers=headers + ) return BulkHostedNumberOrderInstance( self._version, @@ -185,8 +191,12 @@ async def fetch_async( } ) + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return BulkHostedNumberOrderInstance( @@ -231,8 +241,11 @@ def create( data = body.to_dict() headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -252,8 +265,11 @@ async def create_async( data = body.to_dict() headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/numbers/v2/hosted_number_order.py b/twilio/rest/numbers/v2/hosted_number_order.py index 0fab0fe34a..5ad2b6d920 100644 --- a/twilio/rest/numbers/v2/hosted_number_order.py +++ b/twilio/rest/numbers/v2/hosted_number_order.py @@ -248,10 +248,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -260,9 +260,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> HostedNumberOrderInstance: @@ -273,10 +275,11 @@ def fetch(self) -> HostedNumberOrderInstance: :returns: The fetched HostedNumberOrderInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return HostedNumberOrderInstance( self._version, @@ -292,9 +295,12 @@ async def fetch_async(self) -> HostedNumberOrderInstance: :returns: The fetched HostedNumberOrderInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return HostedNumberOrderInstance( @@ -318,6 +324,7 @@ def update( :returns: The updated HostedNumberOrderInstance """ + data = values.of( { "Status": status, @@ -325,11 +332,14 @@ def update( "VerificationCallExtension": verification_call_extension, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return HostedNumberOrderInstance( @@ -351,6 +361,7 @@ async def update_async( :returns: The updated HostedNumberOrderInstance """ + data = values.of( { "Status": status, @@ -358,11 +369,14 @@ async def update_async( "VerificationCallExtension": verification_call_extension, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return HostedNumberOrderInstance( @@ -475,6 +489,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -545,6 +563,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -757,7 +779,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return HostedNumberOrderPage(self._version, response) async def page_async( @@ -799,8 +827,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return HostedNumberOrderPage(self._version, response) diff --git a/twilio/rest/numbers/v2/regulatory_compliance/bundle/__init__.py b/twilio/rest/numbers/v2/regulatory_compliance/bundle/__init__.py index 8ad16f21ce..079540d87b 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/bundle/__init__.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/bundle/__init__.py @@ -266,10 +266,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -278,9 +278,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> BundleInstance: @@ -291,10 +293,11 @@ def fetch(self) -> BundleInstance: :returns: The fetched BundleInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return BundleInstance( self._version, @@ -310,9 +313,12 @@ async def fetch_async(self) -> BundleInstance: :returns: The fetched BundleInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return BundleInstance( @@ -338,6 +344,7 @@ def update( :returns: The updated BundleInstance """ + data = values.of( { "Status": status, @@ -346,11 +353,14 @@ def update( "Email": email, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return BundleInstance(self._version, payload, sid=self._solution["sid"]) @@ -372,6 +382,7 @@ async def update_async( :returns: The updated BundleInstance """ + data = values.of( { "Status": status, @@ -380,11 +391,14 @@ async def update_async( "Email": email, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return BundleInstance(self._version, payload, sid=self._solution["sid"]) @@ -519,6 +533,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -565,6 +583,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -867,7 +889,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return BundlePage(self._version, response) async def page_async( @@ -927,8 +955,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return BundlePage(self._version, response) diff --git a/twilio/rest/numbers/v2/regulatory_compliance/bundle/bundle_copy.py b/twilio/rest/numbers/v2/regulatory_compliance/bundle/bundle_copy.py index 860a6f186e..d20a569690 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/bundle/bundle_copy.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/bundle/bundle_copy.py @@ -138,6 +138,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -164,6 +168,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -299,7 +307,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return BundleCopyPage(self._version, response, self._solution) async def page_async( @@ -326,8 +340,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return BundleCopyPage(self._version, response, self._solution) diff --git a/twilio/rest/numbers/v2/regulatory_compliance/bundle/evaluation.py b/twilio/rest/numbers/v2/regulatory_compliance/bundle/evaluation.py index 83d061cda7..fd45064808 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/bundle/evaluation.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/bundle/evaluation.py @@ -140,10 +140,11 @@ def fetch(self) -> EvaluationInstance: :returns: The fetched EvaluationInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return EvaluationInstance( self._version, @@ -160,9 +161,12 @@ async def fetch_async(self) -> EvaluationInstance: :returns: The fetched EvaluationInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return EvaluationInstance( @@ -233,6 +237,8 @@ def create(self) -> EvaluationInstance: headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Accept"] = "application/json" + payload = self._version.create(method="POST", uri=self._uri, headers=headers) return EvaluationInstance( @@ -249,6 +255,8 @@ async def create_async(self) -> EvaluationInstance: headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, headers=headers ) @@ -384,7 +392,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return EvaluationPage(self._version, response, self._solution) async def page_async( @@ -411,8 +425,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return EvaluationPage(self._version, response, self._solution) diff --git a/twilio/rest/numbers/v2/regulatory_compliance/bundle/item_assignment.py b/twilio/rest/numbers/v2/regulatory_compliance/bundle/item_assignment.py index 5fa77e7f95..4eb1fe2b33 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/bundle/item_assignment.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/bundle/item_assignment.py @@ -148,10 +148,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -160,9 +160,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> ItemAssignmentInstance: @@ -173,10 +175,11 @@ def fetch(self) -> ItemAssignmentInstance: :returns: The fetched ItemAssignmentInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ItemAssignmentInstance( self._version, @@ -193,9 +196,12 @@ async def fetch_async(self) -> ItemAssignmentInstance: :returns: The fetched ItemAssignmentInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ItemAssignmentInstance( @@ -272,6 +278,10 @@ def create(self, object_sid: str) -> ItemAssignmentInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -296,6 +306,10 @@ async def create_async(self, object_sid: str) -> ItemAssignmentInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -431,7 +445,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ItemAssignmentPage(self._version, response, self._solution) async def page_async( @@ -458,8 +478,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ItemAssignmentPage(self._version, response, self._solution) diff --git a/twilio/rest/numbers/v2/regulatory_compliance/bundle/replace_items.py b/twilio/rest/numbers/v2/regulatory_compliance/bundle/replace_items.py index 2e2bc6c293..a6a1de024d 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/bundle/replace_items.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/bundle/replace_items.py @@ -114,6 +114,10 @@ def create(self, from_bundle_sid: str) -> ReplaceItemsInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -138,6 +142,10 @@ async def create_async(self, from_bundle_sid: str) -> ReplaceItemsInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/numbers/v2/regulatory_compliance/end_user.py b/twilio/rest/numbers/v2/regulatory_compliance/end_user.py index 7886494d54..ab1803372a 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/end_user.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/end_user.py @@ -183,10 +183,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -195,9 +195,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> EndUserInstance: @@ -208,10 +210,11 @@ def fetch(self) -> EndUserInstance: :returns: The fetched EndUserInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return EndUserInstance( self._version, @@ -227,9 +230,12 @@ async def fetch_async(self) -> EndUserInstance: :returns: The fetched EndUserInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return EndUserInstance( @@ -251,17 +257,21 @@ def update( :returns: The updated EndUserInstance """ + data = values.of( { "FriendlyName": friendly_name, "Attributes": serialize.object(attributes), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return EndUserInstance(self._version, payload, sid=self._solution["sid"]) @@ -279,17 +289,21 @@ async def update_async( :returns: The updated EndUserInstance """ + data = values.of( { "FriendlyName": friendly_name, "Attributes": serialize.object(attributes), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return EndUserInstance(self._version, payload, sid=self._solution["sid"]) @@ -361,6 +375,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -392,6 +410,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -525,7 +547,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return EndUserPage(self._version, response) async def page_async( @@ -552,8 +580,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return EndUserPage(self._version, response) diff --git a/twilio/rest/numbers/v2/regulatory_compliance/end_user_type.py b/twilio/rest/numbers/v2/regulatory_compliance/end_user_type.py index ba155575ac..f14c8905c7 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/end_user_type.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/end_user_type.py @@ -114,10 +114,11 @@ def fetch(self) -> EndUserTypeInstance: :returns: The fetched EndUserTypeInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return EndUserTypeInstance( self._version, @@ -133,9 +134,12 @@ async def fetch_async(self) -> EndUserTypeInstance: :returns: The fetched EndUserTypeInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return EndUserTypeInstance( @@ -313,7 +317,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return EndUserTypePage(self._version, response) async def page_async( @@ -340,8 +350,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return EndUserTypePage(self._version, response) diff --git a/twilio/rest/numbers/v2/regulatory_compliance/regulation.py b/twilio/rest/numbers/v2/regulatory_compliance/regulation.py index 706853bcee..9c1227905e 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/regulation.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/regulation.py @@ -144,7 +144,13 @@ def fetch( } ) - payload = self._version.fetch(method="GET", uri=self._uri, params=data) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch( + method="GET", uri=self._uri, params=data, headers=headers + ) return RegulationInstance( self._version, @@ -169,8 +175,12 @@ async def fetch_async( } ) + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return RegulationInstance( @@ -412,7 +422,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return RegulationPage(self._version, response) async def page_async( @@ -451,8 +467,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return RegulationPage(self._version, response) diff --git a/twilio/rest/numbers/v2/regulatory_compliance/supporting_document.py b/twilio/rest/numbers/v2/regulatory_compliance/supporting_document.py index c343e91ed5..b72f993858 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/supporting_document.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/supporting_document.py @@ -199,10 +199,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -211,9 +211,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> SupportingDocumentInstance: @@ -224,10 +226,11 @@ def fetch(self) -> SupportingDocumentInstance: :returns: The fetched SupportingDocumentInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return SupportingDocumentInstance( self._version, @@ -243,9 +246,12 @@ async def fetch_async(self) -> SupportingDocumentInstance: :returns: The fetched SupportingDocumentInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return SupportingDocumentInstance( @@ -267,17 +273,21 @@ def update( :returns: The updated SupportingDocumentInstance """ + data = values.of( { "FriendlyName": friendly_name, "Attributes": serialize.object(attributes), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SupportingDocumentInstance( @@ -297,17 +307,21 @@ async def update_async( :returns: The updated SupportingDocumentInstance """ + data = values.of( { "FriendlyName": friendly_name, "Attributes": serialize.object(attributes), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SupportingDocumentInstance( @@ -381,6 +395,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -412,6 +430,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -545,7 +567,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return SupportingDocumentPage(self._version, response) async def page_async( @@ -572,8 +600,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return SupportingDocumentPage(self._version, response) diff --git a/twilio/rest/numbers/v2/regulatory_compliance/supporting_document_type.py b/twilio/rest/numbers/v2/regulatory_compliance/supporting_document_type.py index 0c7dc7b302..692248cb45 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/supporting_document_type.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/supporting_document_type.py @@ -116,10 +116,11 @@ def fetch(self) -> SupportingDocumentTypeInstance: :returns: The fetched SupportingDocumentTypeInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return SupportingDocumentTypeInstance( self._version, @@ -135,9 +136,12 @@ async def fetch_async(self) -> SupportingDocumentTypeInstance: :returns: The fetched SupportingDocumentTypeInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return SupportingDocumentTypeInstance( @@ -315,7 +319,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return SupportingDocumentTypePage(self._version, response) async def page_async( @@ -342,8 +352,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return SupportingDocumentTypePage(self._version, response) diff --git a/twilio/rest/oauth/v1/authorize.py b/twilio/rest/oauth/v1/authorize.py index 19341db74e..a353c4b8e0 100644 --- a/twilio/rest/oauth/v1/authorize.py +++ b/twilio/rest/oauth/v1/authorize.py @@ -69,6 +69,8 @@ def fetch( """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Accept"] = "application/json" + params = values.of( { "ResponseType": response_type, @@ -101,6 +103,8 @@ async def fetch_async( """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Accept"] = "application/json" + params = values.of( { "ResponseType": response_type, diff --git a/twilio/rest/oauth/v1/token.py b/twilio/rest/oauth/v1/token.py index 0d5377a9f9..18de1008cb 100644 --- a/twilio/rest/oauth/v1/token.py +++ b/twilio/rest/oauth/v1/token.py @@ -101,6 +101,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -147,6 +151,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/preview/hosted_numbers/authorization_document/__init__.py b/twilio/rest/preview/hosted_numbers/authorization_document/__init__.py index 79fe4beddd..49d3d40da5 100644 --- a/twilio/rest/preview/hosted_numbers/authorization_document/__init__.py +++ b/twilio/rest/preview/hosted_numbers/authorization_document/__init__.py @@ -219,10 +219,11 @@ def fetch(self) -> AuthorizationDocumentInstance: :returns: The fetched AuthorizationDocumentInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return AuthorizationDocumentInstance( self._version, @@ -238,9 +239,12 @@ async def fetch_async(self) -> AuthorizationDocumentInstance: :returns: The fetched AuthorizationDocumentInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return AuthorizationDocumentInstance( @@ -272,6 +276,7 @@ def update( :returns: The updated AuthorizationDocumentInstance """ + data = values.of( { "HostedNumberOrderSids": serialize.map( @@ -285,11 +290,14 @@ def update( "ContactPhoneNumber": contact_phone_number, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AuthorizationDocumentInstance( @@ -319,6 +327,7 @@ async def update_async( :returns: The updated AuthorizationDocumentInstance """ + data = values.of( { "HostedNumberOrderSids": serialize.map( @@ -332,11 +341,14 @@ async def update_async( "ContactPhoneNumber": contact_phone_number, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AuthorizationDocumentInstance( @@ -435,6 +447,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -477,6 +493,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -638,7 +658,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return AuthorizationDocumentPage(self._version, response) async def page_async( @@ -671,8 +697,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return AuthorizationDocumentPage(self._version, response) diff --git a/twilio/rest/preview/hosted_numbers/authorization_document/dependent_hosted_number_order.py b/twilio/rest/preview/hosted_numbers/authorization_document/dependent_hosted_number_order.py index 35b67d71c7..0ec58f8792 100644 --- a/twilio/rest/preview/hosted_numbers/authorization_document/dependent_hosted_number_order.py +++ b/twilio/rest/preview/hosted_numbers/authorization_document/dependent_hosted_number_order.py @@ -385,7 +385,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return DependentHostedNumberOrderPage(self._version, response, self._solution) async def page_async( @@ -429,8 +435,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return DependentHostedNumberOrderPage(self._version, response, self._solution) diff --git a/twilio/rest/preview/hosted_numbers/hosted_number_order.py b/twilio/rest/preview/hosted_numbers/hosted_number_order.py index 7010b1b3eb..0c20af8791 100644 --- a/twilio/rest/preview/hosted_numbers/hosted_number_order.py +++ b/twilio/rest/preview/hosted_numbers/hosted_number_order.py @@ -290,10 +290,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -302,9 +302,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> HostedNumberOrderInstance: @@ -315,10 +317,11 @@ def fetch(self) -> HostedNumberOrderInstance: :returns: The fetched HostedNumberOrderInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return HostedNumberOrderInstance( self._version, @@ -334,9 +337,12 @@ async def fetch_async(self) -> HostedNumberOrderInstance: :returns: The fetched HostedNumberOrderInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return HostedNumberOrderInstance( @@ -376,6 +382,7 @@ def update( :returns: The updated HostedNumberOrderInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -390,11 +397,14 @@ def update( "CallDelay": call_delay, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return HostedNumberOrderInstance( @@ -432,6 +442,7 @@ async def update_async( :returns: The updated HostedNumberOrderInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -446,11 +457,14 @@ async def update_async( "CallDelay": call_delay, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return HostedNumberOrderInstance( @@ -570,6 +584,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -645,6 +663,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -857,7 +879,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return HostedNumberOrderPage(self._version, response) async def page_async( @@ -899,8 +927,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return HostedNumberOrderPage(self._version, response) diff --git a/twilio/rest/preview/marketplace/available_add_on/__init__.py b/twilio/rest/preview/marketplace/available_add_on/__init__.py index 7743d8a8c3..e81ec649de 100644 --- a/twilio/rest/preview/marketplace/available_add_on/__init__.py +++ b/twilio/rest/preview/marketplace/available_add_on/__init__.py @@ -132,10 +132,11 @@ def fetch(self) -> AvailableAddOnInstance: :returns: The fetched AvailableAddOnInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return AvailableAddOnInstance( self._version, @@ -151,9 +152,12 @@ async def fetch_async(self) -> AvailableAddOnInstance: :returns: The fetched AvailableAddOnInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return AvailableAddOnInstance( @@ -343,7 +347,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return AvailableAddOnPage(self._version, response) async def page_async( @@ -370,8 +380,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return AvailableAddOnPage(self._version, response) diff --git a/twilio/rest/preview/marketplace/available_add_on/available_add_on_extension.py b/twilio/rest/preview/marketplace/available_add_on/available_add_on_extension.py index d27b74cbfc..4c05f4244d 100644 --- a/twilio/rest/preview/marketplace/available_add_on/available_add_on_extension.py +++ b/twilio/rest/preview/marketplace/available_add_on/available_add_on_extension.py @@ -128,10 +128,11 @@ def fetch(self) -> AvailableAddOnExtensionInstance: :returns: The fetched AvailableAddOnExtensionInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return AvailableAddOnExtensionInstance( self._version, @@ -148,9 +149,12 @@ async def fetch_async(self) -> AvailableAddOnExtensionInstance: :returns: The fetched AvailableAddOnExtensionInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return AvailableAddOnExtensionInstance( @@ -342,7 +346,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return AvailableAddOnExtensionPage(self._version, response, self._solution) async def page_async( @@ -369,8 +379,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return AvailableAddOnExtensionPage(self._version, response, self._solution) diff --git a/twilio/rest/preview/marketplace/installed_add_on/__init__.py b/twilio/rest/preview/marketplace/installed_add_on/__init__.py index 731e84c80c..7f1fadc510 100644 --- a/twilio/rest/preview/marketplace/installed_add_on/__init__.py +++ b/twilio/rest/preview/marketplace/installed_add_on/__init__.py @@ -194,10 +194,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -206,9 +206,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> InstalledAddOnInstance: @@ -219,10 +221,11 @@ def fetch(self) -> InstalledAddOnInstance: :returns: The fetched InstalledAddOnInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return InstalledAddOnInstance( self._version, @@ -238,9 +241,12 @@ async def fetch_async(self) -> InstalledAddOnInstance: :returns: The fetched InstalledAddOnInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return InstalledAddOnInstance( @@ -262,17 +268,21 @@ def update( :returns: The updated InstalledAddOnInstance """ + data = values.of( { "Configuration": serialize.object(configuration), "UniqueName": unique_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return InstalledAddOnInstance(self._version, payload, sid=self._solution["sid"]) @@ -290,17 +300,21 @@ async def update_async( :returns: The updated InstalledAddOnInstance """ + data = values.of( { "Configuration": serialize.object(configuration), "UniqueName": unique_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return InstalledAddOnInstance(self._version, payload, sid=self._solution["sid"]) @@ -389,6 +403,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -425,6 +443,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -558,7 +580,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return InstalledAddOnPage(self._version, response) async def page_async( @@ -585,8 +613,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return InstalledAddOnPage(self._version, response) diff --git a/twilio/rest/preview/marketplace/installed_add_on/installed_add_on_extension.py b/twilio/rest/preview/marketplace/installed_add_on/installed_add_on_extension.py index f8e65d12c1..e0574ee2fd 100644 --- a/twilio/rest/preview/marketplace/installed_add_on/installed_add_on_extension.py +++ b/twilio/rest/preview/marketplace/installed_add_on/installed_add_on_extension.py @@ -154,10 +154,11 @@ def fetch(self) -> InstalledAddOnExtensionInstance: :returns: The fetched InstalledAddOnExtensionInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return InstalledAddOnExtensionInstance( self._version, @@ -174,9 +175,12 @@ async def fetch_async(self) -> InstalledAddOnExtensionInstance: :returns: The fetched InstalledAddOnExtensionInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return InstalledAddOnExtensionInstance( @@ -194,16 +198,20 @@ def update(self, enabled: bool) -> InstalledAddOnExtensionInstance: :returns: The updated InstalledAddOnExtensionInstance """ + data = values.of( { "Enabled": serialize.boolean_to_string(enabled), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return InstalledAddOnExtensionInstance( @@ -221,16 +229,20 @@ async def update_async(self, enabled: bool) -> InstalledAddOnExtensionInstance: :returns: The updated InstalledAddOnExtensionInstance """ + data = values.of( { "Enabled": serialize.boolean_to_string(enabled), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return InstalledAddOnExtensionInstance( @@ -422,7 +434,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return InstalledAddOnExtensionPage(self._version, response, self._solution) async def page_async( @@ -449,8 +467,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return InstalledAddOnExtensionPage(self._version, response, self._solution) diff --git a/twilio/rest/preview/sync/service/__init__.py b/twilio/rest/preview/sync/service/__init__.py index 23f805a875..7b09429375 100644 --- a/twilio/rest/preview/sync/service/__init__.py +++ b/twilio/rest/preview/sync/service/__init__.py @@ -224,10 +224,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -236,9 +236,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> ServiceInstance: @@ -249,10 +251,11 @@ def fetch(self) -> ServiceInstance: :returns: The fetched ServiceInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ServiceInstance( self._version, @@ -268,9 +271,12 @@ async def fetch_async(self) -> ServiceInstance: :returns: The fetched ServiceInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ServiceInstance( @@ -296,6 +302,7 @@ def update( :returns: The updated ServiceInstance """ + data = values.of( { "WebhookUrl": webhook_url, @@ -306,11 +313,14 @@ def update( "AclEnabled": serialize.boolean_to_string(acl_enabled), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload, sid=self._solution["sid"]) @@ -332,6 +342,7 @@ async def update_async( :returns: The updated ServiceInstance """ + data = values.of( { "WebhookUrl": webhook_url, @@ -342,11 +353,14 @@ async def update_async( "AclEnabled": serialize.boolean_to_string(acl_enabled), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload, sid=self._solution["sid"]) @@ -459,6 +473,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -495,6 +513,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -628,7 +650,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ServicePage(self._version, response) async def page_async( @@ -655,8 +683,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ServicePage(self._version, response) diff --git a/twilio/rest/preview/sync/service/document/__init__.py b/twilio/rest/preview/sync/service/document/__init__.py index c7033e2fd2..ee55186ca4 100644 --- a/twilio/rest/preview/sync/service/document/__init__.py +++ b/twilio/rest/preview/sync/service/document/__init__.py @@ -200,10 +200,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -212,9 +212,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> DocumentInstance: @@ -225,10 +227,11 @@ def fetch(self) -> DocumentInstance: :returns: The fetched DocumentInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return DocumentInstance( self._version, @@ -245,9 +248,12 @@ async def fetch_async(self) -> DocumentInstance: :returns: The fetched DocumentInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return DocumentInstance( @@ -268,16 +274,22 @@ def update( :returns: The updated DocumentInstance """ + data = values.of( { "Data": serialize.object(data), } ) - headers = values.of( - { - "If-Match": if_match, - } - ) + headers = values.of({}) + + if not ( + if_match is values.unset or (isinstance(if_match, str) and not if_match) + ): + headers["If-Match"] = if_match + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( method="POST", uri=self._uri, data=data, headers=headers @@ -301,16 +313,22 @@ async def update_async( :returns: The updated DocumentInstance """ + data = values.of( { "Data": serialize.object(data), } ) - headers = values.of( - { - "If-Match": if_match, - } - ) + headers = values.of({}) + + if not ( + if_match is values.unset or (isinstance(if_match, str) and not if_match) + ): + headers["If-Match"] = if_match + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( method="POST", uri=self._uri, data=data, headers=headers @@ -407,6 +425,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -437,6 +459,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -572,7 +598,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return DocumentPage(self._version, response, self._solution) async def page_async( @@ -599,8 +631,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return DocumentPage(self._version, response, self._solution) diff --git a/twilio/rest/preview/sync/service/document/document_permission.py b/twilio/rest/preview/sync/service/document/document_permission.py index 48addbb163..676efb569f 100644 --- a/twilio/rest/preview/sync/service/document/document_permission.py +++ b/twilio/rest/preview/sync/service/document/document_permission.py @@ -190,10 +190,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -202,9 +202,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> DocumentPermissionInstance: @@ -215,10 +217,11 @@ def fetch(self) -> DocumentPermissionInstance: :returns: The fetched DocumentPermissionInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return DocumentPermissionInstance( self._version, @@ -236,9 +239,12 @@ async def fetch_async(self) -> DocumentPermissionInstance: :returns: The fetched DocumentPermissionInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return DocumentPermissionInstance( @@ -261,6 +267,7 @@ def update( :returns: The updated DocumentPermissionInstance """ + data = values.of( { "Read": serialize.boolean_to_string(read), @@ -268,11 +275,14 @@ def update( "Manage": serialize.boolean_to_string(manage), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return DocumentPermissionInstance( @@ -295,6 +305,7 @@ async def update_async( :returns: The updated DocumentPermissionInstance """ + data = values.of( { "Read": serialize.boolean_to_string(read), @@ -302,11 +313,14 @@ async def update_async( "Manage": serialize.boolean_to_string(manage), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return DocumentPermissionInstance( @@ -502,7 +516,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return DocumentPermissionPage(self._version, response, self._solution) async def page_async( @@ -529,8 +549,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return DocumentPermissionPage(self._version, response, self._solution) diff --git a/twilio/rest/preview/sync/service/sync_list/__init__.py b/twilio/rest/preview/sync/service/sync_list/__init__.py index 4b920e0194..0461f22430 100644 --- a/twilio/rest/preview/sync/service/sync_list/__init__.py +++ b/twilio/rest/preview/sync/service/sync_list/__init__.py @@ -175,10 +175,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -187,9 +187,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> SyncListInstance: @@ -200,10 +202,11 @@ def fetch(self) -> SyncListInstance: :returns: The fetched SyncListInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return SyncListInstance( self._version, @@ -220,9 +223,12 @@ async def fetch_async(self) -> SyncListInstance: :returns: The fetched SyncListInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return SyncListInstance( @@ -325,6 +331,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -351,6 +361,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -486,7 +500,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return SyncListPage(self._version, response, self._solution) async def page_async( @@ -513,8 +533,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return SyncListPage(self._version, response, self._solution) diff --git a/twilio/rest/preview/sync/service/sync_list/sync_list_item.py b/twilio/rest/preview/sync/service/sync_list/sync_list_item.py index b84411e8a8..5220aec215 100644 --- a/twilio/rest/preview/sync/service/sync_list/sync_list_item.py +++ b/twilio/rest/preview/sync/service/sync_list/sync_list_item.py @@ -215,6 +215,8 @@ def delete(self, if_match: Union[str, object] = values.unset) -> bool: } ) + headers = values.of({}) + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self, if_match: Union[str, object] = values.unset) -> bool: @@ -231,6 +233,8 @@ async def delete_async(self, if_match: Union[str, object] = values.unset) -> boo } ) + headers = values.of({}) + return await self._version.delete_async( method="DELETE", uri=self._uri, headers=headers ) @@ -243,10 +247,11 @@ def fetch(self) -> SyncListItemInstance: :returns: The fetched SyncListItemInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return SyncListItemInstance( self._version, @@ -264,9 +269,12 @@ async def fetch_async(self) -> SyncListItemInstance: :returns: The fetched SyncListItemInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return SyncListItemInstance( @@ -288,16 +296,22 @@ def update( :returns: The updated SyncListItemInstance """ + data = values.of( { "Data": serialize.object(data), } ) - headers = values.of( - { - "If-Match": if_match, - } - ) + headers = values.of({}) + + if not ( + if_match is values.unset or (isinstance(if_match, str) and not if_match) + ): + headers["If-Match"] = if_match + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( method="POST", uri=self._uri, data=data, headers=headers @@ -322,16 +336,22 @@ async def update_async( :returns: The updated SyncListItemInstance """ + data = values.of( { "Data": serialize.object(data), } ) - headers = values.of( - { - "If-Match": if_match, - } - ) + headers = values.of({}) + + if not ( + if_match is values.unset or (isinstance(if_match, str) and not if_match) + ): + headers["If-Match"] = if_match + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( method="POST", uri=self._uri, data=data, headers=headers @@ -417,6 +437,10 @@ def create(self, data: object) -> SyncListItemInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -444,6 +468,10 @@ async def create_async(self, data: object) -> SyncListItemInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -625,7 +653,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return SyncListItemPage(self._version, response, self._solution) async def page_async( @@ -661,8 +695,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return SyncListItemPage(self._version, response, self._solution) diff --git a/twilio/rest/preview/sync/service/sync_list/sync_list_permission.py b/twilio/rest/preview/sync/service/sync_list/sync_list_permission.py index 2fcaca5b26..334b62dd18 100644 --- a/twilio/rest/preview/sync/service/sync_list/sync_list_permission.py +++ b/twilio/rest/preview/sync/service/sync_list/sync_list_permission.py @@ -192,10 +192,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -204,9 +204,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> SyncListPermissionInstance: @@ -217,10 +219,11 @@ def fetch(self) -> SyncListPermissionInstance: :returns: The fetched SyncListPermissionInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return SyncListPermissionInstance( self._version, @@ -238,9 +241,12 @@ async def fetch_async(self) -> SyncListPermissionInstance: :returns: The fetched SyncListPermissionInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return SyncListPermissionInstance( @@ -263,6 +269,7 @@ def update( :returns: The updated SyncListPermissionInstance """ + data = values.of( { "Read": serialize.boolean_to_string(read), @@ -270,11 +277,14 @@ def update( "Manage": serialize.boolean_to_string(manage), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SyncListPermissionInstance( @@ -297,6 +307,7 @@ async def update_async( :returns: The updated SyncListPermissionInstance """ + data = values.of( { "Read": serialize.boolean_to_string(read), @@ -304,11 +315,14 @@ async def update_async( "Manage": serialize.boolean_to_string(manage), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SyncListPermissionInstance( @@ -502,7 +516,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return SyncListPermissionPage(self._version, response, self._solution) async def page_async( @@ -529,8 +549,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return SyncListPermissionPage(self._version, response, self._solution) diff --git a/twilio/rest/preview/sync/service/sync_map/__init__.py b/twilio/rest/preview/sync/service/sync_map/__init__.py index 19c29f3267..0ecbb6132f 100644 --- a/twilio/rest/preview/sync/service/sync_map/__init__.py +++ b/twilio/rest/preview/sync/service/sync_map/__init__.py @@ -175,10 +175,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -187,9 +187,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> SyncMapInstance: @@ -200,10 +202,11 @@ def fetch(self) -> SyncMapInstance: :returns: The fetched SyncMapInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return SyncMapInstance( self._version, @@ -220,9 +223,12 @@ async def fetch_async(self) -> SyncMapInstance: :returns: The fetched SyncMapInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return SyncMapInstance( @@ -323,6 +329,10 @@ def create(self, unique_name: Union[str, object] = values.unset) -> SyncMapInsta ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -349,6 +359,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -484,7 +498,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return SyncMapPage(self._version, response, self._solution) async def page_async( @@ -511,8 +531,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return SyncMapPage(self._version, response, self._solution) diff --git a/twilio/rest/preview/sync/service/sync_map/sync_map_item.py b/twilio/rest/preview/sync/service/sync_map/sync_map_item.py index 78682fe588..9ddd1d5afe 100644 --- a/twilio/rest/preview/sync/service/sync_map/sync_map_item.py +++ b/twilio/rest/preview/sync/service/sync_map/sync_map_item.py @@ -215,6 +215,8 @@ def delete(self, if_match: Union[str, object] = values.unset) -> bool: } ) + headers = values.of({}) + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self, if_match: Union[str, object] = values.unset) -> bool: @@ -231,6 +233,8 @@ async def delete_async(self, if_match: Union[str, object] = values.unset) -> boo } ) + headers = values.of({}) + return await self._version.delete_async( method="DELETE", uri=self._uri, headers=headers ) @@ -243,10 +247,11 @@ def fetch(self) -> SyncMapItemInstance: :returns: The fetched SyncMapItemInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return SyncMapItemInstance( self._version, @@ -264,9 +269,12 @@ async def fetch_async(self) -> SyncMapItemInstance: :returns: The fetched SyncMapItemInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return SyncMapItemInstance( @@ -288,16 +296,22 @@ def update( :returns: The updated SyncMapItemInstance """ + data = values.of( { "Data": serialize.object(data), } ) - headers = values.of( - { - "If-Match": if_match, - } - ) + headers = values.of({}) + + if not ( + if_match is values.unset or (isinstance(if_match, str) and not if_match) + ): + headers["If-Match"] = if_match + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( method="POST", uri=self._uri, data=data, headers=headers @@ -322,16 +336,22 @@ async def update_async( :returns: The updated SyncMapItemInstance """ + data = values.of( { "Data": serialize.object(data), } ) - headers = values.of( - { - "If-Match": if_match, - } - ) + headers = values.of({}) + + if not ( + if_match is values.unset or (isinstance(if_match, str) and not if_match) + ): + headers["If-Match"] = if_match + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( method="POST", uri=self._uri, data=data, headers=headers @@ -419,6 +439,10 @@ def create(self, key: str, data: object) -> SyncMapItemInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -448,6 +472,10 @@ async def create_async(self, key: str, data: object) -> SyncMapItemInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -629,7 +657,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return SyncMapItemPage(self._version, response, self._solution) async def page_async( @@ -665,8 +699,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return SyncMapItemPage(self._version, response, self._solution) diff --git a/twilio/rest/preview/sync/service/sync_map/sync_map_permission.py b/twilio/rest/preview/sync/service/sync_map/sync_map_permission.py index b626f07bdc..9e19d56a91 100644 --- a/twilio/rest/preview/sync/service/sync_map/sync_map_permission.py +++ b/twilio/rest/preview/sync/service/sync_map/sync_map_permission.py @@ -190,10 +190,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -202,9 +202,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> SyncMapPermissionInstance: @@ -215,10 +217,11 @@ def fetch(self) -> SyncMapPermissionInstance: :returns: The fetched SyncMapPermissionInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return SyncMapPermissionInstance( self._version, @@ -236,9 +239,12 @@ async def fetch_async(self) -> SyncMapPermissionInstance: :returns: The fetched SyncMapPermissionInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return SyncMapPermissionInstance( @@ -261,6 +267,7 @@ def update( :returns: The updated SyncMapPermissionInstance """ + data = values.of( { "Read": serialize.boolean_to_string(read), @@ -268,11 +275,14 @@ def update( "Manage": serialize.boolean_to_string(manage), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SyncMapPermissionInstance( @@ -295,6 +305,7 @@ async def update_async( :returns: The updated SyncMapPermissionInstance """ + data = values.of( { "Read": serialize.boolean_to_string(read), @@ -302,11 +313,14 @@ async def update_async( "Manage": serialize.boolean_to_string(manage), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SyncMapPermissionInstance( @@ -500,7 +514,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return SyncMapPermissionPage(self._version, response, self._solution) async def page_async( @@ -527,8 +547,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return SyncMapPermissionPage(self._version, response, self._solution) diff --git a/twilio/rest/preview/wireless/command.py b/twilio/rest/preview/wireless/command.py index b91d1969e8..8e715e09ef 100644 --- a/twilio/rest/preview/wireless/command.py +++ b/twilio/rest/preview/wireless/command.py @@ -131,10 +131,11 @@ def fetch(self) -> CommandInstance: :returns: The fetched CommandInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return CommandInstance( self._version, @@ -150,9 +151,12 @@ async def fetch_async(self) -> CommandInstance: :returns: The fetched CommandInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return CommandInstance( @@ -240,6 +244,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -283,6 +291,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -480,7 +492,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return CommandPage(self._version, response) async def page_async( @@ -519,8 +537,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return CommandPage(self._version, response) diff --git a/twilio/rest/preview/wireless/rate_plan.py b/twilio/rest/preview/wireless/rate_plan.py index b9ca020da6..95e45f1ef2 100644 --- a/twilio/rest/preview/wireless/rate_plan.py +++ b/twilio/rest/preview/wireless/rate_plan.py @@ -194,10 +194,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -206,9 +206,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> RatePlanInstance: @@ -219,10 +221,11 @@ def fetch(self) -> RatePlanInstance: :returns: The fetched RatePlanInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return RatePlanInstance( self._version, @@ -238,9 +241,12 @@ async def fetch_async(self) -> RatePlanInstance: :returns: The fetched RatePlanInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return RatePlanInstance( @@ -262,17 +268,21 @@ def update( :returns: The updated RatePlanInstance """ + data = values.of( { "UniqueName": unique_name, "FriendlyName": friendly_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RatePlanInstance(self._version, payload, sid=self._solution["sid"]) @@ -290,17 +300,21 @@ async def update_async( :returns: The updated RatePlanInstance """ + data = values.of( { "UniqueName": unique_name, "FriendlyName": friendly_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RatePlanInstance(self._version, payload, sid=self._solution["sid"]) @@ -397,6 +411,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -453,6 +471,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -586,7 +608,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return RatePlanPage(self._version, response) async def page_async( @@ -613,8 +641,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return RatePlanPage(self._version, response) diff --git a/twilio/rest/preview/wireless/sim/__init__.py b/twilio/rest/preview/wireless/sim/__init__.py index 8620c03ba2..07a9e74da0 100644 --- a/twilio/rest/preview/wireless/sim/__init__.py +++ b/twilio/rest/preview/wireless/sim/__init__.py @@ -285,10 +285,11 @@ def fetch(self) -> SimInstance: :returns: The fetched SimInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return SimInstance( self._version, @@ -304,9 +305,12 @@ async def fetch_async(self) -> SimInstance: :returns: The fetched SimInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return SimInstance( @@ -356,6 +360,7 @@ def update( :returns: The updated SimInstance """ + data = values.of( { "UniqueName": unique_name, @@ -376,11 +381,14 @@ def update( "VoiceUrl": voice_url, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SimInstance(self._version, payload, sid=self._solution["sid"]) @@ -426,6 +434,7 @@ async def update_async( :returns: The updated SimInstance """ + data = values.of( { "UniqueName": unique_name, @@ -446,11 +455,14 @@ async def update_async( "VoiceUrl": voice_url, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SimInstance(self._version, payload, sid=self._solution["sid"]) @@ -715,7 +727,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return SimPage(self._version, response) async def page_async( @@ -757,8 +775,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return SimPage(self._version, response) diff --git a/twilio/rest/preview/wireless/sim/usage.py b/twilio/rest/preview/wireless/sim/usage.py index d90b5f9e84..aff3731b51 100644 --- a/twilio/rest/preview/wireless/sim/usage.py +++ b/twilio/rest/preview/wireless/sim/usage.py @@ -150,7 +150,13 @@ def fetch( } ) - payload = self._version.fetch(method="GET", uri=self._uri, params=data) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch( + method="GET", uri=self._uri, params=data, headers=headers + ) return UsageInstance( self._version, @@ -179,8 +185,12 @@ async def fetch_async( } ) + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return UsageInstance( diff --git a/twilio/rest/preview_iam/PreviewIamBase.py b/twilio/rest/preview_iam/PreviewIamBase.py index d8735295d7..bdf047ecd2 100644 --- a/twilio/rest/preview_iam/PreviewIamBase.py +++ b/twilio/rest/preview_iam/PreviewIamBase.py @@ -9,15 +9,16 @@ Do not edit the class manually. """ -from twilio.base.domain import Domain from typing import Optional -from twilio.rest import Client +from twilio.base.domain import Domain +from twilio.rest import Client +from twilio.rest.preview_iam.organizations import Organizations from twilio.rest.preview_iam.v1 import V1 -from twilio.rest.preview_iam.versionless import Versionless class PreviewIamBase(Domain): + def __init__(self, twilio: Client): """ Initialize the PreviewIam Domain @@ -25,23 +26,30 @@ def __init__(self, twilio: Client): :returns: Domain for PreviewIam """ super().__init__(twilio, "https://preview-iam.twilio.com") - self._versionless: Optional[Versionless] = None + self._organizations: Optional[Organizations] = None self._v1: Optional[V1] = None @property - def versionless(self) -> Versionless: + def organizations(self) -> Organizations: """ - :returns: Versionless of PreviewIam + :returns: Versions organizations of PreviewIam """ - if self._versionless is None: - self._versionless = Versionless(self) - return self._versionless + if self._organizations is None: + self._organizations = Organizations(self) + return self._organizations @property def v1(self) -> V1: """ - :returns: V1 of PreviewIam + :returns: Versions v1 of PreviewIam """ 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_iam/__init__.py b/twilio/rest/preview_iam/__init__.py index 9103436220..dd51b97489 100644 --- a/twilio/rest/preview_iam/__init__.py +++ b/twilio/rest/preview_iam/__init__.py @@ -1,25 +1,59 @@ -from twilio.rest.preview_iam.PreviewIamBase import PreviewIamBase +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.rest.preview_iam.v1.authorize import ( - AuthorizeList, -) -from twilio.rest.preview_iam.v1.token import ( - TokenList, -) -from twilio.rest.preview_iam.versionless.organization import ( - OrganizationList, -) + Organization Public API + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + 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_iam.organizations.account import AccountList +from twilio.rest.preview_iam.organizations.role_assignment import RoleAssignmentList +from twilio.rest.preview_iam.organizations.user import UserList + + +class Organizations(Version): + + def __init__(self, domain: Domain): + """ + Initialize the Organizations version of PreviewIam + + :param domain: The Twilio.preview_iam domain + """ + super().__init__(domain, "Organizations") + self._accounts: Optional[AccountList] = None + self._role_assignments: Optional[RoleAssignmentList] = None + self._users: Optional[UserList] = None -class PreviewIam(PreviewIamBase): @property - def organization(self) -> OrganizationList: - return self.versionless.organization + def accounts(self) -> AccountList: + if self._accounts is None: + self._accounts = AccountList(self) + return self._accounts @property - def authorize(self) -> AuthorizeList: - return self.v1.authorize + def role_assignments(self) -> RoleAssignmentList: + if self._role_assignments is None: + self._role_assignments = RoleAssignmentList(self) + return self._role_assignments @property - def token(self) -> TokenList: - return self.v1.token + def users(self) -> UserList: + if self._users is None: + self._users = UserList(self) + return self._users + + def __repr__(self) -> str: + """ + Provide a friendly representation + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/preview_iam/organizations/__init__.py b/twilio/rest/preview_iam/organizations/__init__.py new file mode 100644 index 0000000000..dd51b97489 --- /dev/null +++ b/twilio/rest/preview_iam/organizations/__init__.py @@ -0,0 +1,59 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Organization Public API + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + 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_iam.organizations.account import AccountList +from twilio.rest.preview_iam.organizations.role_assignment import RoleAssignmentList +from twilio.rest.preview_iam.organizations.user import UserList + + +class Organizations(Version): + + def __init__(self, domain: Domain): + """ + Initialize the Organizations version of PreviewIam + + :param domain: The Twilio.preview_iam domain + """ + super().__init__(domain, "Organizations") + self._accounts: Optional[AccountList] = None + self._role_assignments: Optional[RoleAssignmentList] = None + self._users: Optional[UserList] = None + + @property + def accounts(self) -> AccountList: + if self._accounts is None: + self._accounts = AccountList(self) + return self._accounts + + @property + def role_assignments(self) -> RoleAssignmentList: + if self._role_assignments is None: + self._role_assignments = RoleAssignmentList(self) + return self._role_assignments + + @property + def users(self) -> UserList: + if self._users is None: + self._users = UserList(self) + return self._users + + def __repr__(self) -> str: + """ + Provide a friendly representation + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/preview_iam/organizations/account.py b/twilio/rest/preview_iam/organizations/account.py new file mode 100644 index 0000000000..bc5f49e28f --- /dev/null +++ b/twilio/rest/preview_iam/organizations/account.py @@ -0,0 +1,436 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Organization Public API + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + 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, List, Optional, Union, Iterator, AsyncIterator +from twilio.base import deserialize, values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version +from twilio.base.page import Page + + +class AccountInstance(InstanceResource): + """ + :ivar account_sid: Twilio account sid + :ivar friendly_name: Account friendly name + :ivar status: Account status + :ivar owner_sid: Twilio account sid + :ivar date_created: The date and time when the account was created in the system + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + organization_sid: Optional[str] = None, + account_sid: Optional[str] = None, + ): + super().__init__(version) + + self.account_sid: Optional[str] = payload.get("account_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.status: Optional[str] = payload.get("status") + self.owner_sid: Optional[str] = payload.get("owner_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + + self._solution = { + "organization_sid": organization_sid or self.organization_sid, + "account_sid": account_sid or self.account_sid, + } + self._context: Optional[AccountContext] = None + + @property + def _proxy(self) -> "AccountContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: AccountContext for this AccountInstance + """ + if self._context is None: + self._context = AccountContext( + self._version, + organization_sid=self._solution["organization_sid"], + account_sid=self._solution["account_sid"], + ) + return self._context + + def fetch(self) -> "AccountInstance": + """ + Fetch the AccountInstance + + + :returns: The fetched AccountInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "AccountInstance": + """ + Asynchronous coroutine to fetch the AccountInstance + + + :returns: The fetched AccountInstance + """ + return await self._proxy.fetch_async() + + 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 AccountContext(InstanceContext): + + def __init__(self, version: Version, organization_sid: str, account_sid: str): + """ + Initialize the AccountContext + + :param version: Version that contains the resource + :param organization_sid: + :param account_sid: + """ + super().__init__(version) + + # Path Solution + self._solution = { + "organization_sid": organization_sid, + "account_sid": account_sid, + } + self._uri = "/{organization_sid}/Accounts/{account_sid}".format( + **self._solution + ) + + def fetch(self) -> AccountInstance: + """ + Fetch the AccountInstance + + + :returns: The fetched AccountInstance + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) + + return AccountInstance( + self._version, + payload, + organization_sid=self._solution["organization_sid"], + account_sid=self._solution["account_sid"], + ) + + async def fetch_async(self) -> AccountInstance: + """ + Asynchronous coroutine to fetch the AccountInstance + + + :returns: The fetched AccountInstance + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = await self._version.fetch_async( + method="GET", uri=self._uri, headers=headers + ) + + return AccountInstance( + self._version, + payload, + organization_sid=self._solution["organization_sid"], + account_sid=self._solution["account_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 AccountPage(Page): + + def get_instance(self, payload: Dict[str, Any]) -> AccountInstance: + """ + Build an instance of AccountInstance + + :param payload: Payload response from the API + """ + return AccountInstance( + self._version, payload, organization_sid=self._solution["organization_sid"] + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class AccountList(ListResource): + + def __init__(self, version: Version, organization_sid: str): + """ + Initialize the AccountList + + :param version: Version that contains the resource + :param organization_sid: + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "organization_sid": organization_sid, + } + self._uri = "/{organization_sid}/Accounts".format(**self._solution) + + def stream( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[AccountInstance]: + """ + Streams AccountInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = self.page(page_size=limits["page_size"]) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[AccountInstance]: + """ + Asynchronously streams AccountInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = await self.page_async(page_size=limits["page_size"]) + + return self._version.stream_async(page, limits["limit"]) + + def list( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[AccountInstance]: + """ + Lists AccountInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return list( + self.stream( + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[AccountInstance]: + """ + Asynchronously lists AccountInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return [ + record + async for record in await self.stream_async( + limit=limit, + page_size=page_size, + ) + ] + + def page( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> AccountPage: + """ + Retrieve a single page of AccountInstance records from the API. + Request is executed immediately + + :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 + + :returns: Page of AccountInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) + return AccountPage(self._version, response, self._solution) + + async def page_async( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> AccountPage: + """ + Asynchronously retrieve a single page of AccountInstance records from the API. + Request is executed immediately + + :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 + + :returns: Page of AccountInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = await self._version.page_async( + method="GET", uri=self._uri, params=data, headers=headers + ) + return AccountPage(self._version, response, self._solution) + + def get_page(self, target_url: str) -> AccountPage: + """ + Retrieve a specific page of AccountInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of AccountInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return AccountPage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> AccountPage: + """ + Asynchronously retrieve a specific page of AccountInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of AccountInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return AccountPage(self._version, response, self._solution) + + def get(self, organization_sid: str, account_sid: str) -> AccountContext: + """ + Constructs a AccountContext + + :param organization_sid: + :param account_sid: + """ + return AccountContext( + self._version, organization_sid=organization_sid, account_sid=account_sid + ) + + def __call__(self, organization_sid: str, account_sid: str) -> AccountContext: + """ + Constructs a AccountContext + + :param organization_sid: + :param account_sid: + """ + return AccountContext( + self._version, organization_sid=organization_sid, account_sid=account_sid + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/preview_iam/organizations/role_assignment.py b/twilio/rest/preview_iam/organizations/role_assignment.py new file mode 100644 index 0000000000..9608e2b806 --- /dev/null +++ b/twilio/rest/preview_iam/organizations/role_assignment.py @@ -0,0 +1,588 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Organization Public API + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + 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, Union, Iterator, AsyncIterator +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version +from twilio.base.page import Page + + +class RoleAssignmentInstance(InstanceResource): + + class PublicApiCreateRoleAssignmentRequest(object): + """ + :ivar role_sid: Twilio Role Sid representing assigned role + :ivar scope: Twilio Sid representing scope of this assignment + :ivar identity: Twilio Sid representing identity of this assignment + """ + + def __init__(self, payload: Dict[str, Any]): + + self.role_sid: Optional[str] = payload.get("role_sid") + self.scope: Optional[str] = payload.get("scope") + self.identity: Optional[str] = payload.get("identity") + + def to_dict(self): + return { + "role_sid": self.role_sid, + "scope": self.scope, + "identity": self.identity, + } + + """ + :ivar sid: Twilio Role Assignment Sid representing this role assignment + :ivar role_sid: Twilio Role Sid representing assigned role + :ivar scope: Twilio Sid representing identity of this assignment + :ivar identity: Twilio Sid representing scope of this assignment + :ivar code: Twilio-specific error code + :ivar message: Error message + :ivar more_info: Link to Error Code References + :ivar status: HTTP response status code + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + organization_sid: Optional[str] = None, + role_assignment_sid: Optional[str] = None, + ): + super().__init__(version) + + self.sid: Optional[str] = payload.get("sid") + self.role_sid: Optional[str] = payload.get("role_sid") + self.scope: Optional[str] = payload.get("scope") + self.identity: Optional[str] = payload.get("identity") + self.code: Optional[int] = payload.get("code") + self.message: Optional[str] = payload.get("message") + self.more_info: Optional[str] = payload.get("moreInfo") + self.status: Optional[int] = payload.get("status") + + self._solution = { + "organization_sid": organization_sid or self.organization_sid, + "role_assignment_sid": role_assignment_sid or self.role_assignment_sid, + } + self._context: Optional[RoleAssignmentContext] = None + + @property + def _proxy(self) -> "RoleAssignmentContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: RoleAssignmentContext for this RoleAssignmentInstance + """ + if self._context is None: + self._context = RoleAssignmentContext( + self._version, + organization_sid=self._solution["organization_sid"], + role_assignment_sid=self._solution["role_assignment_sid"], + ) + return self._context + + def delete(self) -> bool: + """ + Deletes the RoleAssignmentInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the RoleAssignmentInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + 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 RoleAssignmentContext(InstanceContext): + + class PublicApiCreateRoleAssignmentRequest(object): + """ + :ivar role_sid: Twilio Role Sid representing assigned role + :ivar scope: Twilio Sid representing scope of this assignment + :ivar identity: Twilio Sid representing identity of this assignment + """ + + def __init__(self, payload: Dict[str, Any]): + + self.role_sid: Optional[str] = payload.get("role_sid") + self.scope: Optional[str] = payload.get("scope") + self.identity: Optional[str] = payload.get("identity") + + def to_dict(self): + return { + "role_sid": self.role_sid, + "scope": self.scope, + "identity": self.identity, + } + + def __init__( + self, version: Version, organization_sid: str, role_assignment_sid: str + ): + """ + Initialize the RoleAssignmentContext + + :param version: Version that contains the resource + :param organization_sid: + :param role_assignment_sid: + """ + super().__init__(version) + + # Path Solution + self._solution = { + "organization_sid": organization_sid, + "role_assignment_sid": role_assignment_sid, + } + self._uri = "/{organization_sid}/RoleAssignments/{role_assignment_sid}".format( + **self._solution + ) + + def delete(self) -> bool: + """ + Deletes the RoleAssignmentInstance + + + :returns: True if delete succeeds, False otherwise + """ + + headers = values.of({}) + + headers["Accept"] = "application/scim+json" + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the RoleAssignmentInstance + + + :returns: True if delete succeeds, False otherwise + """ + + headers = values.of({}) + + headers["Accept"] = "application/scim+json" + + return await self._version.delete_async( + method="DELETE", uri=self._uri, headers=headers + ) + + 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 RoleAssignmentPage(Page): + + def get_instance(self, payload: Dict[str, Any]) -> RoleAssignmentInstance: + """ + Build an instance of RoleAssignmentInstance + + :param payload: Payload response from the API + """ + return RoleAssignmentInstance( + self._version, payload, organization_sid=self._solution["organization_sid"] + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class RoleAssignmentList(ListResource): + + class PublicApiCreateRoleAssignmentRequest(object): + """ + :ivar role_sid: Twilio Role Sid representing assigned role + :ivar scope: Twilio Sid representing scope of this assignment + :ivar identity: Twilio Sid representing identity of this assignment + """ + + def __init__(self, payload: Dict[str, Any]): + + self.role_sid: Optional[str] = payload.get("role_sid") + self.scope: Optional[str] = payload.get("scope") + self.identity: Optional[str] = payload.get("identity") + + def to_dict(self): + return { + "role_sid": self.role_sid, + "scope": self.scope, + "identity": self.identity, + } + + def __init__(self, version: Version, organization_sid: str): + """ + Initialize the RoleAssignmentList + + :param version: Version that contains the resource + :param organization_sid: + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "organization_sid": organization_sid, + } + self._uri = "/{organization_sid}/RoleAssignments".format(**self._solution) + + def create( + self, + public_api_create_role_assignment_request: PublicApiCreateRoleAssignmentRequest, + ) -> RoleAssignmentInstance: + """ + Create the RoleAssignmentInstance + + :param public_api_create_role_assignment_request: + + :returns: The created RoleAssignmentInstance + """ + data = public_api_create_role_assignment_request.to_dict() + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return RoleAssignmentInstance( + self._version, payload, organization_sid=self._solution["organization_sid"] + ) + + async def create_async( + self, + public_api_create_role_assignment_request: PublicApiCreateRoleAssignmentRequest, + ) -> RoleAssignmentInstance: + """ + Asynchronously create the RoleAssignmentInstance + + :param public_api_create_role_assignment_request: + + :returns: The created RoleAssignmentInstance + """ + data = public_api_create_role_assignment_request.to_dict() + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return RoleAssignmentInstance( + self._version, payload, organization_sid=self._solution["organization_sid"] + ) + + def stream( + self, + identity: Union[str, object] = values.unset, + scope: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[RoleAssignmentInstance]: + """ + Streams RoleAssignmentInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param str identity: + :param str scope: + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = self.page(identity=identity, scope=scope, page_size=limits["page_size"]) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + identity: Union[str, object] = values.unset, + scope: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[RoleAssignmentInstance]: + """ + Asynchronously streams RoleAssignmentInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param str identity: + :param str scope: + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = await self.page_async( + identity=identity, scope=scope, page_size=limits["page_size"] + ) + + return self._version.stream_async(page, limits["limit"]) + + def list( + self, + identity: Union[str, object] = values.unset, + scope: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[RoleAssignmentInstance]: + """ + Lists RoleAssignmentInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str identity: + :param str scope: + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return list( + self.stream( + identity=identity, + scope=scope, + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + identity: Union[str, object] = values.unset, + scope: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[RoleAssignmentInstance]: + """ + Asynchronously lists RoleAssignmentInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str identity: + :param str scope: + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return [ + record + async for record in await self.stream_async( + identity=identity, + scope=scope, + limit=limit, + page_size=page_size, + ) + ] + + def page( + self, + identity: Union[str, object] = values.unset, + scope: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> RoleAssignmentPage: + """ + Retrieve a single page of RoleAssignmentInstance records from the API. + Request is executed immediately + + :param identity: + :param scope: + :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 + + :returns: Page of RoleAssignmentInstance + """ + data = values.of( + { + "Identity": identity, + "Scope": scope, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) + return RoleAssignmentPage(self._version, response, self._solution) + + async def page_async( + self, + identity: Union[str, object] = values.unset, + scope: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> RoleAssignmentPage: + """ + Asynchronously retrieve a single page of RoleAssignmentInstance records from the API. + Request is executed immediately + + :param identity: + :param scope: + :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 + + :returns: Page of RoleAssignmentInstance + """ + data = values.of( + { + "Identity": identity, + "Scope": scope, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = await self._version.page_async( + method="GET", uri=self._uri, params=data, headers=headers + ) + return RoleAssignmentPage(self._version, response, self._solution) + + def get_page(self, target_url: str) -> RoleAssignmentPage: + """ + Retrieve a specific page of RoleAssignmentInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of RoleAssignmentInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return RoleAssignmentPage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> RoleAssignmentPage: + """ + Asynchronously retrieve a specific page of RoleAssignmentInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of RoleAssignmentInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return RoleAssignmentPage(self._version, response, self._solution) + + def get( + self, organization_sid: str, role_assignment_sid: str + ) -> RoleAssignmentContext: + """ + Constructs a RoleAssignmentContext + + :param organization_sid: + :param role_assignment_sid: + """ + return RoleAssignmentContext( + self._version, + organization_sid=organization_sid, + role_assignment_sid=role_assignment_sid, + ) + + def __call__( + self, organization_sid: str, role_assignment_sid: str + ) -> RoleAssignmentContext: + """ + Constructs a RoleAssignmentContext + + :param organization_sid: + :param role_assignment_sid: + """ + return RoleAssignmentContext( + self._version, + organization_sid=organization_sid, + role_assignment_sid=role_assignment_sid, + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/preview_iam/organizations/user.py b/twilio/rest/preview_iam/organizations/user.py new file mode 100644 index 0000000000..31ee699422 --- /dev/null +++ b/twilio/rest/preview_iam/organizations/user.py @@ -0,0 +1,1052 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Organization Public API + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + 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, List, Optional, Union, Iterator, AsyncIterator +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version +from twilio.base.page import Page + + +class UserInstance(InstanceResource): + + class ScimEmailAddress(object): + """ + :ivar primary: Indicates if this email address is the primary one + :ivar value: The actual email address value + :ivar type: The type of email address (e.g., work, home, etc.) + """ + + def __init__(self, payload: Dict[str, Any]): + + self.primary: Optional[bool] = payload.get("primary") + self.value: Optional[str] = payload.get("value") + self.type: Optional[str] = payload.get("type") + + def to_dict(self): + return { + "primary": self.primary, + "value": self.value, + "type": self.type, + } + + class ScimMeta(object): + """ + :ivar resource_type: Indicates the type of the resource + :ivar created: The date and time when the resource was created in the system + :ivar last_modified: The date and time when the resource was last modified + :ivar version: A version identifier for the resource. This can be used to manage resource versioning and concurrency control. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.resource_type: Optional[str] = payload.get("resource_type") + self.created: Optional[datetime] = payload.get("created") + self.last_modified: Optional[datetime] = payload.get("last_modified") + self.version: Optional[str] = payload.get("version") + + def to_dict(self): + return { + "resource_type": self.resource_type, + "created": self.created, + "last_modified": self.last_modified, + "version": self.version, + } + + class ScimName(object): + """ + :ivar given_name: The user's first or given name + :ivar family_name: The user's last or family name + """ + + def __init__(self, payload: Dict[str, Any]): + + self.given_name: Optional[str] = payload.get("given_name") + self.family_name: Optional[str] = payload.get("family_name") + + def to_dict(self): + return { + "given_name": self.given_name, + "family_name": self.family_name, + } + + class ScimUser(object): + """ + :ivar id: Unique Twilio user sid + :ivar external_id: External unique resource id defined by provisioning client + :ivar user_name: Unique username, MUST be same as primary email address + :ivar display_name: User friendly display name + :ivar name: + :ivar emails: Email address list of the user. Primary email must be defined if there are more than 1 email. Primary email must match the username. + :ivar active: Indicates whether the user is active + :ivar locale: User's locale + :ivar timezone: User's time zone + :ivar schemas: An array of URIs that indicate the schemas supported for this user resource + :ivar meta: + :ivar detail: A human-readable description of the error + :ivar scim_type: A scimType error code as defined in RFC7644 + :ivar status: Http status code + :ivar code: Twilio-specific error code + :ivar more_info: Link to Error Code References + """ + + def __init__(self, payload: Dict[str, Any]): + + self.id: Optional[str] = payload.get("id") + self.external_id: Optional[str] = payload.get("external_id") + self.user_name: Optional[str] = payload.get("user_name") + self.display_name: Optional[str] = payload.get("display_name") + self.name: Optional[UserList.ScimName] = payload.get("name") + self.emails: Optional[List[UserList.ScimEmailAddress]] = payload.get( + "emails" + ) + self.active: Optional[bool] = payload.get("active") + self.locale: Optional[str] = payload.get("locale") + self.timezone: Optional[str] = payload.get("timezone") + self.schemas: Optional[List[str]] = payload.get("schemas") + self.meta: Optional[UserList.ScimMeta] = payload.get("meta") + self.detail: Optional[str] = payload.get("detail") + self.scim_type: Optional[str] = payload.get("scim_type") + self.status: Optional[str] = payload.get("status") + self.code: Optional[int] = payload.get("code") + self.more_info: Optional[str] = payload.get("more_info") + + def to_dict(self): + return { + "id": self.id, + "externalId": self.external_id, + "userName": self.user_name, + "displayName": self.display_name, + "name": self.name.to_dict() if self.name is not None else None, + "emails": ( + [emails.to_dict() for emails in self.emails] + if self.emails is not None + else None + ), + "active": self.active, + "locale": self.locale, + "timezone": self.timezone, + "schemas": self.schemas, + "meta": self.meta.to_dict() if self.meta is not None else None, + "detail": self.detail, + "scimType": self.scim_type, + "status": self.status, + "code": self.code, + "moreInfo": self.more_info, + } + + """ + :ivar id: Unique Twilio user sid + :ivar external_id: External unique resource id defined by provisioning client + :ivar user_name: Unique username, MUST be same as primary email address + :ivar display_name: User friendly display name + :ivar name: + :ivar emails: Email address list of the user. Primary email must be defined if there are more than 1 email. Primary email must match the username. + :ivar active: Indicates whether the user is active + :ivar locale: User's locale + :ivar timezone: User's time zone + :ivar schemas: An array of URIs that indicate the schemas supported for this user resource + :ivar meta: + :ivar detail: A human-readable description of the error + :ivar scim_type: A scimType error code as defined in RFC7644 + :ivar status: Http status code + :ivar code: Twilio-specific error code + :ivar more_info: Link to Error Code References + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + organization_sid: Optional[str] = None, + user_sid: Optional[str] = None, + ): + super().__init__(version) + + self.id: Optional[str] = payload.get("id") + self.external_id: Optional[str] = payload.get("externalId") + self.user_name: Optional[str] = payload.get("userName") + self.display_name: Optional[str] = payload.get("displayName") + self.name: Optional[UserList.str] = payload.get("name") + self.emails: Optional[List[UserList.str]] = payload.get("emails") + self.active: Optional[bool] = payload.get("active") + self.locale: Optional[str] = payload.get("locale") + self.timezone: Optional[str] = payload.get("timezone") + self.schemas: Optional[List[str]] = payload.get("schemas") + self.meta: Optional[UserList.str] = payload.get("meta") + self.detail: Optional[str] = payload.get("detail") + self.scim_type: Optional[str] = payload.get("scimType") + self.status: Optional[str] = payload.get("status") + self.code: Optional[int] = payload.get("code") + self.more_info: Optional[str] = payload.get("moreInfo") + + self._solution = { + "organization_sid": organization_sid or self.organization_sid, + "user_sid": user_sid or self.user_sid, + } + self._context: Optional[UserContext] = None + + @property + def _proxy(self) -> "UserContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: UserContext for this UserInstance + """ + if self._context is None: + self._context = UserContext( + self._version, + organization_sid=self._solution["organization_sid"], + user_sid=self._solution["user_sid"], + ) + return self._context + + def delete(self) -> bool: + """ + Deletes the UserInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the UserInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def fetch(self) -> "UserInstance": + """ + Fetch the UserInstance + + + :returns: The fetched UserInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "UserInstance": + """ + Asynchronous coroutine to fetch the UserInstance + + + :returns: The fetched UserInstance + """ + return await self._proxy.fetch_async() + + def update( + self, scim_user: ScimUser, if_match: Union[str, object] = values.unset + ) -> "UserInstance": + """ + Update the UserInstance + + :param scim_user: + :param if_match: + + :returns: The updated UserInstance + """ + return self._proxy.update( + scim_user=scim_user, + if_match=if_match, + ) + + async def update_async( + self, scim_user: ScimUser, if_match: Union[str, object] = values.unset + ) -> "UserInstance": + """ + Asynchronous coroutine to update the UserInstance + + :param scim_user: + :param if_match: + + :returns: The updated UserInstance + """ + return await self._proxy.update_async( + scim_user=scim_user, + if_match=if_match, + ) + + 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 UserContext(InstanceContext): + + class ScimEmailAddress(object): + """ + :ivar primary: Indicates if this email address is the primary one + :ivar value: The actual email address value + :ivar type: The type of email address (e.g., work, home, etc.) + """ + + def __init__(self, payload: Dict[str, Any]): + + self.primary: Optional[bool] = payload.get("primary") + self.value: Optional[str] = payload.get("value") + self.type: Optional[str] = payload.get("type") + + def to_dict(self): + return { + "primary": self.primary, + "value": self.value, + "type": self.type, + } + + class ScimMeta(object): + """ + :ivar resource_type: Indicates the type of the resource + :ivar created: The date and time when the resource was created in the system + :ivar last_modified: The date and time when the resource was last modified + :ivar version: A version identifier for the resource. This can be used to manage resource versioning and concurrency control. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.resource_type: Optional[str] = payload.get("resource_type") + self.created: Optional[datetime] = payload.get("created") + self.last_modified: Optional[datetime] = payload.get("last_modified") + self.version: Optional[str] = payload.get("version") + + def to_dict(self): + return { + "resource_type": self.resource_type, + "created": self.created, + "last_modified": self.last_modified, + "version": self.version, + } + + class ScimName(object): + """ + :ivar given_name: The user's first or given name + :ivar family_name: The user's last or family name + """ + + def __init__(self, payload: Dict[str, Any]): + + self.given_name: Optional[str] = payload.get("given_name") + self.family_name: Optional[str] = payload.get("family_name") + + def to_dict(self): + return { + "given_name": self.given_name, + "family_name": self.family_name, + } + + class ScimUser(object): + """ + :ivar id: Unique Twilio user sid + :ivar external_id: External unique resource id defined by provisioning client + :ivar user_name: Unique username, MUST be same as primary email address + :ivar display_name: User friendly display name + :ivar name: + :ivar emails: Email address list of the user. Primary email must be defined if there are more than 1 email. Primary email must match the username. + :ivar active: Indicates whether the user is active + :ivar locale: User's locale + :ivar timezone: User's time zone + :ivar schemas: An array of URIs that indicate the schemas supported for this user resource + :ivar meta: + :ivar detail: A human-readable description of the error + :ivar scim_type: A scimType error code as defined in RFC7644 + :ivar status: Http status code + :ivar code: Twilio-specific error code + :ivar more_info: Link to Error Code References + """ + + def __init__(self, payload: Dict[str, Any]): + + self.id: Optional[str] = payload.get("id") + self.external_id: Optional[str] = payload.get("external_id") + self.user_name: Optional[str] = payload.get("user_name") + self.display_name: Optional[str] = payload.get("display_name") + self.name: Optional[UserList.ScimName] = payload.get("name") + self.emails: Optional[List[UserList.ScimEmailAddress]] = payload.get( + "emails" + ) + self.active: Optional[bool] = payload.get("active") + self.locale: Optional[str] = payload.get("locale") + self.timezone: Optional[str] = payload.get("timezone") + self.schemas: Optional[List[str]] = payload.get("schemas") + self.meta: Optional[UserList.ScimMeta] = payload.get("meta") + self.detail: Optional[str] = payload.get("detail") + self.scim_type: Optional[str] = payload.get("scim_type") + self.status: Optional[str] = payload.get("status") + self.code: Optional[int] = payload.get("code") + self.more_info: Optional[str] = payload.get("more_info") + + def to_dict(self): + return { + "id": self.id, + "externalId": self.external_id, + "userName": self.user_name, + "displayName": self.display_name, + "name": self.name.to_dict() if self.name is not None else None, + "emails": ( + [emails.to_dict() for emails in self.emails] + if self.emails is not None + else None + ), + "active": self.active, + "locale": self.locale, + "timezone": self.timezone, + "schemas": self.schemas, + "meta": self.meta.to_dict() if self.meta is not None else None, + "detail": self.detail, + "scimType": self.scim_type, + "status": self.status, + "code": self.code, + "moreInfo": self.more_info, + } + + def __init__(self, version: Version, organization_sid: str, user_sid: str): + """ + Initialize the UserContext + + :param version: Version that contains the resource + :param organization_sid: + :param user_sid: + """ + super().__init__(version) + + # Path Solution + self._solution = { + "organization_sid": organization_sid, + "user_sid": user_sid, + } + self._uri = "/{organization_sid}/scim/Users/{user_sid}".format(**self._solution) + + def delete(self) -> bool: + """ + Deletes the UserInstance + + + :returns: True if delete succeeds, False otherwise + """ + + headers = values.of({}) + + headers["Accept"] = "application/scim+json" + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the UserInstance + + + :returns: True if delete succeeds, False otherwise + """ + + headers = values.of({}) + + headers["Accept"] = "application/scim+json" + + return await self._version.delete_async( + method="DELETE", uri=self._uri, headers=headers + ) + + def fetch(self) -> UserInstance: + """ + Fetch the UserInstance + + + :returns: The fetched UserInstance + """ + + headers = values.of({}) + + headers["Accept"] = "application/scim+json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) + + return UserInstance( + self._version, + payload, + organization_sid=self._solution["organization_sid"], + user_sid=self._solution["user_sid"], + ) + + async def fetch_async(self) -> UserInstance: + """ + Asynchronous coroutine to fetch the UserInstance + + + :returns: The fetched UserInstance + """ + + headers = values.of({}) + + headers["Accept"] = "application/scim+json" + + payload = await self._version.fetch_async( + method="GET", uri=self._uri, headers=headers + ) + + return UserInstance( + self._version, + payload, + organization_sid=self._solution["organization_sid"], + user_sid=self._solution["user_sid"], + ) + + def update( + self, scim_user: ScimUser, if_match: Union[str, object] = values.unset + ) -> UserInstance: + """ + Update the UserInstance + + :param scim_user: + :param if_match: + + :returns: The updated UserInstance + """ + data = scim_user.to_dict() + + headers = values.of({}) + + if not ( + if_match is values.unset or (isinstance(if_match, str) and not if_match) + ): + headers["If-Match"] = if_match + + headers["Content-Type"] = "application/json" + + headers["Content-Type"] = "application/scim+json" + + headers["Accept"] = "application/scim+json" + + payload = self._version.update( + method="PUT", uri=self._uri, data=data, headers=headers + ) + + return UserInstance( + self._version, + payload, + organization_sid=self._solution["organization_sid"], + user_sid=self._solution["user_sid"], + ) + + async def update_async( + self, scim_user: ScimUser, if_match: Union[str, object] = values.unset + ) -> UserInstance: + """ + Asynchronous coroutine to update the UserInstance + + :param scim_user: + :param if_match: + + :returns: The updated UserInstance + """ + data = scim_user.to_dict() + + headers = values.of({}) + + if not ( + if_match is values.unset or (isinstance(if_match, str) and not if_match) + ): + headers["If-Match"] = if_match + + headers["Content-Type"] = "application/json" + + headers["Content-Type"] = "application/scim+json" + + headers["Accept"] = "application/scim+json" + + payload = await self._version.update_async( + method="PUT", uri=self._uri, data=data, headers=headers + ) + + return UserInstance( + self._version, + payload, + organization_sid=self._solution["organization_sid"], + user_sid=self._solution["user_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 UserPage(Page): + + def get_instance(self, payload: Dict[str, Any]) -> UserInstance: + """ + Build an instance of UserInstance + + :param payload: Payload response from the API + """ + return UserInstance( + self._version, payload, organization_sid=self._solution["organization_sid"] + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class UserList(ListResource): + + class ScimEmailAddress(object): + """ + :ivar primary: Indicates if this email address is the primary one + :ivar value: The actual email address value + :ivar type: The type of email address (e.g., work, home, etc.) + """ + + def __init__(self, payload: Dict[str, Any]): + + self.primary: Optional[bool] = payload.get("primary") + self.value: Optional[str] = payload.get("value") + self.type: Optional[str] = payload.get("type") + + def to_dict(self): + return { + "primary": self.primary, + "value": self.value, + "type": self.type, + } + + class ScimMeta(object): + """ + :ivar resource_type: Indicates the type of the resource + :ivar created: The date and time when the resource was created in the system + :ivar last_modified: The date and time when the resource was last modified + :ivar version: A version identifier for the resource. This can be used to manage resource versioning and concurrency control. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.resource_type: Optional[str] = payload.get("resource_type") + self.created: Optional[datetime] = payload.get("created") + self.last_modified: Optional[datetime] = payload.get("last_modified") + self.version: Optional[str] = payload.get("version") + + def to_dict(self): + return { + "resource_type": self.resource_type, + "created": self.created, + "last_modified": self.last_modified, + "version": self.version, + } + + class ScimName(object): + """ + :ivar given_name: The user's first or given name + :ivar family_name: The user's last or family name + """ + + def __init__(self, payload: Dict[str, Any]): + + self.given_name: Optional[str] = payload.get("given_name") + self.family_name: Optional[str] = payload.get("family_name") + + def to_dict(self): + return { + "given_name": self.given_name, + "family_name": self.family_name, + } + + class ScimUser(object): + """ + :ivar id: Unique Twilio user sid + :ivar external_id: External unique resource id defined by provisioning client + :ivar user_name: Unique username, MUST be same as primary email address + :ivar display_name: User friendly display name + :ivar name: + :ivar emails: Email address list of the user. Primary email must be defined if there are more than 1 email. Primary email must match the username. + :ivar active: Indicates whether the user is active + :ivar locale: User's locale + :ivar timezone: User's time zone + :ivar schemas: An array of URIs that indicate the schemas supported for this user resource + :ivar meta: + :ivar detail: A human-readable description of the error + :ivar scim_type: A scimType error code as defined in RFC7644 + :ivar status: Http status code + :ivar code: Twilio-specific error code + :ivar more_info: Link to Error Code References + """ + + def __init__(self, payload: Dict[str, Any]): + + self.id: Optional[str] = payload.get("id") + self.external_id: Optional[str] = payload.get("external_id") + self.user_name: Optional[str] = payload.get("user_name") + self.display_name: Optional[str] = payload.get("display_name") + self.name: Optional[UserList.ScimName] = payload.get("name") + self.emails: Optional[List[UserList.ScimEmailAddress]] = payload.get( + "emails" + ) + self.active: Optional[bool] = payload.get("active") + self.locale: Optional[str] = payload.get("locale") + self.timezone: Optional[str] = payload.get("timezone") + self.schemas: Optional[List[str]] = payload.get("schemas") + self.meta: Optional[UserList.ScimMeta] = payload.get("meta") + self.detail: Optional[str] = payload.get("detail") + self.scim_type: Optional[str] = payload.get("scim_type") + self.status: Optional[str] = payload.get("status") + self.code: Optional[int] = payload.get("code") + self.more_info: Optional[str] = payload.get("more_info") + + def to_dict(self): + return { + "id": self.id, + "externalId": self.external_id, + "userName": self.user_name, + "displayName": self.display_name, + "name": self.name.to_dict() if self.name is not None else None, + "emails": ( + [emails.to_dict() for emails in self.emails] + if self.emails is not None + else None + ), + "active": self.active, + "locale": self.locale, + "timezone": self.timezone, + "schemas": self.schemas, + "meta": self.meta.to_dict() if self.meta is not None else None, + "detail": self.detail, + "scimType": self.scim_type, + "status": self.status, + "code": self.code, + "moreInfo": self.more_info, + } + + def __init__(self, version: Version, organization_sid: str): + """ + Initialize the UserList + + :param version: Version that contains the resource + :param organization_sid: + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "organization_sid": organization_sid, + } + self._uri = "/{organization_sid}/scim/Users".format(**self._solution) + + def create(self, scim_user: ScimUser) -> UserInstance: + """ + Create the UserInstance + + :param scim_user: + + :returns: The created UserInstance + """ + data = scim_user.to_dict() + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/json" + + headers["Content-Type"] = "application/scim+json" + + headers["Accept"] = "application/scim+json" + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return UserInstance( + self._version, payload, organization_sid=self._solution["organization_sid"] + ) + + async def create_async(self, scim_user: ScimUser) -> UserInstance: + """ + Asynchronously create the UserInstance + + :param scim_user: + + :returns: The created UserInstance + """ + data = scim_user.to_dict() + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/json" + + headers["Content-Type"] = "application/scim+json" + + headers["Accept"] = "application/scim+json" + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return UserInstance( + self._version, payload, organization_sid=self._solution["organization_sid"] + ) + + def stream( + self, + filter: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[UserInstance]: + """ + Streams UserInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param str filter: + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = self.page(filter=filter, page_size=limits["page_size"]) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + filter: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[UserInstance]: + """ + Asynchronously streams UserInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param str filter: + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = await self.page_async(filter=filter, page_size=limits["page_size"]) + + return self._version.stream_async(page, limits["limit"]) + + def list( + self, + filter: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[UserInstance]: + """ + Lists UserInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str filter: + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return list( + self.stream( + filter=filter, + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + filter: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[UserInstance]: + """ + Asynchronously lists UserInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str filter: + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return [ + record + async for record in await self.stream_async( + filter=filter, + limit=limit, + page_size=page_size, + ) + ] + + def page( + self, + filter: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> UserPage: + """ + Retrieve a single page of UserInstance records from the API. + Request is executed immediately + + :param filter: + :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 + + :returns: Page of UserInstance + """ + data = values.of( + { + "filter": filter, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/scim+json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) + return UserPage(self._version, response, self._solution) + + async def page_async( + self, + filter: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> UserPage: + """ + Asynchronously retrieve a single page of UserInstance records from the API. + Request is executed immediately + + :param filter: + :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 + + :returns: Page of UserInstance + """ + data = values.of( + { + "filter": filter, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/scim+json" + + response = await self._version.page_async( + method="GET", uri=self._uri, params=data, headers=headers + ) + return UserPage(self._version, response, self._solution) + + def get_page(self, target_url: str) -> UserPage: + """ + Retrieve a specific page of UserInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of UserInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return UserPage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> UserPage: + """ + Asynchronously retrieve a specific page of UserInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of UserInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return UserPage(self._version, response, self._solution) + + def get(self, organization_sid: str, user_sid: str) -> UserContext: + """ + Constructs a UserContext + + :param organization_sid: + :param user_sid: + """ + return UserContext( + self._version, organization_sid=organization_sid, user_sid=user_sid + ) + + def __call__(self, organization_sid: str, user_sid: str) -> UserContext: + """ + Constructs a UserContext + + :param organization_sid: + :param user_sid: + """ + return UserContext( + self._version, organization_sid=organization_sid, user_sid=user_sid + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/preview_iam/v1/authorize.py b/twilio/rest/preview_iam/v1/authorize.py index 051f13a8e6..4166b4aea2 100644 --- a/twilio/rest/preview_iam/v1/authorize.py +++ b/twilio/rest/preview_iam/v1/authorize.py @@ -69,6 +69,8 @@ def fetch( """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Accept"] = "application/json" + params = values.of( { "response_type": response_type, @@ -101,6 +103,8 @@ async def fetch_async( """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Accept"] = "application/json" + params = values.of( { "response_type": response_type, diff --git a/twilio/rest/preview_iam/v1/token.py b/twilio/rest/preview_iam/v1/token.py index 81eed237f7..34d9f30080 100644 --- a/twilio/rest/preview_iam/v1/token.py +++ b/twilio/rest/preview_iam/v1/token.py @@ -101,6 +101,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -147,6 +151,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/pricing/v1/messaging/country.py b/twilio/rest/pricing/v1/messaging/country.py index 47f5707ce8..49360cd85c 100644 --- a/twilio/rest/pricing/v1/messaging/country.py +++ b/twilio/rest/pricing/v1/messaging/country.py @@ -121,10 +121,11 @@ def fetch(self) -> CountryInstance: :returns: The fetched CountryInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return CountryInstance( self._version, @@ -140,9 +141,12 @@ async def fetch_async(self) -> CountryInstance: :returns: The fetched CountryInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return CountryInstance( @@ -320,7 +324,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return CountryPage(self._version, response) async def page_async( @@ -347,8 +357,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return CountryPage(self._version, response) diff --git a/twilio/rest/pricing/v1/phone_number/country.py b/twilio/rest/pricing/v1/phone_number/country.py index b0822fff23..2d11cd1c3e 100644 --- a/twilio/rest/pricing/v1/phone_number/country.py +++ b/twilio/rest/pricing/v1/phone_number/country.py @@ -119,10 +119,11 @@ def fetch(self) -> CountryInstance: :returns: The fetched CountryInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return CountryInstance( self._version, @@ -138,9 +139,12 @@ async def fetch_async(self) -> CountryInstance: :returns: The fetched CountryInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return CountryInstance( @@ -318,7 +322,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return CountryPage(self._version, response) async def page_async( @@ -345,8 +355,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return CountryPage(self._version, response) diff --git a/twilio/rest/pricing/v1/voice/country.py b/twilio/rest/pricing/v1/voice/country.py index e3b1496de4..7fb0da883a 100644 --- a/twilio/rest/pricing/v1/voice/country.py +++ b/twilio/rest/pricing/v1/voice/country.py @@ -123,10 +123,11 @@ def fetch(self) -> CountryInstance: :returns: The fetched CountryInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return CountryInstance( self._version, @@ -142,9 +143,12 @@ async def fetch_async(self) -> CountryInstance: :returns: The fetched CountryInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return CountryInstance( @@ -322,7 +326,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return CountryPage(self._version, response) async def page_async( @@ -349,8 +359,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return CountryPage(self._version, response) diff --git a/twilio/rest/pricing/v1/voice/number.py b/twilio/rest/pricing/v1/voice/number.py index 910919707e..5bff8cd5d6 100644 --- a/twilio/rest/pricing/v1/voice/number.py +++ b/twilio/rest/pricing/v1/voice/number.py @@ -13,6 +13,7 @@ """ from typing import Any, Dict, Optional +from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -116,10 +117,11 @@ def fetch(self) -> NumberInstance: :returns: The fetched NumberInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return NumberInstance( self._version, @@ -135,9 +137,12 @@ async def fetch_async(self) -> NumberInstance: :returns: The fetched NumberInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return NumberInstance( diff --git a/twilio/rest/pricing/v2/country.py b/twilio/rest/pricing/v2/country.py index a058c071b5..30672235a8 100644 --- a/twilio/rest/pricing/v2/country.py +++ b/twilio/rest/pricing/v2/country.py @@ -123,10 +123,11 @@ def fetch(self) -> CountryInstance: :returns: The fetched CountryInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return CountryInstance( self._version, @@ -142,9 +143,12 @@ async def fetch_async(self) -> CountryInstance: :returns: The fetched CountryInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return CountryInstance( @@ -322,7 +326,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return CountryPage(self._version, response) async def page_async( @@ -349,8 +359,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return CountryPage(self._version, response) diff --git a/twilio/rest/pricing/v2/number.py b/twilio/rest/pricing/v2/number.py index 6c4cd9fe9d..1dead39347 100644 --- a/twilio/rest/pricing/v2/number.py +++ b/twilio/rest/pricing/v2/number.py @@ -145,7 +145,13 @@ def fetch( } ) - payload = self._version.fetch(method="GET", uri=self._uri, params=data) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch( + method="GET", uri=self._uri, params=data, headers=headers + ) return NumberInstance( self._version, @@ -170,8 +176,12 @@ async def fetch_async( } ) + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return NumberInstance( diff --git a/twilio/rest/pricing/v2/voice/country.py b/twilio/rest/pricing/v2/voice/country.py index 4a84bbd734..997f368462 100644 --- a/twilio/rest/pricing/v2/voice/country.py +++ b/twilio/rest/pricing/v2/voice/country.py @@ -123,10 +123,11 @@ def fetch(self) -> CountryInstance: :returns: The fetched CountryInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return CountryInstance( self._version, @@ -142,9 +143,12 @@ async def fetch_async(self) -> CountryInstance: :returns: The fetched CountryInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return CountryInstance( @@ -322,7 +326,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return CountryPage(self._version, response) async def page_async( @@ -349,8 +359,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return CountryPage(self._version, response) diff --git a/twilio/rest/pricing/v2/voice/number.py b/twilio/rest/pricing/v2/voice/number.py index 6dd8764821..97a3a526ff 100644 --- a/twilio/rest/pricing/v2/voice/number.py +++ b/twilio/rest/pricing/v2/voice/number.py @@ -143,7 +143,13 @@ def fetch( } ) - payload = self._version.fetch(method="GET", uri=self._uri, params=data) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch( + method="GET", uri=self._uri, params=data, headers=headers + ) return NumberInstance( self._version, @@ -168,8 +174,12 @@ async def fetch_async( } ) + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return NumberInstance( diff --git a/twilio/rest/proxy/v1/service/__init__.py b/twilio/rest/proxy/v1/service/__init__.py index 7337294a6c..ff1e7ed7d7 100644 --- a/twilio/rest/proxy/v1/service/__init__.py +++ b/twilio/rest/proxy/v1/service/__init__.py @@ -279,10 +279,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -291,9 +291,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> ServiceInstance: @@ -304,10 +306,11 @@ def fetch(self) -> ServiceInstance: :returns: The fetched ServiceInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ServiceInstance( self._version, @@ -323,9 +326,12 @@ async def fetch_async(self) -> ServiceInstance: :returns: The fetched ServiceInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ServiceInstance( @@ -361,6 +367,7 @@ def update( :returns: The updated ServiceInstance """ + data = values.of( { "UniqueName": unique_name, @@ -373,11 +380,14 @@ def update( "ChatInstanceSid": chat_instance_sid, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload, sid=self._solution["sid"]) @@ -409,6 +419,7 @@ async def update_async( :returns: The updated ServiceInstance """ + data = values.of( { "UniqueName": unique_name, @@ -421,11 +432,14 @@ async def update_async( "ChatInstanceSid": chat_instance_sid, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload, sid=self._solution["sid"]) @@ -550,6 +564,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -598,6 +616,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -731,7 +753,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ServicePage(self._version, response) async def page_async( @@ -758,8 +786,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ServicePage(self._version, response) diff --git a/twilio/rest/proxy/v1/service/phone_number.py b/twilio/rest/proxy/v1/service/phone_number.py index 05b9033602..3c8517cedd 100644 --- a/twilio/rest/proxy/v1/service/phone_number.py +++ b/twilio/rest/proxy/v1/service/phone_number.py @@ -188,10 +188,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -200,9 +200,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> PhoneNumberInstance: @@ -213,10 +215,11 @@ def fetch(self) -> PhoneNumberInstance: :returns: The fetched PhoneNumberInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return PhoneNumberInstance( self._version, @@ -233,9 +236,12 @@ async def fetch_async(self) -> PhoneNumberInstance: :returns: The fetched PhoneNumberInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return PhoneNumberInstance( @@ -255,16 +261,20 @@ def update( :returns: The updated PhoneNumberInstance """ + data = values.of( { "IsReserved": serialize.boolean_to_string(is_reserved), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return PhoneNumberInstance( @@ -284,16 +294,20 @@ async def update_async( :returns: The updated PhoneNumberInstance """ + data = values.of( { "IsReserved": serialize.boolean_to_string(is_reserved), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return PhoneNumberInstance( @@ -377,6 +391,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -410,6 +428,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -545,7 +567,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return PhoneNumberPage(self._version, response, self._solution) async def page_async( @@ -572,8 +600,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return PhoneNumberPage(self._version, response, self._solution) diff --git a/twilio/rest/proxy/v1/service/session/__init__.py b/twilio/rest/proxy/v1/service/session/__init__.py index cfd547b1e7..839db075c3 100644 --- a/twilio/rest/proxy/v1/service/session/__init__.py +++ b/twilio/rest/proxy/v1/service/session/__init__.py @@ -248,10 +248,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -260,9 +260,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> SessionInstance: @@ -273,10 +275,11 @@ def fetch(self) -> SessionInstance: :returns: The fetched SessionInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return SessionInstance( self._version, @@ -293,9 +296,12 @@ async def fetch_async(self) -> SessionInstance: :returns: The fetched SessionInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return SessionInstance( @@ -320,6 +326,7 @@ def update( :returns: The updated SessionInstance """ + data = values.of( { "DateExpiry": serialize.iso8601_datetime(date_expiry), @@ -327,11 +334,14 @@ def update( "Status": status, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SessionInstance( @@ -356,6 +366,7 @@ async def update_async( :returns: The updated SessionInstance """ + data = values.of( { "DateExpiry": serialize.iso8601_datetime(date_expiry), @@ -363,11 +374,14 @@ async def update_async( "Status": status, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SessionInstance( @@ -488,6 +502,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -532,6 +550,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -667,7 +689,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return SessionPage(self._version, response, self._solution) async def page_async( @@ -694,8 +722,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return SessionPage(self._version, response, self._solution) diff --git a/twilio/rest/proxy/v1/service/session/interaction.py b/twilio/rest/proxy/v1/service/session/interaction.py index 6e4cac7c14..7eeccda5bc 100644 --- a/twilio/rest/proxy/v1/service/session/interaction.py +++ b/twilio/rest/proxy/v1/service/session/interaction.py @@ -220,10 +220,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -232,9 +232,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> InteractionInstance: @@ -245,10 +247,11 @@ def fetch(self) -> InteractionInstance: :returns: The fetched InteractionInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return InteractionInstance( self._version, @@ -266,9 +269,12 @@ async def fetch_async(self) -> InteractionInstance: :returns: The fetched InteractionInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return InteractionInstance( @@ -464,7 +470,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return InteractionPage(self._version, response, self._solution) async def page_async( @@ -491,8 +503,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return InteractionPage(self._version, response, self._solution) diff --git a/twilio/rest/proxy/v1/service/session/participant/__init__.py b/twilio/rest/proxy/v1/service/session/participant/__init__.py index e2eb3eaae8..7ad20fcffb 100644 --- a/twilio/rest/proxy/v1/service/session/participant/__init__.py +++ b/twilio/rest/proxy/v1/service/session/participant/__init__.py @@ -183,10 +183,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -195,9 +195,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> ParticipantInstance: @@ -208,10 +210,11 @@ def fetch(self) -> ParticipantInstance: :returns: The fetched ParticipantInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ParticipantInstance( self._version, @@ -229,9 +232,12 @@ async def fetch_async(self) -> ParticipantInstance: :returns: The fetched ParticipantInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ParticipantInstance( @@ -342,6 +348,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -381,6 +391,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -519,7 +533,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ParticipantPage(self._version, response, self._solution) async def page_async( @@ -546,8 +566,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ParticipantPage(self._version, response, self._solution) diff --git a/twilio/rest/proxy/v1/service/session/participant/message_interaction.py b/twilio/rest/proxy/v1/service/session/participant/message_interaction.py index 55ff64074e..4ffe67965b 100644 --- a/twilio/rest/proxy/v1/service/session/participant/message_interaction.py +++ b/twilio/rest/proxy/v1/service/session/participant/message_interaction.py @@ -215,10 +215,11 @@ def fetch(self) -> MessageInteractionInstance: :returns: The fetched MessageInteractionInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return MessageInteractionInstance( self._version, @@ -237,9 +238,12 @@ async def fetch_async(self) -> MessageInteractionInstance: :returns: The fetched MessageInteractionInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return MessageInteractionInstance( @@ -334,6 +338,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -368,6 +376,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -507,7 +519,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return MessageInteractionPage(self._version, response, self._solution) async def page_async( @@ -534,8 +552,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return MessageInteractionPage(self._version, response, self._solution) diff --git a/twilio/rest/proxy/v1/service/short_code.py b/twilio/rest/proxy/v1/service/short_code.py index e26514bff2..df71d4bdd5 100644 --- a/twilio/rest/proxy/v1/service/short_code.py +++ b/twilio/rest/proxy/v1/service/short_code.py @@ -182,10 +182,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -194,9 +194,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> ShortCodeInstance: @@ -207,10 +209,11 @@ def fetch(self) -> ShortCodeInstance: :returns: The fetched ShortCodeInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ShortCodeInstance( self._version, @@ -227,9 +230,12 @@ async def fetch_async(self) -> ShortCodeInstance: :returns: The fetched ShortCodeInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ShortCodeInstance( @@ -249,16 +255,20 @@ def update( :returns: The updated ShortCodeInstance """ + data = values.of( { "IsReserved": serialize.boolean_to_string(is_reserved), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ShortCodeInstance( @@ -278,16 +288,20 @@ async def update_async( :returns: The updated ShortCodeInstance """ + data = values.of( { "IsReserved": serialize.boolean_to_string(is_reserved), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ShortCodeInstance( @@ -362,6 +376,10 @@ def create(self, sid: str) -> ShortCodeInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -386,6 +404,10 @@ async def create_async(self, sid: str) -> ShortCodeInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -521,7 +543,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ShortCodePage(self._version, response, self._solution) async def page_async( @@ -548,8 +576,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ShortCodePage(self._version, response, self._solution) diff --git a/twilio/rest/routes/v2/phone_number.py b/twilio/rest/routes/v2/phone_number.py index 4f452e3616..1b67509bb0 100644 --- a/twilio/rest/routes/v2/phone_number.py +++ b/twilio/rest/routes/v2/phone_number.py @@ -163,10 +163,11 @@ def fetch(self) -> PhoneNumberInstance: :returns: The fetched PhoneNumberInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return PhoneNumberInstance( self._version, @@ -182,9 +183,12 @@ async def fetch_async(self) -> PhoneNumberInstance: :returns: The fetched PhoneNumberInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return PhoneNumberInstance( @@ -206,17 +210,21 @@ def update( :returns: The updated PhoneNumberInstance """ + data = values.of( { "VoiceRegion": voice_region, "FriendlyName": friendly_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return PhoneNumberInstance( @@ -236,17 +244,21 @@ async def update_async( :returns: The updated PhoneNumberInstance """ + data = values.of( { "VoiceRegion": voice_region, "FriendlyName": friendly_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return PhoneNumberInstance( diff --git a/twilio/rest/routes/v2/sip_domain.py b/twilio/rest/routes/v2/sip_domain.py index cad3a4922c..2326a5dbc1 100644 --- a/twilio/rest/routes/v2/sip_domain.py +++ b/twilio/rest/routes/v2/sip_domain.py @@ -163,10 +163,11 @@ def fetch(self) -> SipDomainInstance: :returns: The fetched SipDomainInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return SipDomainInstance( self._version, @@ -182,9 +183,12 @@ async def fetch_async(self) -> SipDomainInstance: :returns: The fetched SipDomainInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return SipDomainInstance( @@ -206,17 +210,21 @@ def update( :returns: The updated SipDomainInstance """ + data = values.of( { "VoiceRegion": voice_region, "FriendlyName": friendly_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SipDomainInstance( @@ -236,17 +244,21 @@ async def update_async( :returns: The updated SipDomainInstance """ + data = values.of( { "VoiceRegion": voice_region, "FriendlyName": friendly_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SipDomainInstance( diff --git a/twilio/rest/routes/v2/trunk.py b/twilio/rest/routes/v2/trunk.py index 2baf2788ae..f783ce92ca 100644 --- a/twilio/rest/routes/v2/trunk.py +++ b/twilio/rest/routes/v2/trunk.py @@ -163,10 +163,11 @@ def fetch(self) -> TrunkInstance: :returns: The fetched TrunkInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return TrunkInstance( self._version, @@ -182,9 +183,12 @@ async def fetch_async(self) -> TrunkInstance: :returns: The fetched TrunkInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return TrunkInstance( @@ -206,17 +210,21 @@ def update( :returns: The updated TrunkInstance """ + data = values.of( { "VoiceRegion": voice_region, "FriendlyName": friendly_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return TrunkInstance( @@ -236,17 +244,21 @@ async def update_async( :returns: The updated TrunkInstance """ + data = values.of( { "VoiceRegion": voice_region, "FriendlyName": friendly_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return TrunkInstance( diff --git a/twilio/rest/serverless/v1/service/__init__.py b/twilio/rest/serverless/v1/service/__init__.py index 1658e671f4..f6e4e5841e 100644 --- a/twilio/rest/serverless/v1/service/__init__.py +++ b/twilio/rest/serverless/v1/service/__init__.py @@ -227,10 +227,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -239,9 +239,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> ServiceInstance: @@ -252,10 +254,11 @@ def fetch(self) -> ServiceInstance: :returns: The fetched ServiceInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ServiceInstance( self._version, @@ -271,9 +274,12 @@ async def fetch_async(self) -> ServiceInstance: :returns: The fetched ServiceInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ServiceInstance( @@ -297,6 +303,7 @@ def update( :returns: The updated ServiceInstance """ + data = values.of( { "IncludeCredentials": serialize.boolean_to_string(include_credentials), @@ -304,11 +311,14 @@ def update( "UiEditable": serialize.boolean_to_string(ui_editable), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload, sid=self._solution["sid"]) @@ -328,6 +338,7 @@ async def update_async( :returns: The updated ServiceInstance """ + data = values.of( { "IncludeCredentials": serialize.boolean_to_string(include_credentials), @@ -335,11 +346,14 @@ async def update_async( "UiEditable": serialize.boolean_to_string(ui_editable), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload, sid=self._solution["sid"]) @@ -462,6 +476,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -496,6 +514,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -629,7 +651,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ServicePage(self._version, response) async def page_async( @@ -656,8 +684,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ServicePage(self._version, response) diff --git a/twilio/rest/serverless/v1/service/asset/__init__.py b/twilio/rest/serverless/v1/service/asset/__init__.py index 4e413db1da..de68b969be 100644 --- a/twilio/rest/serverless/v1/service/asset/__init__.py +++ b/twilio/rest/serverless/v1/service/asset/__init__.py @@ -184,10 +184,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -196,9 +196,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> AssetInstance: @@ -209,10 +211,11 @@ def fetch(self) -> AssetInstance: :returns: The fetched AssetInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return AssetInstance( self._version, @@ -229,9 +232,12 @@ async def fetch_async(self) -> AssetInstance: :returns: The fetched AssetInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return AssetInstance( @@ -249,16 +255,20 @@ def update(self, friendly_name: str) -> AssetInstance: :returns: The updated AssetInstance """ + data = values.of( { "FriendlyName": friendly_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AssetInstance( @@ -276,16 +286,20 @@ async def update_async(self, friendly_name: str) -> AssetInstance: :returns: The updated AssetInstance """ + data = values.of( { "FriendlyName": friendly_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AssetInstance( @@ -373,6 +387,10 @@ def create(self, friendly_name: str) -> AssetInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -397,6 +415,10 @@ async def create_async(self, friendly_name: str) -> AssetInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -532,7 +554,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return AssetPage(self._version, response, self._solution) async def page_async( @@ -559,8 +587,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return AssetPage(self._version, response, self._solution) diff --git a/twilio/rest/serverless/v1/service/asset/asset_version.py b/twilio/rest/serverless/v1/service/asset/asset_version.py index fbe7b30800..31f85d4c29 100644 --- a/twilio/rest/serverless/v1/service/asset/asset_version.py +++ b/twilio/rest/serverless/v1/service/asset/asset_version.py @@ -146,10 +146,11 @@ def fetch(self) -> AssetVersionInstance: :returns: The fetched AssetVersionInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return AssetVersionInstance( self._version, @@ -167,9 +168,12 @@ async def fetch_async(self) -> AssetVersionInstance: :returns: The fetched AssetVersionInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return AssetVersionInstance( @@ -363,7 +367,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return AssetVersionPage(self._version, response, self._solution) async def page_async( @@ -390,8 +400,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return AssetVersionPage(self._version, response, self._solution) diff --git a/twilio/rest/serverless/v1/service/build/__init__.py b/twilio/rest/serverless/v1/service/build/__init__.py index 90e5ccec41..ddd59918b4 100644 --- a/twilio/rest/serverless/v1/service/build/__init__.py +++ b/twilio/rest/serverless/v1/service/build/__init__.py @@ -26,6 +26,7 @@ class BuildInstance(InstanceResource): + class Runtime(object): NODE8 = "node8" NODE10 = "node10" @@ -173,7 +174,13 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete(method='DELETE', uri=self._uri,) + + + headers = values.of({}) + + + + return self._version.delete(method='DELETE', uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -182,7 +189,12 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return await self._version.delete_async(method='DELETE', uri=self._uri,) + + headers = values.of({}) + + + + return await self._version.delete_async(method='DELETE', uri=self._uri, headers=headers) def fetch(self) -> BuildInstance: @@ -193,7 +205,13 @@ def fetch(self) -> BuildInstance: :returns: The fetched BuildInstance """ - payload = self._version.fetch(method='GET', uri=self._uri, ) + + headers = values.of({}) + + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method='GET', uri=self._uri , headers=headers) return BuildInstance( self._version, @@ -211,7 +229,13 @@ async def fetch_async(self) -> BuildInstance: :returns: The fetched BuildInstance """ - payload = await self._version.fetch_async(method='GET', uri=self._uri, ) + + headers = values.of({}) + + + headers["Accept"] = "application/json" + + payload = await self._version.fetch_async(method='GET', uri=self._uri , headers=headers) return BuildInstance( self._version, @@ -317,6 +341,11 @@ def create(self, asset_versions: Union[List[str], object]=values.unset, function 'Content-Type': 'application/x-www-form-urlencoded' }) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + + headers["Accept"] = "application/json" + payload = self._version.create(method='POST', uri=self._uri, data=data, headers=headers) @@ -344,6 +373,11 @@ async def create_async(self, asset_versions: Union[List[str], object]=values.uns 'Content-Type': 'application/x-www-form-urlencoded' }) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + + headers["Accept"] = "application/json" + payload = await self._version.create_async(method='POST', uri=self._uri, data=data, headers=headers) @@ -474,7 +508,15 @@ def page(self, 'PageSize': page_size, }) - response = self._version.page(method='GET', uri=self._uri, params=data) + headers = values.of({ + 'Content-Type': 'application/x-www-form-urlencoded' + }) + + + headers["Accept"] = "application/json" + + + response = self._version.page(method='GET', uri=self._uri, params=data, headers=headers) return BuildPage(self._version, response, self._solution) async def page_async(self, @@ -499,7 +541,15 @@ async def page_async(self, 'PageSize': page_size, }) - response = await self._version.page_async(method='GET', uri=self._uri, params=data) + headers = values.of({ + 'Content-Type': 'application/x-www-form-urlencoded' + }) + + + headers["Accept"] = "application/json" + + + response = await self._version.page_async(method='GET', uri=self._uri, params=data, headers=headers) return BuildPage(self._version, response, self._solution) def get_page(self, target_url: str) -> BuildPage: diff --git a/twilio/rest/serverless/v1/service/build/build_status.py b/twilio/rest/serverless/v1/service/build/build_status.py index 2613ae3cb6..e67c00e00e 100644 --- a/twilio/rest/serverless/v1/service/build/build_status.py +++ b/twilio/rest/serverless/v1/service/build/build_status.py @@ -14,6 +14,7 @@ from typing import Any, Dict, Optional +from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -23,6 +24,7 @@ class BuildStatusInstance(InstanceResource): + class Status(object): BUILDING = "building" COMPLETED = "completed" @@ -123,7 +125,13 @@ def fetch(self) -> BuildStatusInstance: :returns: The fetched BuildStatusInstance """ - payload = self._version.fetch(method='GET', uri=self._uri, ) + + headers = values.of({}) + + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method='GET', uri=self._uri , headers=headers) return BuildStatusInstance( self._version, @@ -141,7 +149,13 @@ async def fetch_async(self) -> BuildStatusInstance: :returns: The fetched BuildStatusInstance """ - payload = await self._version.fetch_async(method='GET', uri=self._uri, ) + + headers = values.of({}) + + + headers["Accept"] = "application/json" + + payload = await self._version.fetch_async(method='GET', uri=self._uri , headers=headers) return BuildStatusInstance( self._version, diff --git a/twilio/rest/serverless/v1/service/environment/__init__.py b/twilio/rest/serverless/v1/service/environment/__init__.py index e9df6ecb2a..cdad0504a7 100644 --- a/twilio/rest/serverless/v1/service/environment/__init__.py +++ b/twilio/rest/serverless/v1/service/environment/__init__.py @@ -186,10 +186,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -198,9 +198,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> EnvironmentInstance: @@ -211,10 +213,11 @@ def fetch(self) -> EnvironmentInstance: :returns: The fetched EnvironmentInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return EnvironmentInstance( self._version, @@ -231,9 +234,12 @@ async def fetch_async(self) -> EnvironmentInstance: :returns: The fetched EnvironmentInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return EnvironmentInstance( @@ -351,6 +357,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -379,6 +389,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -514,7 +528,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return EnvironmentPage(self._version, response, self._solution) async def page_async( @@ -541,8 +561,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return EnvironmentPage(self._version, response, self._solution) diff --git a/twilio/rest/serverless/v1/service/environment/deployment.py b/twilio/rest/serverless/v1/service/environment/deployment.py index e9d86d0c37..d28a4b8db1 100644 --- a/twilio/rest/serverless/v1/service/environment/deployment.py +++ b/twilio/rest/serverless/v1/service/environment/deployment.py @@ -142,10 +142,11 @@ def fetch(self) -> DeploymentInstance: :returns: The fetched DeploymentInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return DeploymentInstance( self._version, @@ -163,9 +164,12 @@ async def fetch_async(self) -> DeploymentInstance: :returns: The fetched DeploymentInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return DeploymentInstance( @@ -256,6 +260,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -289,6 +297,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -427,7 +439,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return DeploymentPage(self._version, response, self._solution) async def page_async( @@ -454,8 +472,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return DeploymentPage(self._version, response, self._solution) diff --git a/twilio/rest/serverless/v1/service/environment/log.py b/twilio/rest/serverless/v1/service/environment/log.py index e1aff5214f..a3c9a6c2da 100644 --- a/twilio/rest/serverless/v1/service/environment/log.py +++ b/twilio/rest/serverless/v1/service/environment/log.py @@ -156,10 +156,11 @@ def fetch(self) -> LogInstance: :returns: The fetched LogInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return LogInstance( self._version, @@ -177,9 +178,12 @@ async def fetch_async(self) -> LogInstance: :returns: The fetched LogInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return LogInstance( @@ -424,7 +428,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return LogPage(self._version, response, self._solution) async def page_async( @@ -460,8 +470,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return LogPage(self._version, response, self._solution) diff --git a/twilio/rest/serverless/v1/service/environment/variable.py b/twilio/rest/serverless/v1/service/environment/variable.py index 99027536f3..fbc6b48ac8 100644 --- a/twilio/rest/serverless/v1/service/environment/variable.py +++ b/twilio/rest/serverless/v1/service/environment/variable.py @@ -197,10 +197,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -209,9 +209,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> VariableInstance: @@ -222,10 +224,11 @@ def fetch(self) -> VariableInstance: :returns: The fetched VariableInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return VariableInstance( self._version, @@ -243,9 +246,12 @@ async def fetch_async(self) -> VariableInstance: :returns: The fetched VariableInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return VariableInstance( @@ -269,17 +275,21 @@ def update( :returns: The updated VariableInstance """ + data = values.of( { "Key": key, "Value": value, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return VariableInstance( @@ -303,17 +313,21 @@ async def update_async( :returns: The updated VariableInstance """ + data = values.of( { "Key": key, "Value": value, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return VariableInstance( @@ -400,6 +414,10 @@ def create(self, key: str, value: str) -> VariableInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -429,6 +447,10 @@ async def create_async(self, key: str, value: str) -> VariableInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -567,7 +589,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return VariablePage(self._version, response, self._solution) async def page_async( @@ -594,8 +622,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return VariablePage(self._version, response, self._solution) diff --git a/twilio/rest/serverless/v1/service/function/__init__.py b/twilio/rest/serverless/v1/service/function/__init__.py index 25a3ef935f..7697587e60 100644 --- a/twilio/rest/serverless/v1/service/function/__init__.py +++ b/twilio/rest/serverless/v1/service/function/__init__.py @@ -186,10 +186,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -198,9 +198,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> FunctionInstance: @@ -211,10 +213,11 @@ def fetch(self) -> FunctionInstance: :returns: The fetched FunctionInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return FunctionInstance( self._version, @@ -231,9 +234,12 @@ async def fetch_async(self) -> FunctionInstance: :returns: The fetched FunctionInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return FunctionInstance( @@ -251,16 +257,20 @@ def update(self, friendly_name: str) -> FunctionInstance: :returns: The updated FunctionInstance """ + data = values.of( { "FriendlyName": friendly_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return FunctionInstance( @@ -278,16 +288,20 @@ async def update_async(self, friendly_name: str) -> FunctionInstance: :returns: The updated FunctionInstance """ + data = values.of( { "FriendlyName": friendly_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return FunctionInstance( @@ -375,6 +389,10 @@ def create(self, friendly_name: str) -> FunctionInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -399,6 +417,10 @@ async def create_async(self, friendly_name: str) -> FunctionInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -534,7 +556,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return FunctionPage(self._version, response, self._solution) async def page_async( @@ -561,8 +589,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return FunctionPage(self._version, response, self._solution) diff --git a/twilio/rest/serverless/v1/service/function/function_version/__init__.py b/twilio/rest/serverless/v1/service/function/function_version/__init__.py index e915894f11..88b666208c 100644 --- a/twilio/rest/serverless/v1/service/function/function_version/__init__.py +++ b/twilio/rest/serverless/v1/service/function/function_version/__init__.py @@ -162,10 +162,11 @@ def fetch(self) -> FunctionVersionInstance: :returns: The fetched FunctionVersionInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return FunctionVersionInstance( self._version, @@ -183,9 +184,12 @@ async def fetch_async(self) -> FunctionVersionInstance: :returns: The fetched FunctionVersionInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return FunctionVersionInstance( @@ -393,7 +397,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return FunctionVersionPage(self._version, response, self._solution) async def page_async( @@ -420,8 +430,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return FunctionVersionPage(self._version, response, self._solution) diff --git a/twilio/rest/serverless/v1/service/function/function_version/function_version_content.py b/twilio/rest/serverless/v1/service/function/function_version/function_version_content.py index c58fa574e7..f16833da2a 100644 --- a/twilio/rest/serverless/v1/service/function/function_version/function_version_content.py +++ b/twilio/rest/serverless/v1/service/function/function_version/function_version_content.py @@ -13,6 +13,7 @@ """ from typing import Any, Dict, Optional +from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -131,10 +132,11 @@ def fetch(self) -> FunctionVersionContentInstance: :returns: The fetched FunctionVersionContentInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return FunctionVersionContentInstance( self._version, @@ -152,9 +154,12 @@ async def fetch_async(self) -> FunctionVersionContentInstance: :returns: The fetched FunctionVersionContentInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return FunctionVersionContentInstance( diff --git a/twilio/rest/studio/v1/flow/__init__.py b/twilio/rest/studio/v1/flow/__init__.py index bb0f78658b..533c1a45f5 100644 --- a/twilio/rest/studio/v1/flow/__init__.py +++ b/twilio/rest/studio/v1/flow/__init__.py @@ -168,10 +168,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -180,9 +180,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> FlowInstance: @@ -193,10 +195,11 @@ def fetch(self) -> FlowInstance: :returns: The fetched FlowInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return FlowInstance( self._version, @@ -212,9 +215,12 @@ async def fetch_async(self) -> FlowInstance: :returns: The fetched FlowInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return FlowInstance( @@ -416,7 +422,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return FlowPage(self._version, response) async def page_async( @@ -443,8 +455,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return FlowPage(self._version, response) diff --git a/twilio/rest/studio/v1/flow/engagement/__init__.py b/twilio/rest/studio/v1/flow/engagement/__init__.py index db0c846e5c..759d92506c 100644 --- a/twilio/rest/studio/v1/flow/engagement/__init__.py +++ b/twilio/rest/studio/v1/flow/engagement/__init__.py @@ -184,10 +184,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -196,9 +196,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> EngagementInstance: @@ -209,10 +211,11 @@ def fetch(self) -> EngagementInstance: :returns: The fetched EngagementInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return EngagementInstance( self._version, @@ -229,9 +232,12 @@ async def fetch_async(self) -> EngagementInstance: :returns: The fetched EngagementInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return EngagementInstance( @@ -338,6 +344,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -368,6 +378,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -503,7 +517,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return EngagementPage(self._version, response, self._solution) async def page_async( @@ -530,8 +550,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return EngagementPage(self._version, response, self._solution) diff --git a/twilio/rest/studio/v1/flow/engagement/engagement_context.py b/twilio/rest/studio/v1/flow/engagement/engagement_context.py index f534db6922..73161011eb 100644 --- a/twilio/rest/studio/v1/flow/engagement/engagement_context.py +++ b/twilio/rest/studio/v1/flow/engagement/engagement_context.py @@ -13,6 +13,7 @@ """ from typing import Any, Dict, Optional +from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -122,10 +123,11 @@ def fetch(self) -> EngagementContextInstance: :returns: The fetched EngagementContextInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return EngagementContextInstance( self._version, @@ -142,9 +144,12 @@ async def fetch_async(self) -> EngagementContextInstance: :returns: The fetched EngagementContextInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return EngagementContextInstance( diff --git a/twilio/rest/studio/v1/flow/engagement/step/__init__.py b/twilio/rest/studio/v1/flow/engagement/step/__init__.py index 1a2d8570c9..d88d0ad0f6 100644 --- a/twilio/rest/studio/v1/flow/engagement/step/__init__.py +++ b/twilio/rest/studio/v1/flow/engagement/step/__init__.py @@ -158,10 +158,11 @@ def fetch(self) -> StepInstance: :returns: The fetched StepInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return StepInstance( self._version, @@ -179,9 +180,12 @@ async def fetch_async(self) -> StepInstance: :returns: The fetched StepInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return StepInstance( @@ -389,7 +393,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return StepPage(self._version, response, self._solution) async def page_async( @@ -416,8 +426,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return StepPage(self._version, response, self._solution) diff --git a/twilio/rest/studio/v1/flow/engagement/step/step_context.py b/twilio/rest/studio/v1/flow/engagement/step/step_context.py index 69c4c22465..6b299ebe5d 100644 --- a/twilio/rest/studio/v1/flow/engagement/step/step_context.py +++ b/twilio/rest/studio/v1/flow/engagement/step/step_context.py @@ -13,6 +13,7 @@ """ from typing import Any, Dict, Optional +from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -131,10 +132,11 @@ def fetch(self) -> StepContextInstance: :returns: The fetched StepContextInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return StepContextInstance( self._version, @@ -152,9 +154,12 @@ async def fetch_async(self) -> StepContextInstance: :returns: The fetched StepContextInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return StepContextInstance( diff --git a/twilio/rest/studio/v1/flow/execution/__init__.py b/twilio/rest/studio/v1/flow/execution/__init__.py index 6a32cb3020..624b381768 100644 --- a/twilio/rest/studio/v1/flow/execution/__init__.py +++ b/twilio/rest/studio/v1/flow/execution/__init__.py @@ -208,10 +208,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -220,9 +220,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> ExecutionInstance: @@ -233,10 +235,11 @@ def fetch(self) -> ExecutionInstance: :returns: The fetched ExecutionInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ExecutionInstance( self._version, @@ -253,9 +256,12 @@ async def fetch_async(self) -> ExecutionInstance: :returns: The fetched ExecutionInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ExecutionInstance( @@ -273,16 +279,20 @@ def update(self, status: "ExecutionInstance.Status") -> ExecutionInstance: :returns: The updated ExecutionInstance """ + data = values.of( { "Status": status, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ExecutionInstance( @@ -302,16 +312,20 @@ async def update_async( :returns: The updated ExecutionInstance """ + data = values.of( { "Status": status, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ExecutionInstance( @@ -418,6 +432,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -448,6 +466,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -617,7 +639,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ExecutionPage(self._version, response, self._solution) async def page_async( @@ -650,8 +678,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ExecutionPage(self._version, response, self._solution) diff --git a/twilio/rest/studio/v1/flow/execution/execution_context.py b/twilio/rest/studio/v1/flow/execution/execution_context.py index a2765bbc9b..0841a9ef24 100644 --- a/twilio/rest/studio/v1/flow/execution/execution_context.py +++ b/twilio/rest/studio/v1/flow/execution/execution_context.py @@ -13,6 +13,7 @@ """ from typing import Any, Dict, Optional +from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -122,10 +123,11 @@ def fetch(self) -> ExecutionContextInstance: :returns: The fetched ExecutionContextInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ExecutionContextInstance( self._version, @@ -142,9 +144,12 @@ async def fetch_async(self) -> ExecutionContextInstance: :returns: The fetched ExecutionContextInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ExecutionContextInstance( diff --git a/twilio/rest/studio/v1/flow/execution/execution_step/__init__.py b/twilio/rest/studio/v1/flow/execution/execution_step/__init__.py index 6e19ca4453..888506e965 100644 --- a/twilio/rest/studio/v1/flow/execution/execution_step/__init__.py +++ b/twilio/rest/studio/v1/flow/execution/execution_step/__init__.py @@ -160,10 +160,11 @@ def fetch(self) -> ExecutionStepInstance: :returns: The fetched ExecutionStepInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ExecutionStepInstance( self._version, @@ -181,9 +182,12 @@ async def fetch_async(self) -> ExecutionStepInstance: :returns: The fetched ExecutionStepInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ExecutionStepInstance( @@ -391,7 +395,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ExecutionStepPage(self._version, response, self._solution) async def page_async( @@ -418,8 +428,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ExecutionStepPage(self._version, response, self._solution) diff --git a/twilio/rest/studio/v1/flow/execution/execution_step/execution_step_context.py b/twilio/rest/studio/v1/flow/execution/execution_step/execution_step_context.py index 224f92d0f5..78249a9562 100644 --- a/twilio/rest/studio/v1/flow/execution/execution_step/execution_step_context.py +++ b/twilio/rest/studio/v1/flow/execution/execution_step/execution_step_context.py @@ -13,6 +13,7 @@ """ from typing import Any, Dict, Optional +from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -131,10 +132,11 @@ def fetch(self) -> ExecutionStepContextInstance: :returns: The fetched ExecutionStepContextInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ExecutionStepContextInstance( self._version, @@ -152,9 +154,12 @@ async def fetch_async(self) -> ExecutionStepContextInstance: :returns: The fetched ExecutionStepContextInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ExecutionStepContextInstance( diff --git a/twilio/rest/studio/v2/flow/__init__.py b/twilio/rest/studio/v2/flow/__init__.py index 057c949696..b4c542fdc0 100644 --- a/twilio/rest/studio/v2/flow/__init__.py +++ b/twilio/rest/studio/v2/flow/__init__.py @@ -237,10 +237,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -249,9 +249,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> FlowInstance: @@ -262,10 +264,11 @@ def fetch(self) -> FlowInstance: :returns: The fetched FlowInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return FlowInstance( self._version, @@ -281,9 +284,12 @@ async def fetch_async(self) -> FlowInstance: :returns: The fetched FlowInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return FlowInstance( @@ -309,6 +315,7 @@ def update( :returns: The updated FlowInstance """ + data = values.of( { "Status": status, @@ -317,11 +324,14 @@ def update( "CommitMessage": commit_message, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return FlowInstance(self._version, payload, sid=self._solution["sid"]) @@ -343,6 +353,7 @@ async def update_async( :returns: The updated FlowInstance """ + data = values.of( { "Status": status, @@ -351,11 +362,14 @@ async def update_async( "CommitMessage": commit_message, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return FlowInstance(self._version, payload, sid=self._solution["sid"]) @@ -466,6 +480,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -500,6 +518,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -633,7 +655,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return FlowPage(self._version, response) async def page_async( @@ -660,8 +688,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return FlowPage(self._version, response) diff --git a/twilio/rest/studio/v2/flow/execution/__init__.py b/twilio/rest/studio/v2/flow/execution/__init__.py index 18dcbf0629..c47a3fbbc0 100644 --- a/twilio/rest/studio/v2/flow/execution/__init__.py +++ b/twilio/rest/studio/v2/flow/execution/__init__.py @@ -206,10 +206,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -218,9 +218,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> ExecutionInstance: @@ -231,10 +233,11 @@ def fetch(self) -> ExecutionInstance: :returns: The fetched ExecutionInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ExecutionInstance( self._version, @@ -251,9 +254,12 @@ async def fetch_async(self) -> ExecutionInstance: :returns: The fetched ExecutionInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ExecutionInstance( @@ -271,16 +277,20 @@ def update(self, status: "ExecutionInstance.Status") -> ExecutionInstance: :returns: The updated ExecutionInstance """ + data = values.of( { "Status": status, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ExecutionInstance( @@ -300,16 +310,20 @@ async def update_async( :returns: The updated ExecutionInstance """ + data = values.of( { "Status": status, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ExecutionInstance( @@ -416,6 +430,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -446,6 +464,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -615,7 +637,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ExecutionPage(self._version, response, self._solution) async def page_async( @@ -648,8 +676,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ExecutionPage(self._version, response, self._solution) diff --git a/twilio/rest/studio/v2/flow/execution/execution_context.py b/twilio/rest/studio/v2/flow/execution/execution_context.py index facb52eed7..4c18f81d11 100644 --- a/twilio/rest/studio/v2/flow/execution/execution_context.py +++ b/twilio/rest/studio/v2/flow/execution/execution_context.py @@ -13,6 +13,7 @@ """ from typing import Any, Dict, Optional +from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -122,10 +123,11 @@ def fetch(self) -> ExecutionContextInstance: :returns: The fetched ExecutionContextInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ExecutionContextInstance( self._version, @@ -142,9 +144,12 @@ async def fetch_async(self) -> ExecutionContextInstance: :returns: The fetched ExecutionContextInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ExecutionContextInstance( diff --git a/twilio/rest/studio/v2/flow/execution/execution_step/__init__.py b/twilio/rest/studio/v2/flow/execution/execution_step/__init__.py index 257e16b1df..b088aeab0e 100644 --- a/twilio/rest/studio/v2/flow/execution/execution_step/__init__.py +++ b/twilio/rest/studio/v2/flow/execution/execution_step/__init__.py @@ -160,10 +160,11 @@ def fetch(self) -> ExecutionStepInstance: :returns: The fetched ExecutionStepInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ExecutionStepInstance( self._version, @@ -181,9 +182,12 @@ async def fetch_async(self) -> ExecutionStepInstance: :returns: The fetched ExecutionStepInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ExecutionStepInstance( @@ -391,7 +395,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ExecutionStepPage(self._version, response, self._solution) async def page_async( @@ -418,8 +428,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ExecutionStepPage(self._version, response, self._solution) diff --git a/twilio/rest/studio/v2/flow/execution/execution_step/execution_step_context.py b/twilio/rest/studio/v2/flow/execution/execution_step/execution_step_context.py index 41661238b5..7f00e0d180 100644 --- a/twilio/rest/studio/v2/flow/execution/execution_step/execution_step_context.py +++ b/twilio/rest/studio/v2/flow/execution/execution_step/execution_step_context.py @@ -13,6 +13,7 @@ """ from typing import Any, Dict, Optional +from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -131,10 +132,11 @@ def fetch(self) -> ExecutionStepContextInstance: :returns: The fetched ExecutionStepContextInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ExecutionStepContextInstance( self._version, @@ -152,9 +154,12 @@ async def fetch_async(self) -> ExecutionStepContextInstance: :returns: The fetched ExecutionStepContextInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ExecutionStepContextInstance( diff --git a/twilio/rest/studio/v2/flow/flow_revision.py b/twilio/rest/studio/v2/flow/flow_revision.py index 0de91513ed..aa065074d1 100644 --- a/twilio/rest/studio/v2/flow/flow_revision.py +++ b/twilio/rest/studio/v2/flow/flow_revision.py @@ -146,10 +146,11 @@ def fetch(self) -> FlowRevisionInstance: :returns: The fetched FlowRevisionInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return FlowRevisionInstance( self._version, @@ -166,9 +167,12 @@ async def fetch_async(self) -> FlowRevisionInstance: :returns: The fetched FlowRevisionInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return FlowRevisionInstance( @@ -352,7 +356,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return FlowRevisionPage(self._version, response, self._solution) async def page_async( @@ -379,8 +389,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return FlowRevisionPage(self._version, response, self._solution) diff --git a/twilio/rest/studio/v2/flow/flow_test_user.py b/twilio/rest/studio/v2/flow/flow_test_user.py index 3465632353..cff41cd7e2 100644 --- a/twilio/rest/studio/v2/flow/flow_test_user.py +++ b/twilio/rest/studio/v2/flow/flow_test_user.py @@ -131,10 +131,11 @@ def fetch(self) -> FlowTestUserInstance: :returns: The fetched FlowTestUserInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return FlowTestUserInstance( self._version, @@ -150,9 +151,12 @@ async def fetch_async(self) -> FlowTestUserInstance: :returns: The fetched FlowTestUserInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return FlowTestUserInstance( @@ -169,16 +173,20 @@ def update(self, test_users: List[str]) -> FlowTestUserInstance: :returns: The updated FlowTestUserInstance """ + data = values.of( { "TestUsers": serialize.map(test_users, lambda e: e), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return FlowTestUserInstance(self._version, payload, sid=self._solution["sid"]) @@ -191,16 +199,20 @@ async def update_async(self, test_users: List[str]) -> FlowTestUserInstance: :returns: The updated FlowTestUserInstance """ + data = values.of( { "TestUsers": serialize.map(test_users, lambda e: e), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return FlowTestUserInstance(self._version, payload, sid=self._solution["sid"]) diff --git a/twilio/rest/studio/v2/flow_validate.py b/twilio/rest/studio/v2/flow_validate.py index 34f37e152f..5f8b308547 100644 --- a/twilio/rest/studio/v2/flow_validate.py +++ b/twilio/rest/studio/v2/flow_validate.py @@ -86,6 +86,10 @@ def update( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.update( method="POST", uri=self._uri, data=data, headers=headers ) @@ -120,6 +124,10 @@ async def update_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.update_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/supersim/v1/esim_profile.py b/twilio/rest/supersim/v1/esim_profile.py index 7e176bba7f..d12bb9b73f 100644 --- a/twilio/rest/supersim/v1/esim_profile.py +++ b/twilio/rest/supersim/v1/esim_profile.py @@ -146,10 +146,11 @@ def fetch(self) -> EsimProfileInstance: :returns: The fetched EsimProfileInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return EsimProfileInstance( self._version, @@ -165,9 +166,12 @@ async def fetch_async(self) -> EsimProfileInstance: :returns: The fetched EsimProfileInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return EsimProfileInstance( @@ -246,6 +250,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -280,6 +288,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -456,7 +468,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return EsimProfilePage(self._version, response) async def page_async( @@ -492,8 +510,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return EsimProfilePage(self._version, response) diff --git a/twilio/rest/supersim/v1/fleet.py b/twilio/rest/supersim/v1/fleet.py index 2b9fbff44e..3ea067cff2 100644 --- a/twilio/rest/supersim/v1/fleet.py +++ b/twilio/rest/supersim/v1/fleet.py @@ -213,10 +213,11 @@ def fetch(self) -> FleetInstance: :returns: The fetched FleetInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return FleetInstance( self._version, @@ -232,9 +233,12 @@ async def fetch_async(self) -> FleetInstance: :returns: The fetched FleetInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return FleetInstance( @@ -266,6 +270,7 @@ def update( :returns: The updated FleetInstance """ + data = values.of( { "UniqueName": unique_name, @@ -277,11 +282,14 @@ def update( "DataLimit": data_limit, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return FleetInstance(self._version, payload, sid=self._solution["sid"]) @@ -309,6 +317,7 @@ async def update_async( :returns: The updated FleetInstance """ + data = values.of( { "UniqueName": unique_name, @@ -320,11 +329,14 @@ async def update_async( "DataLimit": data_limit, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return FleetInstance(self._version, payload, sid=self._solution["sid"]) @@ -414,6 +426,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -463,6 +479,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -613,7 +633,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return FleetPage(self._version, response) async def page_async( @@ -643,8 +669,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return FleetPage(self._version, response) diff --git a/twilio/rest/supersim/v1/ip_command.py b/twilio/rest/supersim/v1/ip_command.py index db6ac26432..72bf78297f 100644 --- a/twilio/rest/supersim/v1/ip_command.py +++ b/twilio/rest/supersim/v1/ip_command.py @@ -156,10 +156,11 @@ def fetch(self) -> IpCommandInstance: :returns: The fetched IpCommandInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return IpCommandInstance( self._version, @@ -175,9 +176,12 @@ async def fetch_async(self) -> IpCommandInstance: :returns: The fetched IpCommandInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return IpCommandInstance( @@ -262,6 +266,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -302,6 +310,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -499,7 +511,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return IpCommandPage(self._version, response) async def page_async( @@ -538,8 +556,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return IpCommandPage(self._version, response) diff --git a/twilio/rest/supersim/v1/network.py b/twilio/rest/supersim/v1/network.py index 0d4f6a94fd..211068d075 100644 --- a/twilio/rest/supersim/v1/network.py +++ b/twilio/rest/supersim/v1/network.py @@ -114,10 +114,11 @@ def fetch(self) -> NetworkInstance: :returns: The fetched NetworkInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return NetworkInstance( self._version, @@ -133,9 +134,12 @@ async def fetch_async(self) -> NetworkInstance: :returns: The fetched NetworkInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return NetworkInstance( @@ -356,7 +360,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return NetworkPage(self._version, response) async def page_async( @@ -392,8 +402,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return NetworkPage(self._version, response) diff --git a/twilio/rest/supersim/v1/network_access_profile/__init__.py b/twilio/rest/supersim/v1/network_access_profile/__init__.py index 4937ac50dd..15b0cc5695 100644 --- a/twilio/rest/supersim/v1/network_access_profile/__init__.py +++ b/twilio/rest/supersim/v1/network_access_profile/__init__.py @@ -163,10 +163,11 @@ def fetch(self) -> NetworkAccessProfileInstance: :returns: The fetched NetworkAccessProfileInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return NetworkAccessProfileInstance( self._version, @@ -182,9 +183,12 @@ async def fetch_async(self) -> NetworkAccessProfileInstance: :returns: The fetched NetworkAccessProfileInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return NetworkAccessProfileInstance( @@ -203,16 +207,20 @@ def update( :returns: The updated NetworkAccessProfileInstance """ + data = values.of( { "UniqueName": unique_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return NetworkAccessProfileInstance( @@ -229,16 +237,20 @@ async def update_async( :returns: The updated NetworkAccessProfileInstance """ + data = values.of( { "UniqueName": unique_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return NetworkAccessProfileInstance( @@ -321,6 +333,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -349,6 +365,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -482,7 +502,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return NetworkAccessProfilePage(self._version, response) async def page_async( @@ -509,8 +535,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return NetworkAccessProfilePage(self._version, response) diff --git a/twilio/rest/supersim/v1/network_access_profile/network_access_profile_network.py b/twilio/rest/supersim/v1/network_access_profile/network_access_profile_network.py index cbe4d5c0ea..c7099b8a7a 100644 --- a/twilio/rest/supersim/v1/network_access_profile/network_access_profile_network.py +++ b/twilio/rest/supersim/v1/network_access_profile/network_access_profile_network.py @@ -149,10 +149,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -161,9 +161,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> NetworkAccessProfileNetworkInstance: @@ -174,10 +176,11 @@ def fetch(self) -> NetworkAccessProfileNetworkInstance: :returns: The fetched NetworkAccessProfileNetworkInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return NetworkAccessProfileNetworkInstance( self._version, @@ -194,9 +197,12 @@ async def fetch_async(self) -> NetworkAccessProfileNetworkInstance: :returns: The fetched NetworkAccessProfileNetworkInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return NetworkAccessProfileNetworkInstance( @@ -281,6 +287,10 @@ def create(self, network: str) -> NetworkAccessProfileNetworkInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -307,6 +317,10 @@ async def create_async(self, network: str) -> NetworkAccessProfileNetworkInstanc ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -444,7 +458,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return NetworkAccessProfileNetworkPage(self._version, response, self._solution) async def page_async( @@ -471,8 +491,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return NetworkAccessProfileNetworkPage(self._version, response, self._solution) diff --git a/twilio/rest/supersim/v1/settings_update.py b/twilio/rest/supersim/v1/settings_update.py index f946150287..294e1102ce 100644 --- a/twilio/rest/supersim/v1/settings_update.py +++ b/twilio/rest/supersim/v1/settings_update.py @@ -256,7 +256,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return SettingsUpdatePage(self._version, response) async def page_async( @@ -289,8 +295,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return SettingsUpdatePage(self._version, response) diff --git a/twilio/rest/supersim/v1/sim/__init__.py b/twilio/rest/supersim/v1/sim/__init__.py index 1452f1eac5..fa878a16df 100644 --- a/twilio/rest/supersim/v1/sim/__init__.py +++ b/twilio/rest/supersim/v1/sim/__init__.py @@ -221,10 +221,11 @@ def fetch(self) -> SimInstance: :returns: The fetched SimInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return SimInstance( self._version, @@ -240,9 +241,12 @@ async def fetch_async(self) -> SimInstance: :returns: The fetched SimInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return SimInstance( @@ -272,6 +276,7 @@ def update( :returns: The updated SimInstance """ + data = values.of( { "UniqueName": unique_name, @@ -282,11 +287,14 @@ def update( "AccountSid": account_sid, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SimInstance(self._version, payload, sid=self._solution["sid"]) @@ -312,6 +320,7 @@ async def update_async( :returns: The updated SimInstance """ + data = values.of( { "UniqueName": unique_name, @@ -322,11 +331,14 @@ async def update_async( "AccountSid": account_sid, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SimInstance(self._version, payload, sid=self._solution["sid"]) @@ -415,6 +427,10 @@ def create(self, iccid: str, registration_code: str) -> SimInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -439,6 +455,10 @@ async def create_async(self, iccid: str, registration_code: str) -> SimInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -615,7 +635,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return SimPage(self._version, response) async def page_async( @@ -651,8 +677,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return SimPage(self._version, response) diff --git a/twilio/rest/supersim/v1/sim/billing_period.py b/twilio/rest/supersim/v1/sim/billing_period.py index e6fb961835..27cbe1222e 100644 --- a/twilio/rest/supersim/v1/sim/billing_period.py +++ b/twilio/rest/supersim/v1/sim/billing_period.py @@ -241,7 +241,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return BillingPeriodPage(self._version, response, self._solution) async def page_async( @@ -268,8 +274,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return BillingPeriodPage(self._version, response, self._solution) diff --git a/twilio/rest/supersim/v1/sim/sim_ip_address.py b/twilio/rest/supersim/v1/sim/sim_ip_address.py index 7c2b70e50f..0c4c3163b6 100644 --- a/twilio/rest/supersim/v1/sim/sim_ip_address.py +++ b/twilio/rest/supersim/v1/sim/sim_ip_address.py @@ -220,7 +220,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return SimIpAddressPage(self._version, response, self._solution) async def page_async( @@ -247,8 +253,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return SimIpAddressPage(self._version, response, self._solution) diff --git a/twilio/rest/supersim/v1/sms_command.py b/twilio/rest/supersim/v1/sms_command.py index 26d39a0bf8..dd70d2425e 100644 --- a/twilio/rest/supersim/v1/sms_command.py +++ b/twilio/rest/supersim/v1/sms_command.py @@ -141,10 +141,11 @@ def fetch(self) -> SmsCommandInstance: :returns: The fetched SmsCommandInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return SmsCommandInstance( self._version, @@ -160,9 +161,12 @@ async def fetch_async(self) -> SmsCommandInstance: :returns: The fetched SmsCommandInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return SmsCommandInstance( @@ -241,6 +245,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -275,6 +283,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -451,7 +463,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return SmsCommandPage(self._version, response) async def page_async( @@ -487,8 +505,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return SmsCommandPage(self._version, response) diff --git a/twilio/rest/supersim/v1/usage_record.py b/twilio/rest/supersim/v1/usage_record.py index 86a335d0de..94072a51fb 100644 --- a/twilio/rest/supersim/v1/usage_record.py +++ b/twilio/rest/supersim/v1/usage_record.py @@ -359,7 +359,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return UsageRecordPage(self._version, response) async def page_async( @@ -410,8 +416,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return UsageRecordPage(self._version, response) diff --git a/twilio/rest/sync/v1/service/__init__.py b/twilio/rest/sync/v1/service/__init__.py index 02d4e8f7e0..d17491d3cb 100644 --- a/twilio/rest/sync/v1/service/__init__.py +++ b/twilio/rest/sync/v1/service/__init__.py @@ -265,10 +265,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -277,9 +277,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> ServiceInstance: @@ -290,10 +292,11 @@ def fetch(self) -> ServiceInstance: :returns: The fetched ServiceInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ServiceInstance( self._version, @@ -309,9 +312,12 @@ async def fetch_async(self) -> ServiceInstance: :returns: The fetched ServiceInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ServiceInstance( @@ -343,6 +349,7 @@ def update( :returns: The updated ServiceInstance """ + data = values.of( { "WebhookUrl": webhook_url, @@ -360,11 +367,14 @@ def update( ), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload, sid=self._solution["sid"]) @@ -392,6 +402,7 @@ async def update_async( :returns: The updated ServiceInstance """ + data = values.of( { "WebhookUrl": webhook_url, @@ -409,11 +420,14 @@ async def update_async( ), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload, sid=self._solution["sid"]) @@ -551,6 +565,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -600,6 +618,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -733,7 +755,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ServicePage(self._version, response) async def page_async( @@ -760,8 +788,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ServicePage(self._version, response) diff --git a/twilio/rest/sync/v1/service/document/__init__.py b/twilio/rest/sync/v1/service/document/__init__.py index 033f27cf42..fe64f629a8 100644 --- a/twilio/rest/sync/v1/service/document/__init__.py +++ b/twilio/rest/sync/v1/service/document/__init__.py @@ -214,10 +214,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -226,9 +226,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> DocumentInstance: @@ -239,10 +241,11 @@ def fetch(self) -> DocumentInstance: :returns: The fetched DocumentInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return DocumentInstance( self._version, @@ -259,9 +262,12 @@ async def fetch_async(self) -> DocumentInstance: :returns: The fetched DocumentInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return DocumentInstance( @@ -286,17 +292,23 @@ def update( :returns: The updated DocumentInstance """ + data = values.of( { "Data": serialize.object(data), "Ttl": ttl, } ) - headers = values.of( - { - "If-Match": if_match, - } - ) + headers = values.of({}) + + if not ( + if_match is values.unset or (isinstance(if_match, str) and not if_match) + ): + headers["If-Match"] = if_match + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( method="POST", uri=self._uri, data=data, headers=headers @@ -324,17 +336,23 @@ async def update_async( :returns: The updated DocumentInstance """ + data = values.of( { "Data": serialize.object(data), "Ttl": ttl, } ) - headers = values.of( - { - "If-Match": if_match, - } - ) + headers = values.of({}) + + if not ( + if_match is values.unset or (isinstance(if_match, str) and not if_match) + ): + headers["If-Match"] = if_match + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( method="POST", uri=self._uri, data=data, headers=headers @@ -434,6 +452,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -467,6 +489,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -602,7 +628,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return DocumentPage(self._version, response, self._solution) async def page_async( @@ -629,8 +661,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return DocumentPage(self._version, response, self._solution) diff --git a/twilio/rest/sync/v1/service/document/document_permission.py b/twilio/rest/sync/v1/service/document/document_permission.py index 40f524832c..75a27c969a 100644 --- a/twilio/rest/sync/v1/service/document/document_permission.py +++ b/twilio/rest/sync/v1/service/document/document_permission.py @@ -190,10 +190,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -202,9 +202,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> DocumentPermissionInstance: @@ -215,10 +217,11 @@ def fetch(self) -> DocumentPermissionInstance: :returns: The fetched DocumentPermissionInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return DocumentPermissionInstance( self._version, @@ -236,9 +239,12 @@ async def fetch_async(self) -> DocumentPermissionInstance: :returns: The fetched DocumentPermissionInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return DocumentPermissionInstance( @@ -261,6 +267,7 @@ def update( :returns: The updated DocumentPermissionInstance """ + data = values.of( { "Read": serialize.boolean_to_string(read), @@ -268,11 +275,14 @@ def update( "Manage": serialize.boolean_to_string(manage), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return DocumentPermissionInstance( @@ -295,6 +305,7 @@ async def update_async( :returns: The updated DocumentPermissionInstance """ + data = values.of( { "Read": serialize.boolean_to_string(read), @@ -302,11 +313,14 @@ async def update_async( "Manage": serialize.boolean_to_string(manage), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return DocumentPermissionInstance( @@ -502,7 +516,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return DocumentPermissionPage(self._version, response, self._solution) async def page_async( @@ -529,8 +549,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return DocumentPermissionPage(self._version, response, self._solution) diff --git a/twilio/rest/sync/v1/service/sync_list/__init__.py b/twilio/rest/sync/v1/service/sync_list/__init__.py index 235fcbd1b9..1b8e54aff8 100644 --- a/twilio/rest/sync/v1/service/sync_list/__init__.py +++ b/twilio/rest/sync/v1/service/sync_list/__init__.py @@ -215,10 +215,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -227,9 +227,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> SyncListInstance: @@ -240,10 +242,11 @@ def fetch(self) -> SyncListInstance: :returns: The fetched SyncListInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return SyncListInstance( self._version, @@ -260,9 +263,12 @@ async def fetch_async(self) -> SyncListInstance: :returns: The fetched SyncListInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return SyncListInstance( @@ -285,17 +291,21 @@ def update( :returns: The updated SyncListInstance """ + data = values.of( { "Ttl": ttl, "CollectionTtl": collection_ttl, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SyncListInstance( @@ -318,17 +328,21 @@ async def update_async( :returns: The updated SyncListInstance """ + data = values.of( { "Ttl": ttl, "CollectionTtl": collection_ttl, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SyncListInstance( @@ -438,6 +452,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -471,6 +489,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -606,7 +628,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return SyncListPage(self._version, response, self._solution) async def page_async( @@ -633,8 +661,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return SyncListPage(self._version, response, self._solution) diff --git a/twilio/rest/sync/v1/service/sync_list/sync_list_item.py b/twilio/rest/sync/v1/service/sync_list/sync_list_item.py index 0db046e1a8..61783aa525 100644 --- a/twilio/rest/sync/v1/service/sync_list/sync_list_item.py +++ b/twilio/rest/sync/v1/service/sync_list/sync_list_item.py @@ -241,6 +241,8 @@ def delete(self, if_match: Union[str, object] = values.unset) -> bool: } ) + headers = values.of({}) + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self, if_match: Union[str, object] = values.unset) -> bool: @@ -257,6 +259,8 @@ async def delete_async(self, if_match: Union[str, object] = values.unset) -> boo } ) + headers = values.of({}) + return await self._version.delete_async( method="DELETE", uri=self._uri, headers=headers ) @@ -269,10 +273,11 @@ def fetch(self) -> SyncListItemInstance: :returns: The fetched SyncListItemInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return SyncListItemInstance( self._version, @@ -290,9 +295,12 @@ async def fetch_async(self) -> SyncListItemInstance: :returns: The fetched SyncListItemInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return SyncListItemInstance( @@ -322,6 +330,7 @@ def update( :returns: The updated SyncListItemInstance """ + data = values.of( { "Data": serialize.object(data), @@ -330,11 +339,16 @@ def update( "CollectionTtl": collection_ttl, } ) - headers = values.of( - { - "If-Match": if_match, - } - ) + headers = values.of({}) + + if not ( + if_match is values.unset or (isinstance(if_match, str) and not if_match) + ): + headers["If-Match"] = if_match + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( method="POST", uri=self._uri, data=data, headers=headers @@ -367,6 +381,7 @@ async def update_async( :returns: The updated SyncListItemInstance """ + data = values.of( { "Data": serialize.object(data), @@ -375,11 +390,16 @@ async def update_async( "CollectionTtl": collection_ttl, } ) - headers = values.of( - { - "If-Match": if_match, - } - ) + headers = values.of({}) + + if not ( + if_match is values.unset or (isinstance(if_match, str) and not if_match) + ): + headers["If-Match"] = if_match + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( method="POST", uri=self._uri, data=data, headers=headers @@ -477,6 +497,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -516,6 +540,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -697,7 +725,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return SyncListItemPage(self._version, response, self._solution) async def page_async( @@ -733,8 +767,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return SyncListItemPage(self._version, response, self._solution) diff --git a/twilio/rest/sync/v1/service/sync_list/sync_list_permission.py b/twilio/rest/sync/v1/service/sync_list/sync_list_permission.py index 07fce14b95..f1eb853468 100644 --- a/twilio/rest/sync/v1/service/sync_list/sync_list_permission.py +++ b/twilio/rest/sync/v1/service/sync_list/sync_list_permission.py @@ -192,10 +192,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -204,9 +204,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> SyncListPermissionInstance: @@ -217,10 +219,11 @@ def fetch(self) -> SyncListPermissionInstance: :returns: The fetched SyncListPermissionInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return SyncListPermissionInstance( self._version, @@ -238,9 +241,12 @@ async def fetch_async(self) -> SyncListPermissionInstance: :returns: The fetched SyncListPermissionInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return SyncListPermissionInstance( @@ -263,6 +269,7 @@ def update( :returns: The updated SyncListPermissionInstance """ + data = values.of( { "Read": serialize.boolean_to_string(read), @@ -270,11 +277,14 @@ def update( "Manage": serialize.boolean_to_string(manage), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SyncListPermissionInstance( @@ -297,6 +307,7 @@ async def update_async( :returns: The updated SyncListPermissionInstance """ + data = values.of( { "Read": serialize.boolean_to_string(read), @@ -304,11 +315,14 @@ async def update_async( "Manage": serialize.boolean_to_string(manage), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SyncListPermissionInstance( @@ -502,7 +516,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return SyncListPermissionPage(self._version, response, self._solution) async def page_async( @@ -529,8 +549,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return SyncListPermissionPage(self._version, response, self._solution) diff --git a/twilio/rest/sync/v1/service/sync_map/__init__.py b/twilio/rest/sync/v1/service/sync_map/__init__.py index 1c6b5c9a00..c6bb1ce556 100644 --- a/twilio/rest/sync/v1/service/sync_map/__init__.py +++ b/twilio/rest/sync/v1/service/sync_map/__init__.py @@ -215,10 +215,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -227,9 +227,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> SyncMapInstance: @@ -240,10 +242,11 @@ def fetch(self) -> SyncMapInstance: :returns: The fetched SyncMapInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return SyncMapInstance( self._version, @@ -260,9 +263,12 @@ async def fetch_async(self) -> SyncMapInstance: :returns: The fetched SyncMapInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return SyncMapInstance( @@ -285,17 +291,21 @@ def update( :returns: The updated SyncMapInstance """ + data = values.of( { "Ttl": ttl, "CollectionTtl": collection_ttl, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SyncMapInstance( @@ -318,17 +328,21 @@ async def update_async( :returns: The updated SyncMapInstance """ + data = values.of( { "Ttl": ttl, "CollectionTtl": collection_ttl, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SyncMapInstance( @@ -438,6 +452,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -471,6 +489,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -606,7 +628,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return SyncMapPage(self._version, response, self._solution) async def page_async( @@ -633,8 +661,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return SyncMapPage(self._version, response, self._solution) diff --git a/twilio/rest/sync/v1/service/sync_map/sync_map_item.py b/twilio/rest/sync/v1/service/sync_map/sync_map_item.py index c5381fc592..4939694026 100644 --- a/twilio/rest/sync/v1/service/sync_map/sync_map_item.py +++ b/twilio/rest/sync/v1/service/sync_map/sync_map_item.py @@ -241,6 +241,8 @@ def delete(self, if_match: Union[str, object] = values.unset) -> bool: } ) + headers = values.of({}) + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self, if_match: Union[str, object] = values.unset) -> bool: @@ -257,6 +259,8 @@ async def delete_async(self, if_match: Union[str, object] = values.unset) -> boo } ) + headers = values.of({}) + return await self._version.delete_async( method="DELETE", uri=self._uri, headers=headers ) @@ -269,10 +273,11 @@ def fetch(self) -> SyncMapItemInstance: :returns: The fetched SyncMapItemInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return SyncMapItemInstance( self._version, @@ -290,9 +295,12 @@ async def fetch_async(self) -> SyncMapItemInstance: :returns: The fetched SyncMapItemInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return SyncMapItemInstance( @@ -322,6 +330,7 @@ def update( :returns: The updated SyncMapItemInstance """ + data = values.of( { "Data": serialize.object(data), @@ -330,11 +339,16 @@ def update( "CollectionTtl": collection_ttl, } ) - headers = values.of( - { - "If-Match": if_match, - } - ) + headers = values.of({}) + + if not ( + if_match is values.unset or (isinstance(if_match, str) and not if_match) + ): + headers["If-Match"] = if_match + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( method="POST", uri=self._uri, data=data, headers=headers @@ -367,6 +381,7 @@ async def update_async( :returns: The updated SyncMapItemInstance """ + data = values.of( { "Data": serialize.object(data), @@ -375,11 +390,16 @@ async def update_async( "CollectionTtl": collection_ttl, } ) - headers = values.of( - { - "If-Match": if_match, - } - ) + headers = values.of({}) + + if not ( + if_match is values.unset or (isinstance(if_match, str) and not if_match) + ): + headers["If-Match"] = if_match + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( method="POST", uri=self._uri, data=data, headers=headers @@ -480,6 +500,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -522,6 +546,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -703,7 +731,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return SyncMapItemPage(self._version, response, self._solution) async def page_async( @@ -739,8 +773,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return SyncMapItemPage(self._version, response, self._solution) diff --git a/twilio/rest/sync/v1/service/sync_map/sync_map_permission.py b/twilio/rest/sync/v1/service/sync_map/sync_map_permission.py index ba056906c7..910560add0 100644 --- a/twilio/rest/sync/v1/service/sync_map/sync_map_permission.py +++ b/twilio/rest/sync/v1/service/sync_map/sync_map_permission.py @@ -190,10 +190,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -202,9 +202,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> SyncMapPermissionInstance: @@ -215,10 +217,11 @@ def fetch(self) -> SyncMapPermissionInstance: :returns: The fetched SyncMapPermissionInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return SyncMapPermissionInstance( self._version, @@ -236,9 +239,12 @@ async def fetch_async(self) -> SyncMapPermissionInstance: :returns: The fetched SyncMapPermissionInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return SyncMapPermissionInstance( @@ -261,6 +267,7 @@ def update( :returns: The updated SyncMapPermissionInstance """ + data = values.of( { "Read": serialize.boolean_to_string(read), @@ -268,11 +275,14 @@ def update( "Manage": serialize.boolean_to_string(manage), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SyncMapPermissionInstance( @@ -295,6 +305,7 @@ async def update_async( :returns: The updated SyncMapPermissionInstance """ + data = values.of( { "Read": serialize.boolean_to_string(read), @@ -302,11 +313,14 @@ async def update_async( "Manage": serialize.boolean_to_string(manage), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SyncMapPermissionInstance( @@ -500,7 +514,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return SyncMapPermissionPage(self._version, response, self._solution) async def page_async( @@ -527,8 +547,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return SyncMapPermissionPage(self._version, response, self._solution) diff --git a/twilio/rest/sync/v1/service/sync_stream/__init__.py b/twilio/rest/sync/v1/service/sync_stream/__init__.py index c9b98ab7d0..a7f4128e05 100644 --- a/twilio/rest/sync/v1/service/sync_stream/__init__.py +++ b/twilio/rest/sync/v1/service/sync_stream/__init__.py @@ -192,10 +192,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -204,9 +204,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> SyncStreamInstance: @@ -217,10 +219,11 @@ def fetch(self) -> SyncStreamInstance: :returns: The fetched SyncStreamInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return SyncStreamInstance( self._version, @@ -237,9 +240,12 @@ async def fetch_async(self) -> SyncStreamInstance: :returns: The fetched SyncStreamInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return SyncStreamInstance( @@ -257,16 +263,20 @@ def update(self, ttl: Union[int, object] = values.unset) -> SyncStreamInstance: :returns: The updated SyncStreamInstance """ + data = values.of( { "Ttl": ttl, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SyncStreamInstance( @@ -286,16 +296,20 @@ async def update_async( :returns: The updated SyncStreamInstance """ + data = values.of( { "Ttl": ttl, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SyncStreamInstance( @@ -389,6 +403,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -419,6 +437,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -554,7 +576,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return SyncStreamPage(self._version, response, self._solution) async def page_async( @@ -581,8 +609,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return SyncStreamPage(self._version, response, self._solution) diff --git a/twilio/rest/sync/v1/service/sync_stream/stream_message.py b/twilio/rest/sync/v1/service/sync_stream/stream_message.py index baca803f95..bcce239975 100644 --- a/twilio/rest/sync/v1/service/sync_stream/stream_message.py +++ b/twilio/rest/sync/v1/service/sync_stream/stream_message.py @@ -91,6 +91,10 @@ def create(self, data: object) -> StreamMessageInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -118,6 +122,10 @@ async def create_async(self, data: object) -> StreamMessageInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/taskrouter/v1/workspace/__init__.py b/twilio/rest/taskrouter/v1/workspace/__init__.py index 60085c1186..086e3e1747 100644 --- a/twilio/rest/taskrouter/v1/workspace/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/__init__.py @@ -330,10 +330,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -342,9 +342,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> WorkspaceInstance: @@ -355,10 +357,11 @@ def fetch(self) -> WorkspaceInstance: :returns: The fetched WorkspaceInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return WorkspaceInstance( self._version, @@ -374,9 +377,12 @@ async def fetch_async(self) -> WorkspaceInstance: :returns: The fetched WorkspaceInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return WorkspaceInstance( @@ -410,6 +416,7 @@ def update( :returns: The updated WorkspaceInstance """ + data = values.of( { "DefaultActivitySid": default_activity_sid, @@ -421,11 +428,14 @@ def update( "PrioritizeQueueOrder": prioritize_queue_order, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return WorkspaceInstance(self._version, payload, sid=self._solution["sid"]) @@ -455,6 +465,7 @@ async def update_async( :returns: The updated WorkspaceInstance """ + data = values.of( { "DefaultActivitySid": default_activity_sid, @@ -466,11 +477,14 @@ async def update_async( "PrioritizeQueueOrder": prioritize_queue_order, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return WorkspaceInstance(self._version, payload, sid=self._solution["sid"]) @@ -673,6 +687,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -715,6 +733,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -863,7 +885,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return WorkspacePage(self._version, response) async def page_async( @@ -893,8 +921,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return WorkspacePage(self._version, response) diff --git a/twilio/rest/taskrouter/v1/workspace/activity.py b/twilio/rest/taskrouter/v1/workspace/activity.py index e211ef9f72..4e3e416af7 100644 --- a/twilio/rest/taskrouter/v1/workspace/activity.py +++ b/twilio/rest/taskrouter/v1/workspace/activity.py @@ -182,10 +182,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -194,9 +194,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> ActivityInstance: @@ -207,10 +209,11 @@ def fetch(self) -> ActivityInstance: :returns: The fetched ActivityInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ActivityInstance( self._version, @@ -227,9 +230,12 @@ async def fetch_async(self) -> ActivityInstance: :returns: The fetched ActivityInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ActivityInstance( @@ -249,16 +255,20 @@ def update( :returns: The updated ActivityInstance """ + data = values.of( { "FriendlyName": friendly_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ActivityInstance( @@ -278,16 +288,20 @@ async def update_async( :returns: The updated ActivityInstance """ + data = values.of( { "FriendlyName": friendly_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ActivityInstance( @@ -366,6 +380,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -394,6 +412,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -563,7 +585,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ActivityPage(self._version, response, self._solution) async def page_async( @@ -596,8 +624,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ActivityPage(self._version, response, self._solution) diff --git a/twilio/rest/taskrouter/v1/workspace/event.py b/twilio/rest/taskrouter/v1/workspace/event.py index 534d9cd120..1b7f289e5e 100644 --- a/twilio/rest/taskrouter/v1/workspace/event.py +++ b/twilio/rest/taskrouter/v1/workspace/event.py @@ -149,10 +149,11 @@ def fetch(self) -> EventInstance: :returns: The fetched EventInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return EventInstance( self._version, @@ -169,9 +170,12 @@ async def fetch_async(self) -> EventInstance: :returns: The fetched EventInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return EventInstance( @@ -526,7 +530,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return EventPage(self._version, response, self._solution) async def page_async( @@ -586,8 +596,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return EventPage(self._version, response, self._solution) diff --git a/twilio/rest/taskrouter/v1/workspace/task/__init__.py b/twilio/rest/taskrouter/v1/workspace/task/__init__.py index ed25dc71d1..2c4516df77 100644 --- a/twilio/rest/taskrouter/v1/workspace/task/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/task/__init__.py @@ -292,6 +292,8 @@ def delete(self, if_match: Union[str, object] = values.unset) -> bool: } ) + headers = values.of({}) + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self, if_match: Union[str, object] = values.unset) -> bool: @@ -308,6 +310,8 @@ async def delete_async(self, if_match: Union[str, object] = values.unset) -> boo } ) + headers = values.of({}) + return await self._version.delete_async( method="DELETE", uri=self._uri, headers=headers ) @@ -320,10 +324,11 @@ def fetch(self) -> TaskInstance: :returns: The fetched TaskInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return TaskInstance( self._version, @@ -340,9 +345,12 @@ async def fetch_async(self) -> TaskInstance: :returns: The fetched TaskInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return TaskInstance( @@ -375,6 +383,7 @@ def update( :returns: The updated TaskInstance """ + data = values.of( { "Attributes": attributes, @@ -385,11 +394,16 @@ def update( "VirtualStartTime": serialize.iso8601_datetime(virtual_start_time), } ) - headers = values.of( - { - "If-Match": if_match, - } - ) + headers = values.of({}) + + if not ( + if_match is values.unset or (isinstance(if_match, str) and not if_match) + ): + headers["If-Match"] = if_match + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( method="POST", uri=self._uri, data=data, headers=headers @@ -425,6 +439,7 @@ async def update_async( :returns: The updated TaskInstance """ + data = values.of( { "Attributes": attributes, @@ -435,11 +450,16 @@ async def update_async( "VirtualStartTime": serialize.iso8601_datetime(virtual_start_time), } ) - headers = values.of( - { - "If-Match": if_match, - } - ) + headers = values.of({}) + + if not ( + if_match is values.unset or (isinstance(if_match, str) and not if_match) + ): + headers["If-Match"] = if_match + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( method="POST", uri=self._uri, data=data, headers=headers @@ -557,6 +577,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -608,6 +632,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -897,7 +925,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return TaskPage(self._version, response, self._solution) async def page_async( @@ -954,8 +988,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return TaskPage(self._version, response, self._solution) diff --git a/twilio/rest/taskrouter/v1/workspace/task/reservation.py b/twilio/rest/taskrouter/v1/workspace/task/reservation.py index 50b1ed1273..5318543ea2 100644 --- a/twilio/rest/taskrouter/v1/workspace/task/reservation.py +++ b/twilio/rest/taskrouter/v1/workspace/task/reservation.py @@ -547,10 +547,11 @@ def fetch(self) -> ReservationInstance: :returns: The fetched ReservationInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ReservationInstance( self._version, @@ -568,9 +569,12 @@ async def fetch_async(self) -> ReservationInstance: :returns: The fetched ReservationInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ReservationInstance( @@ -706,6 +710,7 @@ def update( :returns: The updated ReservationInstance """ + data = values.of( { "ReservationStatus": reservation_status, @@ -778,11 +783,16 @@ def update( "JitterBufferSize": jitter_buffer_size, } ) - headers = values.of( - { - "If-Match": if_match, - } - ) + headers = values.of({}) + + if not ( + if_match is values.unset or (isinstance(if_match, str) and not if_match) + ): + headers["If-Match"] = if_match + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( method="POST", uri=self._uri, data=data, headers=headers @@ -921,6 +931,7 @@ async def update_async( :returns: The updated ReservationInstance """ + data = values.of( { "ReservationStatus": reservation_status, @@ -993,11 +1004,16 @@ async def update_async( "JitterBufferSize": jitter_buffer_size, } ) - headers = values.of( - { - "If-Match": if_match, - } - ) + headers = values.of({}) + + if not ( + if_match is values.unset or (isinstance(if_match, str) and not if_match) + ): + headers["If-Match"] = if_match + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( method="POST", uri=self._uri, data=data, headers=headers @@ -1228,7 +1244,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ReservationPage(self._version, response, self._solution) async def page_async( @@ -1261,8 +1283,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ReservationPage(self._version, response, self._solution) diff --git a/twilio/rest/taskrouter/v1/workspace/task_channel.py b/twilio/rest/taskrouter/v1/workspace/task_channel.py index 95a7e5efaf..3a4b0a6b9e 100644 --- a/twilio/rest/taskrouter/v1/workspace/task_channel.py +++ b/twilio/rest/taskrouter/v1/workspace/task_channel.py @@ -194,10 +194,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -206,9 +206,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> TaskChannelInstance: @@ -219,10 +221,11 @@ def fetch(self) -> TaskChannelInstance: :returns: The fetched TaskChannelInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return TaskChannelInstance( self._version, @@ -239,9 +242,12 @@ async def fetch_async(self) -> TaskChannelInstance: :returns: The fetched TaskChannelInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return TaskChannelInstance( @@ -264,6 +270,7 @@ def update( :returns: The updated TaskChannelInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -272,11 +279,14 @@ def update( ), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return TaskChannelInstance( @@ -299,6 +309,7 @@ async def update_async( :returns: The updated TaskChannelInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -307,11 +318,14 @@ async def update_async( ), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return TaskChannelInstance( @@ -397,6 +411,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -432,6 +450,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -567,7 +589,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return TaskChannelPage(self._version, response, self._solution) async def page_async( @@ -594,8 +622,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return TaskChannelPage(self._version, response, self._solution) diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue/__init__.py b/twilio/rest/taskrouter/v1/workspace/task_queue/__init__.py index 027cf8dbfc..4511a55310 100644 --- a/twilio/rest/taskrouter/v1/workspace/task_queue/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/task_queue/__init__.py @@ -283,10 +283,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -295,9 +295,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> TaskQueueInstance: @@ -308,10 +310,11 @@ def fetch(self) -> TaskQueueInstance: :returns: The fetched TaskQueueInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return TaskQueueInstance( self._version, @@ -328,9 +331,12 @@ async def fetch_async(self) -> TaskQueueInstance: :returns: The fetched TaskQueueInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return TaskQueueInstance( @@ -361,6 +367,7 @@ def update( :returns: The updated TaskQueueInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -371,11 +378,14 @@ def update( "TaskOrder": task_order, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return TaskQueueInstance( @@ -406,6 +416,7 @@ async def update_async( :returns: The updated TaskQueueInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -416,11 +427,14 @@ async def update_async( "TaskOrder": task_order, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return TaskQueueInstance( @@ -557,6 +571,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -599,6 +617,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -798,7 +820,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return TaskQueuePage(self._version, response, self._solution) async def page_async( @@ -837,8 +865,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return TaskQueuePage(self._version, response, self._solution) 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 index 9ccef45773..90400c7930 100644 --- 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 @@ -93,8 +93,11 @@ def create( data = body.to_dict() headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -116,8 +119,11 @@ async def create_async( data = body.to_dict() headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.py b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.py index acb8b79a29..ef851c755a 100644 --- a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.py @@ -254,7 +254,13 @@ def fetch( } ) - payload = self._version.fetch(method="GET", uri=self._uri, params=data) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch( + method="GET", uri=self._uri, params=data, headers=headers + ) return TaskQueueCumulativeStatisticsInstance( self._version, @@ -293,8 +299,12 @@ async def fetch_async( } ) + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return TaskQueueCumulativeStatisticsInstance( diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.py b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.py index 4d4198ac89..c4eb30ddc0 100644 --- a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.py @@ -182,7 +182,13 @@ def fetch( } ) - payload = self._version.fetch(method="GET", uri=self._uri, params=data) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch( + method="GET", uri=self._uri, params=data, headers=headers + ) return TaskQueueRealTimeStatisticsInstance( self._version, @@ -208,8 +214,12 @@ async def fetch_async( } ) + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return TaskQueueRealTimeStatisticsInstance( diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_statistics.py b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_statistics.py index 2a09f62a68..2d5d631069 100644 --- a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_statistics.py @@ -186,7 +186,13 @@ def fetch( } ) - payload = self._version.fetch(method="GET", uri=self._uri, params=data) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch( + method="GET", uri=self._uri, params=data, headers=headers + ) return TaskQueueStatisticsInstance( self._version, @@ -225,8 +231,12 @@ async def fetch_async( } ) + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return TaskQueueStatisticsInstance( diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queues_statistics.py b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queues_statistics.py index bec2d81b40..036f6ad92b 100644 --- a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queues_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queues_statistics.py @@ -316,7 +316,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return TaskQueuesStatisticsPage(self._version, response, self._solution) async def page_async( @@ -361,8 +367,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return TaskQueuesStatisticsPage(self._version, response, self._solution) diff --git a/twilio/rest/taskrouter/v1/workspace/worker/__init__.py b/twilio/rest/taskrouter/v1/workspace/worker/__init__.py index 8f6ff4c7e1..38aede84bb 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/__init__.py @@ -268,6 +268,8 @@ def delete(self, if_match: Union[str, object] = values.unset) -> bool: } ) + headers = values.of({}) + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self, if_match: Union[str, object] = values.unset) -> bool: @@ -284,6 +286,8 @@ async def delete_async(self, if_match: Union[str, object] = values.unset) -> boo } ) + headers = values.of({}) + return await self._version.delete_async( method="DELETE", uri=self._uri, headers=headers ) @@ -296,10 +300,11 @@ def fetch(self) -> WorkerInstance: :returns: The fetched WorkerInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return WorkerInstance( self._version, @@ -316,9 +321,12 @@ async def fetch_async(self) -> WorkerInstance: :returns: The fetched WorkerInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return WorkerInstance( @@ -347,6 +355,7 @@ def update( :returns: The updated WorkerInstance """ + data = values.of( { "ActivitySid": activity_sid, @@ -357,11 +366,16 @@ def update( ), } ) - headers = values.of( - { - "If-Match": if_match, - } - ) + headers = values.of({}) + + if not ( + if_match is values.unset or (isinstance(if_match, str) and not if_match) + ): + headers["If-Match"] = if_match + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( method="POST", uri=self._uri, data=data, headers=headers @@ -393,6 +407,7 @@ async def update_async( :returns: The updated WorkerInstance """ + data = values.of( { "ActivitySid": activity_sid, @@ -403,11 +418,16 @@ async def update_async( ), } ) - headers = values.of( - { - "If-Match": if_match, - } - ) + headers = values.of({}) + + if not ( + if_match is values.unset or (isinstance(if_match, str) and not if_match) + ): + headers["If-Match"] = if_match + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( method="POST", uri=self._uri, data=data, headers=headers @@ -537,6 +557,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -570,6 +594,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -829,7 +857,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return WorkerPage(self._version, response, self._solution) async def page_async( @@ -880,8 +914,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return WorkerPage(self._version, response, self._solution) diff --git a/twilio/rest/taskrouter/v1/workspace/worker/reservation.py b/twilio/rest/taskrouter/v1/workspace/worker/reservation.py index b7dc4bca9e..11d1ea610d 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/reservation.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/reservation.py @@ -524,10 +524,11 @@ def fetch(self) -> ReservationInstance: :returns: The fetched ReservationInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ReservationInstance( self._version, @@ -545,9 +546,12 @@ async def fetch_async(self) -> ReservationInstance: :returns: The fetched ReservationInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ReservationInstance( @@ -677,6 +681,7 @@ def update( :returns: The updated ReservationInstance """ + data = values.of( { "ReservationStatus": reservation_status, @@ -747,11 +752,16 @@ def update( "JitterBufferSize": jitter_buffer_size, } ) - headers = values.of( - { - "If-Match": if_match, - } - ) + headers = values.of({}) + + if not ( + if_match is values.unset or (isinstance(if_match, str) and not if_match) + ): + headers["If-Match"] = if_match + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( method="POST", uri=self._uri, data=data, headers=headers @@ -884,6 +894,7 @@ async def update_async( :returns: The updated ReservationInstance """ + data = values.of( { "ReservationStatus": reservation_status, @@ -954,11 +965,16 @@ async def update_async( "JitterBufferSize": jitter_buffer_size, } ) - headers = values.of( - { - "If-Match": if_match, - } - ) + headers = values.of({}) + + if not ( + if_match is values.unset or (isinstance(if_match, str) and not if_match) + ): + headers["If-Match"] = if_match + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( method="POST", uri=self._uri, data=data, headers=headers @@ -1174,7 +1190,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ReservationPage(self._version, response, self._solution) async def page_async( @@ -1204,8 +1226,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ReservationPage(self._version, response, self._solution) diff --git a/twilio/rest/taskrouter/v1/workspace/worker/worker_channel.py b/twilio/rest/taskrouter/v1/workspace/worker/worker_channel.py index f48ebb3a62..6e3cc9c1dd 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/worker_channel.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/worker_channel.py @@ -196,10 +196,11 @@ def fetch(self) -> WorkerChannelInstance: :returns: The fetched WorkerChannelInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return WorkerChannelInstance( self._version, @@ -217,9 +218,12 @@ async def fetch_async(self) -> WorkerChannelInstance: :returns: The fetched WorkerChannelInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return WorkerChannelInstance( @@ -243,17 +247,21 @@ def update( :returns: The updated WorkerChannelInstance """ + data = values.of( { "Capacity": capacity, "Available": serialize.boolean_to_string(available), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return WorkerChannelInstance( @@ -277,17 +285,21 @@ async def update_async( :returns: The updated WorkerChannelInstance """ + data = values.of( { "Capacity": capacity, "Available": serialize.boolean_to_string(available), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return WorkerChannelInstance( @@ -481,7 +493,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return WorkerChannelPage(self._version, response, self._solution) async def page_async( @@ -508,8 +526,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return WorkerChannelPage(self._version, response, self._solution) diff --git a/twilio/rest/taskrouter/v1/workspace/worker/worker_statistics.py b/twilio/rest/taskrouter/v1/workspace/worker/worker_statistics.py index 61618d2961..eea670aa7d 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/worker_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/worker_statistics.py @@ -175,7 +175,13 @@ def fetch( } ) - payload = self._version.fetch(method="GET", uri=self._uri, params=data) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch( + method="GET", uri=self._uri, params=data, headers=headers + ) return WorkerStatisticsInstance( self._version, @@ -211,8 +217,12 @@ async def fetch_async( } ) + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return WorkerStatisticsInstance( diff --git a/twilio/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.py b/twilio/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.py index b18e7f123b..48a78710e2 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.py @@ -197,7 +197,13 @@ def fetch( } ) - payload = self._version.fetch(method="GET", uri=self._uri, params=data) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch( + method="GET", uri=self._uri, params=data, headers=headers + ) return WorkersCumulativeStatisticsInstance( self._version, @@ -232,8 +238,12 @@ async def fetch_async( } ) + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return WorkersCumulativeStatisticsInstance( diff --git a/twilio/rest/taskrouter/v1/workspace/worker/workers_real_time_statistics.py b/twilio/rest/taskrouter/v1/workspace/worker/workers_real_time_statistics.py index 277889ae7a..2e9970478e 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/workers_real_time_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/workers_real_time_statistics.py @@ -138,7 +138,13 @@ def fetch( } ) - payload = self._version.fetch(method="GET", uri=self._uri, params=data) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch( + method="GET", uri=self._uri, params=data, headers=headers + ) return WorkersRealTimeStatisticsInstance( self._version, @@ -163,8 +169,12 @@ async def fetch_async( } ) + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return WorkersRealTimeStatisticsInstance( diff --git a/twilio/rest/taskrouter/v1/workspace/worker/workers_statistics.py b/twilio/rest/taskrouter/v1/workspace/worker/workers_statistics.py index 0cd09ec124..31c79ee6ba 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/workers_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/workers_statistics.py @@ -190,7 +190,13 @@ def fetch( } ) - payload = self._version.fetch(method="GET", uri=self._uri, params=data) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch( + method="GET", uri=self._uri, params=data, headers=headers + ) return WorkersStatisticsInstance( self._version, @@ -234,8 +240,12 @@ async def fetch_async( } ) + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return WorkersStatisticsInstance( diff --git a/twilio/rest/taskrouter/v1/workspace/workflow/__init__.py b/twilio/rest/taskrouter/v1/workspace/workflow/__init__.py index 96d7aabf0e..619ae1bce9 100644 --- a/twilio/rest/taskrouter/v1/workspace/workflow/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/workflow/__init__.py @@ -262,10 +262,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -274,9 +274,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> WorkflowInstance: @@ -287,10 +289,11 @@ def fetch(self) -> WorkflowInstance: :returns: The fetched WorkflowInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return WorkflowInstance( self._version, @@ -307,9 +310,12 @@ async def fetch_async(self) -> WorkflowInstance: :returns: The fetched WorkflowInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return WorkflowInstance( @@ -340,6 +346,7 @@ def update( :returns: The updated WorkflowInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -350,11 +357,14 @@ def update( "ReEvaluateTasks": re_evaluate_tasks, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return WorkflowInstance( @@ -385,6 +395,7 @@ async def update_async( :returns: The updated WorkflowInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -395,11 +406,14 @@ async def update_async( "ReEvaluateTasks": re_evaluate_tasks, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return WorkflowInstance( @@ -528,6 +542,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -567,6 +585,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -717,7 +739,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return WorkflowPage(self._version, response, self._solution) async def page_async( @@ -747,8 +775,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return WorkflowPage(self._version, response, self._solution) diff --git a/twilio/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.py b/twilio/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.py index e06cab0114..d6d7c094cc 100644 --- a/twilio/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.py @@ -254,7 +254,13 @@ def fetch( } ) - payload = self._version.fetch(method="GET", uri=self._uri, params=data) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch( + method="GET", uri=self._uri, params=data, headers=headers + ) return WorkflowCumulativeStatisticsInstance( self._version, @@ -293,8 +299,12 @@ async def fetch_async( } ) + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return WorkflowCumulativeStatisticsInstance( diff --git a/twilio/rest/taskrouter/v1/workspace/workflow/workflow_real_time_statistics.py b/twilio/rest/taskrouter/v1/workspace/workflow/workflow_real_time_statistics.py index 415d4223e4..9387622518 100644 --- a/twilio/rest/taskrouter/v1/workspace/workflow/workflow_real_time_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/workflow/workflow_real_time_statistics.py @@ -162,7 +162,13 @@ def fetch( } ) - payload = self._version.fetch(method="GET", uri=self._uri, params=data) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch( + method="GET", uri=self._uri, params=data, headers=headers + ) return WorkflowRealTimeStatisticsInstance( self._version, @@ -188,8 +194,12 @@ async def fetch_async( } ) + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return WorkflowRealTimeStatisticsInstance( diff --git a/twilio/rest/taskrouter/v1/workspace/workflow/workflow_statistics.py b/twilio/rest/taskrouter/v1/workspace/workflow/workflow_statistics.py index f86590e40f..e49bd32d6e 100644 --- a/twilio/rest/taskrouter/v1/workspace/workflow/workflow_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/workflow/workflow_statistics.py @@ -186,7 +186,13 @@ def fetch( } ) - payload = self._version.fetch(method="GET", uri=self._uri, params=data) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch( + method="GET", uri=self._uri, params=data, headers=headers + ) return WorkflowStatisticsInstance( self._version, @@ -225,8 +231,12 @@ async def fetch_async( } ) + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return WorkflowStatisticsInstance( diff --git a/twilio/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.py b/twilio/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.py index 2b223641ae..3747b395d2 100644 --- a/twilio/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.py @@ -242,7 +242,13 @@ def fetch( } ) - payload = self._version.fetch(method="GET", uri=self._uri, params=data) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch( + method="GET", uri=self._uri, params=data, headers=headers + ) return WorkspaceCumulativeStatisticsInstance( self._version, @@ -280,8 +286,12 @@ async def fetch_async( } ) + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return WorkspaceCumulativeStatisticsInstance( diff --git a/twilio/rest/taskrouter/v1/workspace/workspace_real_time_statistics.py b/twilio/rest/taskrouter/v1/workspace/workspace_real_time_statistics.py index 35b50c0b21..923a94bf3a 100644 --- a/twilio/rest/taskrouter/v1/workspace/workspace_real_time_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/workspace_real_time_statistics.py @@ -158,7 +158,13 @@ def fetch( } ) - payload = self._version.fetch(method="GET", uri=self._uri, params=data) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch( + method="GET", uri=self._uri, params=data, headers=headers + ) return WorkspaceRealTimeStatisticsInstance( self._version, @@ -183,8 +189,12 @@ async def fetch_async( } ) + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return WorkspaceRealTimeStatisticsInstance( diff --git a/twilio/rest/taskrouter/v1/workspace/workspace_statistics.py b/twilio/rest/taskrouter/v1/workspace/workspace_statistics.py index 19eb885675..b8414a5c6c 100644 --- a/twilio/rest/taskrouter/v1/workspace/workspace_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/workspace_statistics.py @@ -170,7 +170,13 @@ def fetch( } ) - payload = self._version.fetch(method="GET", uri=self._uri, params=data) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch( + method="GET", uri=self._uri, params=data, headers=headers + ) return WorkspaceStatisticsInstance( self._version, @@ -208,8 +214,12 @@ async def fetch_async( } ) + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return WorkspaceStatisticsInstance( diff --git a/twilio/rest/trunking/v1/trunk/__init__.py b/twilio/rest/trunking/v1/trunk/__init__.py index b1bfdba117..6a93a83233 100644 --- a/twilio/rest/trunking/v1/trunk/__init__.py +++ b/twilio/rest/trunking/v1/trunk/__init__.py @@ -298,10 +298,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -310,9 +310,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> TrunkInstance: @@ -323,10 +325,11 @@ def fetch(self) -> TrunkInstance: :returns: The fetched TrunkInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return TrunkInstance( self._version, @@ -342,9 +345,12 @@ async def fetch_async(self) -> TrunkInstance: :returns: The fetched TrunkInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return TrunkInstance( @@ -380,6 +386,7 @@ def update( :returns: The updated TrunkInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -392,11 +399,14 @@ def update( "TransferCallerId": transfer_caller_id, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return TrunkInstance(self._version, payload, sid=self._solution["sid"]) @@ -428,6 +438,7 @@ async def update_async( :returns: The updated TrunkInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -440,11 +451,14 @@ async def update_async( "TransferCallerId": transfer_caller_id, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return TrunkInstance(self._version, payload, sid=self._solution["sid"]) @@ -593,6 +607,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -641,6 +659,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -774,7 +796,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return TrunkPage(self._version, response) async def page_async( @@ -801,8 +829,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return TrunkPage(self._version, response) diff --git a/twilio/rest/trunking/v1/trunk/credential_list.py b/twilio/rest/trunking/v1/trunk/credential_list.py index e04bb30720..09ffc99260 100644 --- a/twilio/rest/trunking/v1/trunk/credential_list.py +++ b/twilio/rest/trunking/v1/trunk/credential_list.py @@ -148,10 +148,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -160,9 +160,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> CredentialListInstance: @@ -173,10 +175,11 @@ def fetch(self) -> CredentialListInstance: :returns: The fetched CredentialListInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return CredentialListInstance( self._version, @@ -193,9 +196,12 @@ async def fetch_async(self) -> CredentialListInstance: :returns: The fetched CredentialListInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return CredentialListInstance( @@ -270,6 +276,10 @@ def create(self, credential_list_sid: str) -> CredentialListInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -294,6 +304,10 @@ async def create_async(self, credential_list_sid: str) -> CredentialListInstance ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -429,7 +443,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return CredentialListPage(self._version, response, self._solution) async def page_async( @@ -456,8 +476,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return CredentialListPage(self._version, response, self._solution) diff --git a/twilio/rest/trunking/v1/trunk/ip_access_control_list.py b/twilio/rest/trunking/v1/trunk/ip_access_control_list.py index 957084cb62..ec5a59de69 100644 --- a/twilio/rest/trunking/v1/trunk/ip_access_control_list.py +++ b/twilio/rest/trunking/v1/trunk/ip_access_control_list.py @@ -150,10 +150,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -162,9 +162,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> IpAccessControlListInstance: @@ -175,10 +177,11 @@ def fetch(self) -> IpAccessControlListInstance: :returns: The fetched IpAccessControlListInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return IpAccessControlListInstance( self._version, @@ -195,9 +198,12 @@ async def fetch_async(self) -> IpAccessControlListInstance: :returns: The fetched IpAccessControlListInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return IpAccessControlListInstance( @@ -272,6 +278,10 @@ def create(self, ip_access_control_list_sid: str) -> IpAccessControlListInstance ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -298,6 +308,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -433,7 +447,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return IpAccessControlListPage(self._version, response, self._solution) async def page_async( @@ -460,8 +480,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return IpAccessControlListPage(self._version, response, self._solution) diff --git a/twilio/rest/trunking/v1/trunk/origination_url.py b/twilio/rest/trunking/v1/trunk/origination_url.py index e8e77180e8..082fa34beb 100644 --- a/twilio/rest/trunking/v1/trunk/origination_url.py +++ b/twilio/rest/trunking/v1/trunk/origination_url.py @@ -210,10 +210,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -222,9 +222,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> OriginationUrlInstance: @@ -235,10 +237,11 @@ def fetch(self) -> OriginationUrlInstance: :returns: The fetched OriginationUrlInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return OriginationUrlInstance( self._version, @@ -255,9 +258,12 @@ async def fetch_async(self) -> OriginationUrlInstance: :returns: The fetched OriginationUrlInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return OriginationUrlInstance( @@ -286,6 +292,7 @@ def update( :returns: The updated OriginationUrlInstance """ + data = values.of( { "Weight": weight, @@ -295,11 +302,14 @@ def update( "SipUrl": sip_url, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return OriginationUrlInstance( @@ -328,6 +338,7 @@ async def update_async( :returns: The updated OriginationUrlInstance """ + data = values.of( { "Weight": weight, @@ -337,11 +348,14 @@ async def update_async( "SipUrl": sip_url, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return OriginationUrlInstance( @@ -431,6 +445,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -470,6 +488,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -605,7 +627,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return OriginationUrlPage(self._version, response, self._solution) async def page_async( @@ -632,8 +660,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return OriginationUrlPage(self._version, response, self._solution) diff --git a/twilio/rest/trunking/v1/trunk/phone_number.py b/twilio/rest/trunking/v1/trunk/phone_number.py index 75cb5f6c64..a7c3dbe20d 100644 --- a/twilio/rest/trunking/v1/trunk/phone_number.py +++ b/twilio/rest/trunking/v1/trunk/phone_number.py @@ -199,10 +199,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -211,9 +211,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> PhoneNumberInstance: @@ -224,10 +226,11 @@ def fetch(self) -> PhoneNumberInstance: :returns: The fetched PhoneNumberInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return PhoneNumberInstance( self._version, @@ -244,9 +247,12 @@ async def fetch_async(self) -> PhoneNumberInstance: :returns: The fetched PhoneNumberInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return PhoneNumberInstance( @@ -321,6 +327,10 @@ def create(self, phone_number_sid: str) -> PhoneNumberInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -345,6 +355,10 @@ async def create_async(self, phone_number_sid: str) -> PhoneNumberInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -480,7 +494,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return PhoneNumberPage(self._version, response, self._solution) async def page_async( @@ -507,8 +527,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return PhoneNumberPage(self._version, response, self._solution) diff --git a/twilio/rest/trunking/v1/trunk/recording.py b/twilio/rest/trunking/v1/trunk/recording.py index 1a431b496b..0507662f24 100644 --- a/twilio/rest/trunking/v1/trunk/recording.py +++ b/twilio/rest/trunking/v1/trunk/recording.py @@ -153,10 +153,11 @@ def fetch(self) -> RecordingInstance: :returns: The fetched RecordingInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return RecordingInstance( self._version, @@ -172,9 +173,12 @@ async def fetch_async(self) -> RecordingInstance: :returns: The fetched RecordingInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return RecordingInstance( @@ -196,17 +200,21 @@ def update( :returns: The updated RecordingInstance """ + data = values.of( { "Mode": mode, "Trim": trim, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RecordingInstance( @@ -226,17 +234,21 @@ async def update_async( :returns: The updated RecordingInstance """ + data = values.of( { "Mode": mode, "Trim": trim, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RecordingInstance( diff --git a/twilio/rest/trusthub/v1/compliance_inquiries.py b/twilio/rest/trusthub/v1/compliance_inquiries.py index fe83b8630a..3c1abd596a 100644 --- a/twilio/rest/trusthub/v1/compliance_inquiries.py +++ b/twilio/rest/trusthub/v1/compliance_inquiries.py @@ -133,17 +133,21 @@ def update( :returns: The updated ComplianceInquiriesInstance """ + data = values.of( { "PrimaryProfileSid": primary_profile_sid, "ThemeSetId": theme_set_id, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ComplianceInquiriesInstance( @@ -161,17 +165,21 @@ async def update_async( :returns: The updated ComplianceInquiriesInstance """ + data = values.of( { "PrimaryProfileSid": primary_profile_sid, "ThemeSetId": theme_set_id, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ComplianceInquiriesInstance( @@ -226,6 +234,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -257,6 +269,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/trusthub/v1/compliance_registration_inquiries.py b/twilio/rest/trusthub/v1/compliance_registration_inquiries.py index 2f6c465341..eccd1ac8cf 100644 --- a/twilio/rest/trusthub/v1/compliance_registration_inquiries.py +++ b/twilio/rest/trusthub/v1/compliance_registration_inquiries.py @@ -164,17 +164,21 @@ def update( :returns: The updated ComplianceRegistrationInquiriesInstance """ + data = values.of( { "IsIsvEmbed": serialize.boolean_to_string(is_isv_embed), "ThemeSetId": theme_set_id, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ComplianceRegistrationInquiriesInstance( @@ -194,17 +198,21 @@ async def update_async( :returns: The updated ComplianceRegistrationInquiriesInstance """ + data = values.of( { "IsIsvEmbed": serialize.boolean_to_string(is_isv_embed), "ThemeSetId": theme_set_id, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ComplianceRegistrationInquiriesInstance( @@ -380,6 +388,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -528,6 +540,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/trusthub/v1/compliance_tollfree_inquiries.py b/twilio/rest/trusthub/v1/compliance_tollfree_inquiries.py index 4d8988ab41..9cf259a318 100644 --- a/twilio/rest/trusthub/v1/compliance_tollfree_inquiries.py +++ b/twilio/rest/trusthub/v1/compliance_tollfree_inquiries.py @@ -156,6 +156,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -251,6 +255,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/trusthub/v1/customer_profiles/__init__.py b/twilio/rest/trusthub/v1/customer_profiles/__init__.py index 5079b89e6d..bf5264e31d 100644 --- a/twilio/rest/trusthub/v1/customer_profiles/__init__.py +++ b/twilio/rest/trusthub/v1/customer_profiles/__init__.py @@ -254,10 +254,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -266,9 +266,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> CustomerProfilesInstance: @@ -279,10 +281,11 @@ def fetch(self) -> CustomerProfilesInstance: :returns: The fetched CustomerProfilesInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return CustomerProfilesInstance( self._version, @@ -298,9 +301,12 @@ async def fetch_async(self) -> CustomerProfilesInstance: :returns: The fetched CustomerProfilesInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return CustomerProfilesInstance( @@ -326,6 +332,7 @@ def update( :returns: The updated CustomerProfilesInstance """ + data = values.of( { "Status": status, @@ -334,11 +341,14 @@ def update( "Email": email, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CustomerProfilesInstance( @@ -362,6 +372,7 @@ async def update_async( :returns: The updated CustomerProfilesInstance """ + data = values.of( { "Status": status, @@ -370,11 +381,14 @@ async def update_async( "Email": email, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CustomerProfilesInstance( @@ -495,6 +509,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -529,6 +547,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -711,7 +733,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return CustomerProfilesPage(self._version, response) async def page_async( @@ -747,8 +775,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return CustomerProfilesPage(self._version, response) diff --git a/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_channel_endpoint_assignment.py b/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_channel_endpoint_assignment.py index 0369e51d5c..1adca541a8 100644 --- a/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_channel_endpoint_assignment.py +++ b/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_channel_endpoint_assignment.py @@ -150,10 +150,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -162,9 +162,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> CustomerProfilesChannelEndpointAssignmentInstance: @@ -175,10 +177,11 @@ def fetch(self) -> CustomerProfilesChannelEndpointAssignmentInstance: :returns: The fetched CustomerProfilesChannelEndpointAssignmentInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return CustomerProfilesChannelEndpointAssignmentInstance( self._version, @@ -195,9 +198,12 @@ async def fetch_async(self) -> CustomerProfilesChannelEndpointAssignmentInstance :returns: The fetched CustomerProfilesChannelEndpointAssignmentInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return CustomerProfilesChannelEndpointAssignmentInstance( @@ -284,6 +290,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -314,6 +324,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -485,7 +499,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return CustomerProfilesChannelEndpointAssignmentPage( self._version, response, self._solution ) @@ -520,8 +540,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return CustomerProfilesChannelEndpointAssignmentPage( self._version, response, self._solution diff --git a/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_entity_assignments.py b/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_entity_assignments.py index 8fbb523b8a..f8710b9cd8 100644 --- a/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_entity_assignments.py +++ b/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_entity_assignments.py @@ -152,10 +152,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -164,9 +164,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> CustomerProfilesEntityAssignmentsInstance: @@ -177,10 +179,11 @@ def fetch(self) -> CustomerProfilesEntityAssignmentsInstance: :returns: The fetched CustomerProfilesEntityAssignmentsInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return CustomerProfilesEntityAssignmentsInstance( self._version, @@ -197,9 +200,12 @@ async def fetch_async(self) -> CustomerProfilesEntityAssignmentsInstance: :returns: The fetched CustomerProfilesEntityAssignmentsInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return CustomerProfilesEntityAssignmentsInstance( @@ -284,6 +290,10 @@ def create(self, object_sid: str) -> CustomerProfilesEntityAssignmentsInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -312,6 +322,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -464,7 +478,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return CustomerProfilesEntityAssignmentsPage( self._version, response, self._solution ) @@ -496,8 +516,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return CustomerProfilesEntityAssignmentsPage( self._version, response, self._solution diff --git a/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_evaluations.py b/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_evaluations.py index b5c3ba746e..648467aac6 100644 --- a/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_evaluations.py +++ b/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_evaluations.py @@ -142,10 +142,11 @@ def fetch(self) -> CustomerProfilesEvaluationsInstance: :returns: The fetched CustomerProfilesEvaluationsInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return CustomerProfilesEvaluationsInstance( self._version, @@ -162,9 +163,12 @@ async def fetch_async(self) -> CustomerProfilesEvaluationsInstance: :returns: The fetched CustomerProfilesEvaluationsInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return CustomerProfilesEvaluationsInstance( @@ -247,6 +251,10 @@ def create(self, policy_sid: str) -> CustomerProfilesEvaluationsInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -275,6 +283,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -412,7 +424,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return CustomerProfilesEvaluationsPage(self._version, response, self._solution) async def page_async( @@ -439,8 +457,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return CustomerProfilesEvaluationsPage(self._version, response, self._solution) diff --git a/twilio/rest/trusthub/v1/end_user.py b/twilio/rest/trusthub/v1/end_user.py index 42bdb155e0..5ce3b819d9 100644 --- a/twilio/rest/trusthub/v1/end_user.py +++ b/twilio/rest/trusthub/v1/end_user.py @@ -178,10 +178,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -190,9 +190,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> EndUserInstance: @@ -203,10 +205,11 @@ def fetch(self) -> EndUserInstance: :returns: The fetched EndUserInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return EndUserInstance( self._version, @@ -222,9 +225,12 @@ async def fetch_async(self) -> EndUserInstance: :returns: The fetched EndUserInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return EndUserInstance( @@ -246,17 +252,21 @@ def update( :returns: The updated EndUserInstance """ + data = values.of( { "FriendlyName": friendly_name, "Attributes": serialize.object(attributes), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return EndUserInstance(self._version, payload, sid=self._solution["sid"]) @@ -274,17 +284,21 @@ async def update_async( :returns: The updated EndUserInstance """ + data = values.of( { "FriendlyName": friendly_name, "Attributes": serialize.object(attributes), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return EndUserInstance(self._version, payload, sid=self._solution["sid"]) @@ -356,6 +370,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -387,6 +405,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -520,7 +542,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return EndUserPage(self._version, response) async def page_async( @@ -547,8 +575,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return EndUserPage(self._version, response) diff --git a/twilio/rest/trusthub/v1/end_user_type.py b/twilio/rest/trusthub/v1/end_user_type.py index d336385b25..0eb2957e0a 100644 --- a/twilio/rest/trusthub/v1/end_user_type.py +++ b/twilio/rest/trusthub/v1/end_user_type.py @@ -114,10 +114,11 @@ def fetch(self) -> EndUserTypeInstance: :returns: The fetched EndUserTypeInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return EndUserTypeInstance( self._version, @@ -133,9 +134,12 @@ async def fetch_async(self) -> EndUserTypeInstance: :returns: The fetched EndUserTypeInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return EndUserTypeInstance( @@ -313,7 +317,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return EndUserTypePage(self._version, response) async def page_async( @@ -340,8 +350,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return EndUserTypePage(self._version, response) diff --git a/twilio/rest/trusthub/v1/policies.py b/twilio/rest/trusthub/v1/policies.py index a39b1e0e65..36a0916c51 100644 --- a/twilio/rest/trusthub/v1/policies.py +++ b/twilio/rest/trusthub/v1/policies.py @@ -112,10 +112,11 @@ def fetch(self) -> PoliciesInstance: :returns: The fetched PoliciesInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return PoliciesInstance( self._version, @@ -131,9 +132,12 @@ async def fetch_async(self) -> PoliciesInstance: :returns: The fetched PoliciesInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return PoliciesInstance( @@ -311,7 +315,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return PoliciesPage(self._version, response) async def page_async( @@ -338,8 +348,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return PoliciesPage(self._version, response) diff --git a/twilio/rest/trusthub/v1/supporting_document.py b/twilio/rest/trusthub/v1/supporting_document.py index 2336e1fefa..b53d7d319c 100644 --- a/twilio/rest/trusthub/v1/supporting_document.py +++ b/twilio/rest/trusthub/v1/supporting_document.py @@ -193,10 +193,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -205,9 +205,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> SupportingDocumentInstance: @@ -218,10 +220,11 @@ def fetch(self) -> SupportingDocumentInstance: :returns: The fetched SupportingDocumentInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return SupportingDocumentInstance( self._version, @@ -237,9 +240,12 @@ async def fetch_async(self) -> SupportingDocumentInstance: :returns: The fetched SupportingDocumentInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return SupportingDocumentInstance( @@ -261,17 +267,21 @@ def update( :returns: The updated SupportingDocumentInstance """ + data = values.of( { "FriendlyName": friendly_name, "Attributes": serialize.object(attributes), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SupportingDocumentInstance( @@ -291,17 +301,21 @@ async def update_async( :returns: The updated SupportingDocumentInstance """ + data = values.of( { "FriendlyName": friendly_name, "Attributes": serialize.object(attributes), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SupportingDocumentInstance( @@ -375,6 +389,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -406,6 +424,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -539,7 +561,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return SupportingDocumentPage(self._version, response) async def page_async( @@ -566,8 +594,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return SupportingDocumentPage(self._version, response) diff --git a/twilio/rest/trusthub/v1/supporting_document_type.py b/twilio/rest/trusthub/v1/supporting_document_type.py index f1a93c59b7..f107397a4c 100644 --- a/twilio/rest/trusthub/v1/supporting_document_type.py +++ b/twilio/rest/trusthub/v1/supporting_document_type.py @@ -114,10 +114,11 @@ def fetch(self) -> SupportingDocumentTypeInstance: :returns: The fetched SupportingDocumentTypeInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return SupportingDocumentTypeInstance( self._version, @@ -133,9 +134,12 @@ async def fetch_async(self) -> SupportingDocumentTypeInstance: :returns: The fetched SupportingDocumentTypeInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return SupportingDocumentTypeInstance( @@ -313,7 +317,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return SupportingDocumentTypePage(self._version, response) async def page_async( @@ -340,8 +350,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return SupportingDocumentTypePage(self._version, response) diff --git a/twilio/rest/trusthub/v1/trust_products/__init__.py b/twilio/rest/trusthub/v1/trust_products/__init__.py index c819eb0a07..6bb01d61dc 100644 --- a/twilio/rest/trusthub/v1/trust_products/__init__.py +++ b/twilio/rest/trusthub/v1/trust_products/__init__.py @@ -250,10 +250,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -262,9 +262,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> TrustProductsInstance: @@ -275,10 +277,11 @@ def fetch(self) -> TrustProductsInstance: :returns: The fetched TrustProductsInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return TrustProductsInstance( self._version, @@ -294,9 +297,12 @@ async def fetch_async(self) -> TrustProductsInstance: :returns: The fetched TrustProductsInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return TrustProductsInstance( @@ -322,6 +328,7 @@ def update( :returns: The updated TrustProductsInstance """ + data = values.of( { "Status": status, @@ -330,11 +337,14 @@ def update( "Email": email, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return TrustProductsInstance(self._version, payload, sid=self._solution["sid"]) @@ -356,6 +366,7 @@ async def update_async( :returns: The updated TrustProductsInstance """ + data = values.of( { "Status": status, @@ -364,11 +375,14 @@ async def update_async( "Email": email, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return TrustProductsInstance(self._version, payload, sid=self._solution["sid"]) @@ -485,6 +499,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -519,6 +537,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -701,7 +723,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return TrustProductsPage(self._version, response) async def page_async( @@ -737,8 +765,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return TrustProductsPage(self._version, response) diff --git a/twilio/rest/trusthub/v1/trust_products/trust_products_channel_endpoint_assignment.py b/twilio/rest/trusthub/v1/trust_products/trust_products_channel_endpoint_assignment.py index df69d31ddf..adf9c51f51 100644 --- a/twilio/rest/trusthub/v1/trust_products/trust_products_channel_endpoint_assignment.py +++ b/twilio/rest/trusthub/v1/trust_products/trust_products_channel_endpoint_assignment.py @@ -150,10 +150,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -162,9 +162,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> TrustProductsChannelEndpointAssignmentInstance: @@ -175,10 +177,11 @@ def fetch(self) -> TrustProductsChannelEndpointAssignmentInstance: :returns: The fetched TrustProductsChannelEndpointAssignmentInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return TrustProductsChannelEndpointAssignmentInstance( self._version, @@ -195,9 +198,12 @@ async def fetch_async(self) -> TrustProductsChannelEndpointAssignmentInstance: :returns: The fetched TrustProductsChannelEndpointAssignmentInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return TrustProductsChannelEndpointAssignmentInstance( @@ -286,6 +292,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -316,6 +326,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -487,7 +501,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return TrustProductsChannelEndpointAssignmentPage( self._version, response, self._solution ) @@ -522,8 +542,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return TrustProductsChannelEndpointAssignmentPage( self._version, response, self._solution diff --git a/twilio/rest/trusthub/v1/trust_products/trust_products_entity_assignments.py b/twilio/rest/trusthub/v1/trust_products/trust_products_entity_assignments.py index 57e1b3119c..ebda7ee8c0 100644 --- a/twilio/rest/trusthub/v1/trust_products/trust_products_entity_assignments.py +++ b/twilio/rest/trusthub/v1/trust_products/trust_products_entity_assignments.py @@ -148,10 +148,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -160,9 +160,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> TrustProductsEntityAssignmentsInstance: @@ -173,10 +175,11 @@ def fetch(self) -> TrustProductsEntityAssignmentsInstance: :returns: The fetched TrustProductsEntityAssignmentsInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return TrustProductsEntityAssignmentsInstance( self._version, @@ -193,9 +196,12 @@ async def fetch_async(self) -> TrustProductsEntityAssignmentsInstance: :returns: The fetched TrustProductsEntityAssignmentsInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return TrustProductsEntityAssignmentsInstance( @@ -278,6 +284,10 @@ def create(self, object_sid: str) -> TrustProductsEntityAssignmentsInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -306,6 +316,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -458,7 +472,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return TrustProductsEntityAssignmentsPage( self._version, response, self._solution ) @@ -490,8 +510,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return TrustProductsEntityAssignmentsPage( self._version, response, self._solution diff --git a/twilio/rest/trusthub/v1/trust_products/trust_products_evaluations.py b/twilio/rest/trusthub/v1/trust_products/trust_products_evaluations.py index 3088a2b1b4..3691aa017b 100644 --- a/twilio/rest/trusthub/v1/trust_products/trust_products_evaluations.py +++ b/twilio/rest/trusthub/v1/trust_products/trust_products_evaluations.py @@ -142,10 +142,11 @@ def fetch(self) -> TrustProductsEvaluationsInstance: :returns: The fetched TrustProductsEvaluationsInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return TrustProductsEvaluationsInstance( self._version, @@ -162,9 +163,12 @@ async def fetch_async(self) -> TrustProductsEvaluationsInstance: :returns: The fetched TrustProductsEvaluationsInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return TrustProductsEvaluationsInstance( @@ -243,6 +247,10 @@ def create(self, policy_sid: str) -> TrustProductsEvaluationsInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -269,6 +277,10 @@ async def create_async(self, policy_sid: str) -> TrustProductsEvaluationsInstanc ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -406,7 +418,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return TrustProductsEvaluationsPage(self._version, response, self._solution) async def page_async( @@ -433,8 +451,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return TrustProductsEvaluationsPage(self._version, response, self._solution) diff --git a/twilio/rest/verify/v2/form.py b/twilio/rest/verify/v2/form.py index 6e3231fcda..454030208d 100644 --- a/twilio/rest/verify/v2/form.py +++ b/twilio/rest/verify/v2/form.py @@ -13,6 +13,7 @@ """ from typing import Any, Dict, Optional +from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -117,10 +118,11 @@ def fetch(self) -> FormInstance: :returns: The fetched FormInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return FormInstance( self._version, @@ -136,9 +138,12 @@ async def fetch_async(self) -> FormInstance: :returns: The fetched FormInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return FormInstance( diff --git a/twilio/rest/verify/v2/safelist.py b/twilio/rest/verify/v2/safelist.py index 0ee946a342..00fc0976f7 100644 --- a/twilio/rest/verify/v2/safelist.py +++ b/twilio/rest/verify/v2/safelist.py @@ -129,10 +129,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -141,9 +141,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> SafelistInstance: @@ -154,10 +156,11 @@ def fetch(self) -> SafelistInstance: :returns: The fetched SafelistInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return SafelistInstance( self._version, @@ -173,9 +176,12 @@ async def fetch_async(self) -> SafelistInstance: :returns: The fetched SafelistInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return SafelistInstance( @@ -223,6 +229,10 @@ def create(self, phone_number: str) -> SafelistInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -245,6 +255,10 @@ async def create_async(self, phone_number: str) -> SafelistInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/verify/v2/service/__init__.py b/twilio/rest/verify/v2/service/__init__.py index 9b8b4b4da9..207e8e7b53 100644 --- a/twilio/rest/verify/v2/service/__init__.py +++ b/twilio/rest/verify/v2/service/__init__.py @@ -384,10 +384,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -396,9 +396,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> ServiceInstance: @@ -409,10 +411,11 @@ def fetch(self) -> ServiceInstance: :returns: The fetched ServiceInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ServiceInstance( self._version, @@ -428,9 +431,12 @@ async def fetch_async(self) -> ServiceInstance: :returns: The fetched ServiceInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ServiceInstance( @@ -488,6 +494,7 @@ def update( :returns: The updated ServiceInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -518,11 +525,14 @@ def update( ), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload, sid=self._solution["sid"]) @@ -576,6 +586,7 @@ async def update_async( :returns: The updated ServiceInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -606,11 +617,14 @@ async def update_async( ), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ServiceInstance(self._version, payload, sid=self._solution["sid"]) @@ -823,6 +837,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -911,6 +929,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -1044,7 +1066,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ServicePage(self._version, response) async def page_async( @@ -1071,8 +1099,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ServicePage(self._version, response) diff --git a/twilio/rest/verify/v2/service/access_token.py b/twilio/rest/verify/v2/service/access_token.py index 917abbc965..45a0094e52 100644 --- a/twilio/rest/verify/v2/service/access_token.py +++ b/twilio/rest/verify/v2/service/access_token.py @@ -142,10 +142,11 @@ def fetch(self) -> AccessTokenInstance: :returns: The fetched AccessTokenInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return AccessTokenInstance( self._version, @@ -162,9 +163,12 @@ async def fetch_async(self) -> AccessTokenInstance: :returns: The fetched AccessTokenInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return AccessTokenInstance( @@ -230,6 +234,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -266,6 +274,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/verify/v2/service/entity/__init__.py b/twilio/rest/verify/v2/service/entity/__init__.py index 7371edc08f..fa4bc1df12 100644 --- a/twilio/rest/verify/v2/service/entity/__init__.py +++ b/twilio/rest/verify/v2/service/entity/__init__.py @@ -180,10 +180,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -192,9 +192,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> EntityInstance: @@ -205,10 +207,11 @@ def fetch(self) -> EntityInstance: :returns: The fetched EntityInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return EntityInstance( self._version, @@ -225,9 +228,12 @@ async def fetch_async(self) -> EntityInstance: :returns: The fetched EntityInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return EntityInstance( @@ -341,6 +347,10 @@ def create(self, identity: str) -> EntityInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -365,6 +375,10 @@ async def create_async(self, identity: str) -> EntityInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -500,7 +514,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return EntityPage(self._version, response, self._solution) async def page_async( @@ -527,8 +547,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return EntityPage(self._version, response, self._solution) diff --git a/twilio/rest/verify/v2/service/entity/challenge/__init__.py b/twilio/rest/verify/v2/service/entity/challenge/__init__.py index 9ca2e4089b..146a95d959 100644 --- a/twilio/rest/verify/v2/service/entity/challenge/__init__.py +++ b/twilio/rest/verify/v2/service/entity/challenge/__init__.py @@ -238,10 +238,11 @@ def fetch(self) -> ChallengeInstance: :returns: The fetched ChallengeInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ChallengeInstance( self._version, @@ -259,9 +260,12 @@ async def fetch_async(self) -> ChallengeInstance: :returns: The fetched ChallengeInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ChallengeInstance( @@ -285,17 +289,21 @@ def update( :returns: The updated ChallengeInstance """ + data = values.of( { "AuthPayload": auth_payload, "Metadata": serialize.object(metadata), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ChallengeInstance( @@ -319,17 +327,21 @@ async def update_async( :returns: The updated ChallengeInstance """ + data = values.of( { "AuthPayload": auth_payload, "Metadata": serialize.object(metadata), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ChallengeInstance( @@ -446,6 +458,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -493,6 +509,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -680,7 +700,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ChallengePage(self._version, response, self._solution) async def page_async( @@ -716,8 +742,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ChallengePage(self._version, response, self._solution) diff --git a/twilio/rest/verify/v2/service/entity/challenge/notification.py b/twilio/rest/verify/v2/service/entity/challenge/notification.py index eadf42b81d..3802cc1a08 100644 --- a/twilio/rest/verify/v2/service/entity/challenge/notification.py +++ b/twilio/rest/verify/v2/service/entity/challenge/notification.py @@ -114,6 +114,10 @@ def create(self, ttl: Union[int, object] = values.unset) -> NotificationInstance ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -144,6 +148,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/verify/v2/service/entity/factor.py b/twilio/rest/verify/v2/service/entity/factor.py index 8900fcbfc2..7bf91cd870 100644 --- a/twilio/rest/verify/v2/service/entity/factor.py +++ b/twilio/rest/verify/v2/service/entity/factor.py @@ -261,10 +261,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -273,9 +273,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> FactorInstance: @@ -286,10 +288,11 @@ def fetch(self) -> FactorInstance: :returns: The fetched FactorInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return FactorInstance( self._version, @@ -307,9 +310,12 @@ async def fetch_async(self) -> FactorInstance: :returns: The fetched FactorInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return FactorInstance( @@ -347,6 +353,7 @@ def update( :returns: The updated FactorInstance """ + data = values.of( { "AuthPayload": auth_payload, @@ -360,11 +367,14 @@ def update( "Config.NotificationPlatform": config_notification_platform, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return FactorInstance( @@ -402,6 +412,7 @@ async def update_async( :returns: The updated FactorInstance """ + data = values.of( { "AuthPayload": auth_payload, @@ -415,11 +426,14 @@ async def update_async( "Config.NotificationPlatform": config_notification_platform, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return FactorInstance( @@ -613,7 +627,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return FactorPage(self._version, response, self._solution) async def page_async( @@ -640,8 +660,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return FactorPage(self._version, response, self._solution) diff --git a/twilio/rest/verify/v2/service/entity/new_factor.py b/twilio/rest/verify/v2/service/entity/new_factor.py index c88a945853..2a2d77d512 100644 --- a/twilio/rest/verify/v2/service/entity/new_factor.py +++ b/twilio/rest/verify/v2/service/entity/new_factor.py @@ -183,6 +183,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -254,6 +258,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/verify/v2/service/messaging_configuration.py b/twilio/rest/verify/v2/service/messaging_configuration.py index b841770331..03f494f6e9 100644 --- a/twilio/rest/verify/v2/service/messaging_configuration.py +++ b/twilio/rest/verify/v2/service/messaging_configuration.py @@ -176,10 +176,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -188,9 +188,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> MessagingConfigurationInstance: @@ -201,10 +203,11 @@ def fetch(self) -> MessagingConfigurationInstance: :returns: The fetched MessagingConfigurationInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return MessagingConfigurationInstance( self._version, @@ -221,9 +224,12 @@ async def fetch_async(self) -> MessagingConfigurationInstance: :returns: The fetched MessagingConfigurationInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return MessagingConfigurationInstance( @@ -241,16 +247,20 @@ def update(self, messaging_service_sid: str) -> MessagingConfigurationInstance: :returns: The updated MessagingConfigurationInstance """ + data = values.of( { "MessagingServiceSid": messaging_service_sid, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return MessagingConfigurationInstance( @@ -270,16 +280,20 @@ async def update_async( :returns: The updated MessagingConfigurationInstance """ + data = values.of( { "MessagingServiceSid": messaging_service_sid, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return MessagingConfigurationInstance( @@ -360,6 +374,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -388,6 +406,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -523,7 +545,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return MessagingConfigurationPage(self._version, response, self._solution) async def page_async( @@ -550,8 +578,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return MessagingConfigurationPage(self._version, response, self._solution) diff --git a/twilio/rest/verify/v2/service/rate_limit/__init__.py b/twilio/rest/verify/v2/service/rate_limit/__init__.py index bdd165858a..ced5ab6a64 100644 --- a/twilio/rest/verify/v2/service/rate_limit/__init__.py +++ b/twilio/rest/verify/v2/service/rate_limit/__init__.py @@ -190,10 +190,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -202,9 +202,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> RateLimitInstance: @@ -215,10 +217,11 @@ def fetch(self) -> RateLimitInstance: :returns: The fetched RateLimitInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return RateLimitInstance( self._version, @@ -235,9 +238,12 @@ async def fetch_async(self) -> RateLimitInstance: :returns: The fetched RateLimitInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return RateLimitInstance( @@ -257,16 +263,20 @@ def update( :returns: The updated RateLimitInstance """ + data = values.of( { "Description": description, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RateLimitInstance( @@ -286,16 +296,20 @@ async def update_async( :returns: The updated RateLimitInstance """ + data = values.of( { "Description": description, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RateLimitInstance( @@ -387,6 +401,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -415,6 +433,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -550,7 +572,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return RateLimitPage(self._version, response, self._solution) async def page_async( @@ -577,8 +605,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return RateLimitPage(self._version, response, self._solution) diff --git a/twilio/rest/verify/v2/service/rate_limit/bucket.py b/twilio/rest/verify/v2/service/rate_limit/bucket.py index dee84901e5..4ac50cfc2f 100644 --- a/twilio/rest/verify/v2/service/rate_limit/bucket.py +++ b/twilio/rest/verify/v2/service/rate_limit/bucket.py @@ -199,10 +199,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -211,9 +211,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> BucketInstance: @@ -224,10 +226,11 @@ def fetch(self) -> BucketInstance: :returns: The fetched BucketInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return BucketInstance( self._version, @@ -245,9 +248,12 @@ async def fetch_async(self) -> BucketInstance: :returns: The fetched BucketInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return BucketInstance( @@ -271,17 +277,21 @@ def update( :returns: The updated BucketInstance """ + data = values.of( { "Max": max, "Interval": interval, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return BucketInstance( @@ -305,17 +315,21 @@ async def update_async( :returns: The updated BucketInstance """ + data = values.of( { "Max": max, "Interval": interval, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return BucketInstance( @@ -402,6 +416,10 @@ def create(self, max: int, interval: int) -> BucketInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -431,6 +449,10 @@ async def create_async(self, max: int, interval: int) -> BucketInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -569,7 +591,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return BucketPage(self._version, response, self._solution) async def page_async( @@ -596,8 +624,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return BucketPage(self._version, response, self._solution) diff --git a/twilio/rest/verify/v2/service/verification.py b/twilio/rest/verify/v2/service/verification.py index 23a956b65f..64988a5983 100644 --- a/twilio/rest/verify/v2/service/verification.py +++ b/twilio/rest/verify/v2/service/verification.py @@ -192,10 +192,11 @@ def fetch(self) -> VerificationInstance: :returns: The fetched VerificationInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return VerificationInstance( self._version, @@ -212,9 +213,12 @@ async def fetch_async(self) -> VerificationInstance: :returns: The fetched VerificationInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return VerificationInstance( @@ -232,16 +236,20 @@ def update(self, status: "VerificationInstance.Status") -> VerificationInstance: :returns: The updated VerificationInstance """ + data = values.of( { "Status": status, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return VerificationInstance( @@ -261,16 +269,20 @@ async def update_async( :returns: The updated VerificationInstance """ + data = values.of( { "Status": status, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return VerificationInstance( @@ -380,6 +392,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -460,6 +476,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/verify/v2/service/verification_check.py b/twilio/rest/verify/v2/service/verification_check.py index fd1b3f897c..c09057ebe1 100644 --- a/twilio/rest/verify/v2/service/verification_check.py +++ b/twilio/rest/verify/v2/service/verification_check.py @@ -135,6 +135,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -177,6 +181,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/verify/v2/service/webhook.py b/twilio/rest/verify/v2/service/webhook.py index 67ffced265..dd68cf301b 100644 --- a/twilio/rest/verify/v2/service/webhook.py +++ b/twilio/rest/verify/v2/service/webhook.py @@ -227,10 +227,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -239,9 +239,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> WebhookInstance: @@ -252,10 +254,11 @@ def fetch(self) -> WebhookInstance: :returns: The fetched WebhookInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return WebhookInstance( self._version, @@ -272,9 +275,12 @@ async def fetch_async(self) -> WebhookInstance: :returns: The fetched WebhookInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return WebhookInstance( @@ -303,6 +309,7 @@ def update( :returns: The updated WebhookInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -312,11 +319,14 @@ def update( "Version": version, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return WebhookInstance( @@ -345,6 +355,7 @@ async def update_async( :returns: The updated WebhookInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -354,11 +365,14 @@ async def update_async( "Version": version, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return WebhookInstance( @@ -448,6 +462,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -487,6 +505,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -622,7 +644,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return WebhookPage(self._version, response, self._solution) async def page_async( @@ -649,8 +677,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return WebhookPage(self._version, response, self._solution) diff --git a/twilio/rest/verify/v2/template.py b/twilio/rest/verify/v2/template.py index b9968eec87..5a242c153e 100644 --- a/twilio/rest/verify/v2/template.py +++ b/twilio/rest/verify/v2/template.py @@ -223,7 +223,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return TemplatePage(self._version, response) async def page_async( @@ -253,8 +259,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return TemplatePage(self._version, response) diff --git a/twilio/rest/verify/v2/verification_attempt.py b/twilio/rest/verify/v2/verification_attempt.py index 2c1f914d32..5c6989348a 100644 --- a/twilio/rest/verify/v2/verification_attempt.py +++ b/twilio/rest/verify/v2/verification_attempt.py @@ -146,10 +146,11 @@ def fetch(self) -> VerificationAttemptInstance: :returns: The fetched VerificationAttemptInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return VerificationAttemptInstance( self._version, @@ -165,9 +166,12 @@ async def fetch_async(self) -> VerificationAttemptInstance: :returns: The fetched VerificationAttemptInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return VerificationAttemptInstance( @@ -479,7 +483,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return VerificationAttemptPage(self._version, response) async def page_async( @@ -532,8 +542,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return VerificationAttemptPage(self._version, response) diff --git a/twilio/rest/verify/v2/verification_attempts_summary.py b/twilio/rest/verify/v2/verification_attempts_summary.py index 1f2d3d3955..429e9f70bc 100644 --- a/twilio/rest/verify/v2/verification_attempts_summary.py +++ b/twilio/rest/verify/v2/verification_attempts_summary.py @@ -191,7 +191,13 @@ def fetch( } ) - payload = self._version.fetch(method="GET", uri=self._uri, params=data) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch( + method="GET", uri=self._uri, params=data, headers=headers + ) return VerificationAttemptsSummaryInstance( self._version, @@ -233,8 +239,12 @@ async def fetch_async( } ) + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return VerificationAttemptsSummaryInstance( diff --git a/twilio/rest/video/v1/composition.py b/twilio/rest/video/v1/composition.py index 8add1e74e5..06f4d05f5f 100644 --- a/twilio/rest/video/v1/composition.py +++ b/twilio/rest/video/v1/composition.py @@ -188,10 +188,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -200,9 +200,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> CompositionInstance: @@ -213,10 +215,11 @@ def fetch(self) -> CompositionInstance: :returns: The fetched CompositionInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return CompositionInstance( self._version, @@ -232,9 +235,12 @@ async def fetch_async(self) -> CompositionInstance: :returns: The fetched CompositionInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return CompositionInstance( @@ -330,6 +336,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -381,6 +391,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -578,7 +592,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return CompositionPage(self._version, response) async def page_async( @@ -617,8 +637,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return CompositionPage(self._version, response) diff --git a/twilio/rest/video/v1/composition_hook.py b/twilio/rest/video/v1/composition_hook.py index 0f833f793f..30fead17b0 100644 --- a/twilio/rest/video/v1/composition_hook.py +++ b/twilio/rest/video/v1/composition_hook.py @@ -249,10 +249,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -261,9 +261,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> CompositionHookInstance: @@ -274,10 +276,11 @@ def fetch(self) -> CompositionHookInstance: :returns: The fetched CompositionHookInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return CompositionHookInstance( self._version, @@ -293,9 +296,12 @@ async def fetch_async(self) -> CompositionHookInstance: :returns: The fetched CompositionHookInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return CompositionHookInstance( @@ -333,6 +339,7 @@ def update( :returns: The updated CompositionHookInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -349,11 +356,14 @@ def update( "StatusCallbackMethod": status_callback_method, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CompositionHookInstance( @@ -389,6 +399,7 @@ async def update_async( :returns: The updated CompositionHookInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -405,11 +416,14 @@ async def update_async( "StatusCallbackMethod": status_callback_method, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return CompositionHookInstance( @@ -506,6 +520,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -560,6 +578,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -757,7 +779,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return CompositionHookPage(self._version, response) async def page_async( @@ -796,8 +824,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return CompositionHookPage(self._version, response) diff --git a/twilio/rest/video/v1/composition_settings.py b/twilio/rest/video/v1/composition_settings.py index 366ec727cf..384ae692e8 100644 --- a/twilio/rest/video/v1/composition_settings.py +++ b/twilio/rest/video/v1/composition_settings.py @@ -242,10 +242,11 @@ def fetch(self) -> CompositionSettingsInstance: :returns: The fetched CompositionSettingsInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return CompositionSettingsInstance( self._version, @@ -260,9 +261,12 @@ async def fetch_async(self) -> CompositionSettingsInstance: :returns: The fetched CompositionSettingsInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return CompositionSettingsInstance( diff --git a/twilio/rest/video/v1/recording.py b/twilio/rest/video/v1/recording.py index 20c836d2b0..f474345fe0 100644 --- a/twilio/rest/video/v1/recording.py +++ b/twilio/rest/video/v1/recording.py @@ -188,10 +188,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -200,9 +200,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> RecordingInstance: @@ -213,10 +215,11 @@ def fetch(self) -> RecordingInstance: :returns: The fetched RecordingInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return RecordingInstance( self._version, @@ -232,9 +235,12 @@ async def fetch_async(self) -> RecordingInstance: :returns: The fetched RecordingInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return RecordingInstance( @@ -506,7 +512,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return RecordingPage(self._version, response) async def page_async( @@ -551,8 +563,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return RecordingPage(self._version, response) diff --git a/twilio/rest/video/v1/recording_settings.py b/twilio/rest/video/v1/recording_settings.py index 3895b9d4ba..46259b6cf8 100644 --- a/twilio/rest/video/v1/recording_settings.py +++ b/twilio/rest/video/v1/recording_settings.py @@ -242,10 +242,11 @@ def fetch(self) -> RecordingSettingsInstance: :returns: The fetched RecordingSettingsInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return RecordingSettingsInstance( self._version, @@ -260,9 +261,12 @@ async def fetch_async(self) -> RecordingSettingsInstance: :returns: The fetched RecordingSettingsInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return RecordingSettingsInstance( diff --git a/twilio/rest/video/v1/room/__init__.py b/twilio/rest/video/v1/room/__init__.py index 4a6822c94b..0fb7a7b0dd 100644 --- a/twilio/rest/video/v1/room/__init__.py +++ b/twilio/rest/video/v1/room/__init__.py @@ -243,10 +243,11 @@ def fetch(self) -> RoomInstance: :returns: The fetched RoomInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return RoomInstance( self._version, @@ -262,9 +263,12 @@ async def fetch_async(self) -> RoomInstance: :returns: The fetched RoomInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return RoomInstance( @@ -281,16 +285,20 @@ def update(self, status: "RoomInstance.RoomStatus") -> RoomInstance: :returns: The updated RoomInstance """ + data = values.of( { "Status": status, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RoomInstance(self._version, payload, sid=self._solution["sid"]) @@ -303,16 +311,20 @@ async def update_async(self, status: "RoomInstance.RoomStatus") -> RoomInstance: :returns: The updated RoomInstance """ + data = values.of( { "Status": status, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RoomInstance(self._version, payload, sid=self._solution["sid"]) @@ -458,6 +470,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -527,6 +543,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -724,7 +744,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return RoomPage(self._version, response) async def page_async( @@ -763,8 +789,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return RoomPage(self._version, response) diff --git a/twilio/rest/video/v1/room/participant/__init__.py b/twilio/rest/video/v1/room/participant/__init__.py index 145d95429a..756a166eae 100644 --- a/twilio/rest/video/v1/room/participant/__init__.py +++ b/twilio/rest/video/v1/room/participant/__init__.py @@ -215,10 +215,11 @@ def fetch(self) -> ParticipantInstance: :returns: The fetched ParticipantInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ParticipantInstance( self._version, @@ -235,9 +236,12 @@ async def fetch_async(self) -> ParticipantInstance: :returns: The fetched ParticipantInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ParticipantInstance( @@ -257,16 +261,20 @@ def update( :returns: The updated ParticipantInstance """ + data = values.of( { "Status": status, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ParticipantInstance( @@ -286,16 +294,20 @@ async def update_async( :returns: The updated ParticipantInstance """ + data = values.of( { "Status": status, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ParticipantInstance( @@ -597,7 +609,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ParticipantPage(self._version, response, self._solution) async def page_async( @@ -636,8 +654,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ParticipantPage(self._version, response, self._solution) diff --git a/twilio/rest/video/v1/room/participant/anonymize.py b/twilio/rest/video/v1/room/participant/anonymize.py index e9a7f1383e..0560d3eff4 100644 --- a/twilio/rest/video/v1/room/participant/anonymize.py +++ b/twilio/rest/video/v1/room/participant/anonymize.py @@ -144,12 +144,14 @@ def update(self) -> AnonymizeInstance: :returns: The updated AnonymizeInstance """ + data = values.of({}) + headers = values.of({}) + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AnonymizeInstance( @@ -166,12 +168,14 @@ async def update_async(self) -> AnonymizeInstance: :returns: The updated AnonymizeInstance """ + data = values.of({}) + headers = values.of({}) + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return AnonymizeInstance( diff --git a/twilio/rest/video/v1/room/participant/published_track.py b/twilio/rest/video/v1/room/participant/published_track.py index 1fa84827b6..a766b276ab 100644 --- a/twilio/rest/video/v1/room/participant/published_track.py +++ b/twilio/rest/video/v1/room/participant/published_track.py @@ -148,10 +148,11 @@ def fetch(self) -> PublishedTrackInstance: :returns: The fetched PublishedTrackInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return PublishedTrackInstance( self._version, @@ -169,9 +170,12 @@ async def fetch_async(self) -> PublishedTrackInstance: :returns: The fetched PublishedTrackInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return PublishedTrackInstance( @@ -367,7 +371,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return PublishedTrackPage(self._version, response, self._solution) async def page_async( @@ -394,8 +404,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return PublishedTrackPage(self._version, response, self._solution) diff --git a/twilio/rest/video/v1/room/participant/subscribe_rules.py b/twilio/rest/video/v1/room/participant/subscribe_rules.py index a155038493..992f8a374b 100644 --- a/twilio/rest/video/v1/room/participant/subscribe_rules.py +++ b/twilio/rest/video/v1/room/participant/subscribe_rules.py @@ -97,6 +97,8 @@ def fetch(self) -> SubscribeRulesInstance: """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Accept"] = "application/json" + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return SubscribeRulesInstance( @@ -115,6 +117,8 @@ async def fetch_async(self) -> SubscribeRulesInstance: """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( method="GET", uri=self._uri, headers=headers ) @@ -144,6 +148,10 @@ def update( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.update( method="POST", uri=self._uri, data=data, headers=headers ) @@ -173,6 +181,10 @@ async def update_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.update_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/video/v1/room/participant/subscribed_track.py b/twilio/rest/video/v1/room/participant/subscribed_track.py index 7c915095ec..8baea148dc 100644 --- a/twilio/rest/video/v1/room/participant/subscribed_track.py +++ b/twilio/rest/video/v1/room/participant/subscribed_track.py @@ -150,10 +150,11 @@ def fetch(self) -> SubscribedTrackInstance: :returns: The fetched SubscribedTrackInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return SubscribedTrackInstance( self._version, @@ -171,9 +172,12 @@ async def fetch_async(self) -> SubscribedTrackInstance: :returns: The fetched SubscribedTrackInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return SubscribedTrackInstance( @@ -369,7 +373,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return SubscribedTrackPage(self._version, response, self._solution) async def page_async( @@ -396,8 +406,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return SubscribedTrackPage(self._version, response, self._solution) diff --git a/twilio/rest/video/v1/room/recording_rules.py b/twilio/rest/video/v1/room/recording_rules.py index f85ebe896e..d79d465c28 100644 --- a/twilio/rest/video/v1/room/recording_rules.py +++ b/twilio/rest/video/v1/room/recording_rules.py @@ -82,6 +82,8 @@ def fetch(self) -> RecordingRulesInstance: """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Accept"] = "application/json" + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return RecordingRulesInstance( @@ -97,6 +99,8 @@ async def fetch_async(self) -> RecordingRulesInstance: """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( method="GET", uri=self._uri, headers=headers ) @@ -123,6 +127,10 @@ def update( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.update( method="POST", uri=self._uri, data=data, headers=headers ) @@ -149,6 +157,10 @@ async def update_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.update_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/video/v1/room/room_recording.py b/twilio/rest/video/v1/room/room_recording.py index db67f29947..21d433ce38 100644 --- a/twilio/rest/video/v1/room/room_recording.py +++ b/twilio/rest/video/v1/room/room_recording.py @@ -192,10 +192,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -204,9 +204,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> RoomRecordingInstance: @@ -217,10 +219,11 @@ def fetch(self) -> RoomRecordingInstance: :returns: The fetched RoomRecordingInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return RoomRecordingInstance( self._version, @@ -237,9 +240,12 @@ async def fetch_async(self) -> RoomRecordingInstance: :returns: The fetched RoomRecordingInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return RoomRecordingInstance( @@ -489,7 +495,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return RoomRecordingPage(self._version, response, self._solution) async def page_async( @@ -528,8 +540,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return RoomRecordingPage(self._version, response, self._solution) diff --git a/twilio/rest/voice/v1/archived_call.py b/twilio/rest/voice/v1/archived_call.py index ec8a5bb68e..939f1a03e2 100644 --- a/twilio/rest/voice/v1/archived_call.py +++ b/twilio/rest/voice/v1/archived_call.py @@ -13,6 +13,7 @@ """ from datetime import date +from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.list_resource import ListResource @@ -45,10 +46,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -57,9 +58,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def __repr__(self) -> str: diff --git a/twilio/rest/voice/v1/byoc_trunk.py b/twilio/rest/voice/v1/byoc_trunk.py index 1c3e301d7a..304bdd78a5 100644 --- a/twilio/rest/voice/v1/byoc_trunk.py +++ b/twilio/rest/voice/v1/byoc_trunk.py @@ -242,10 +242,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -254,9 +254,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> ByocTrunkInstance: @@ -267,10 +269,11 @@ def fetch(self) -> ByocTrunkInstance: :returns: The fetched ByocTrunkInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ByocTrunkInstance( self._version, @@ -286,9 +289,12 @@ async def fetch_async(self) -> ByocTrunkInstance: :returns: The fetched ByocTrunkInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ByocTrunkInstance( @@ -326,6 +332,7 @@ def update( :returns: The updated ByocTrunkInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -340,11 +347,14 @@ def update( "FromDomainSid": from_domain_sid, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ByocTrunkInstance(self._version, payload, sid=self._solution["sid"]) @@ -378,6 +388,7 @@ async def update_async( :returns: The updated ByocTrunkInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -392,11 +403,14 @@ async def update_async( "FromDomainSid": from_domain_sid, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ByocTrunkInstance(self._version, payload, sid=self._solution["sid"]) @@ -489,6 +503,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -541,6 +559,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -674,7 +696,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ByocTrunkPage(self._version, response) async def page_async( @@ -701,8 +729,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ByocTrunkPage(self._version, response) diff --git a/twilio/rest/voice/v1/connection_policy/__init__.py b/twilio/rest/voice/v1/connection_policy/__init__.py index 4e65be6519..e2a56929c7 100644 --- a/twilio/rest/voice/v1/connection_policy/__init__.py +++ b/twilio/rest/voice/v1/connection_policy/__init__.py @@ -180,10 +180,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -192,9 +192,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> ConnectionPolicyInstance: @@ -205,10 +207,11 @@ def fetch(self) -> ConnectionPolicyInstance: :returns: The fetched ConnectionPolicyInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ConnectionPolicyInstance( self._version, @@ -224,9 +227,12 @@ async def fetch_async(self) -> ConnectionPolicyInstance: :returns: The fetched ConnectionPolicyInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ConnectionPolicyInstance( @@ -245,16 +251,20 @@ def update( :returns: The updated ConnectionPolicyInstance """ + data = values.of( { "FriendlyName": friendly_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ConnectionPolicyInstance( @@ -271,16 +281,20 @@ async def update_async( :returns: The updated ConnectionPolicyInstance """ + data = values.of( { "FriendlyName": friendly_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ConnectionPolicyInstance( @@ -359,6 +373,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -383,6 +401,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -516,7 +538,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ConnectionPolicyPage(self._version, response) async def page_async( @@ -543,8 +571,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ConnectionPolicyPage(self._version, response) diff --git a/twilio/rest/voice/v1/connection_policy/connection_policy_target.py b/twilio/rest/voice/v1/connection_policy/connection_policy_target.py index 05daee6c79..03f4fd607d 100644 --- a/twilio/rest/voice/v1/connection_policy/connection_policy_target.py +++ b/twilio/rest/voice/v1/connection_policy/connection_policy_target.py @@ -212,10 +212,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -224,9 +224,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> ConnectionPolicyTargetInstance: @@ -237,10 +239,11 @@ def fetch(self) -> ConnectionPolicyTargetInstance: :returns: The fetched ConnectionPolicyTargetInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return ConnectionPolicyTargetInstance( self._version, @@ -257,9 +260,12 @@ async def fetch_async(self) -> ConnectionPolicyTargetInstance: :returns: The fetched ConnectionPolicyTargetInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return ConnectionPolicyTargetInstance( @@ -288,6 +294,7 @@ def update( :returns: The updated ConnectionPolicyTargetInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -297,11 +304,14 @@ def update( "Enabled": serialize.boolean_to_string(enabled), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ConnectionPolicyTargetInstance( @@ -330,6 +340,7 @@ async def update_async( :returns: The updated ConnectionPolicyTargetInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -339,11 +350,14 @@ async def update_async( "Enabled": serialize.boolean_to_string(enabled), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return ConnectionPolicyTargetInstance( @@ -437,6 +451,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -478,6 +496,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -615,7 +637,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return ConnectionPolicyTargetPage(self._version, response, self._solution) async def page_async( @@ -642,8 +670,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return ConnectionPolicyTargetPage(self._version, response, self._solution) diff --git a/twilio/rest/voice/v1/dialing_permissions/bulk_country_update.py b/twilio/rest/voice/v1/dialing_permissions/bulk_country_update.py index 5b0d35d3d2..4059be8dd7 100644 --- a/twilio/rest/voice/v1/dialing_permissions/bulk_country_update.py +++ b/twilio/rest/voice/v1/dialing_permissions/bulk_country_update.py @@ -73,6 +73,10 @@ def create(self, update_request: str) -> BulkCountryUpdateInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -95,6 +99,10 @@ async def create_async(self, update_request: str) -> BulkCountryUpdateInstance: ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/voice/v1/dialing_permissions/country/__init__.py b/twilio/rest/voice/v1/dialing_permissions/country/__init__.py index 2b9285c112..6a60c23a2f 100644 --- a/twilio/rest/voice/v1/dialing_permissions/country/__init__.py +++ b/twilio/rest/voice/v1/dialing_permissions/country/__init__.py @@ -140,10 +140,11 @@ def fetch(self) -> CountryInstance: :returns: The fetched CountryInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return CountryInstance( self._version, @@ -159,9 +160,12 @@ async def fetch_async(self) -> CountryInstance: :returns: The fetched CountryInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return CountryInstance( @@ -451,7 +455,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return CountryPage(self._version, response) async def page_async( @@ -502,8 +512,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return CountryPage(self._version, response) diff --git a/twilio/rest/voice/v1/dialing_permissions/country/highrisk_special_prefix.py b/twilio/rest/voice/v1/dialing_permissions/country/highrisk_special_prefix.py index 9303f2c9ae..75300e928c 100644 --- a/twilio/rest/voice/v1/dialing_permissions/country/highrisk_special_prefix.py +++ b/twilio/rest/voice/v1/dialing_permissions/country/highrisk_special_prefix.py @@ -215,7 +215,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return HighriskSpecialPrefixPage(self._version, response, self._solution) async def page_async( @@ -242,8 +248,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return HighriskSpecialPrefixPage(self._version, response, self._solution) diff --git a/twilio/rest/voice/v1/dialing_permissions/settings.py b/twilio/rest/voice/v1/dialing_permissions/settings.py index 20d845673a..9e7aa0babb 100644 --- a/twilio/rest/voice/v1/dialing_permissions/settings.py +++ b/twilio/rest/voice/v1/dialing_permissions/settings.py @@ -126,10 +126,11 @@ def fetch(self) -> SettingsInstance: :returns: The fetched SettingsInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return SettingsInstance( self._version, @@ -144,9 +145,12 @@ async def fetch_async(self) -> SettingsInstance: :returns: The fetched SettingsInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return SettingsInstance( @@ -164,6 +168,7 @@ def update( :returns: The updated SettingsInstance """ + data = values.of( { "DialingPermissionsInheritance": serialize.boolean_to_string( @@ -171,11 +176,14 @@ def update( ), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SettingsInstance(self._version, payload) @@ -190,6 +198,7 @@ async def update_async( :returns: The updated SettingsInstance """ + data = values.of( { "DialingPermissionsInheritance": serialize.boolean_to_string( @@ -197,11 +206,14 @@ async def update_async( ), } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SettingsInstance(self._version, payload) diff --git a/twilio/rest/voice/v1/ip_record.py b/twilio/rest/voice/v1/ip_record.py index 5c103bf98e..05e9741fa5 100644 --- a/twilio/rest/voice/v1/ip_record.py +++ b/twilio/rest/voice/v1/ip_record.py @@ -172,10 +172,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -184,9 +184,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> IpRecordInstance: @@ -197,10 +199,11 @@ def fetch(self) -> IpRecordInstance: :returns: The fetched IpRecordInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return IpRecordInstance( self._version, @@ -216,9 +219,12 @@ async def fetch_async(self) -> IpRecordInstance: :returns: The fetched IpRecordInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return IpRecordInstance( @@ -237,16 +243,20 @@ def update( :returns: The updated IpRecordInstance """ + data = values.of( { "FriendlyName": friendly_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return IpRecordInstance(self._version, payload, sid=self._solution["sid"]) @@ -261,16 +271,20 @@ async def update_async( :returns: The updated IpRecordInstance """ + data = values.of( { "FriendlyName": friendly_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return IpRecordInstance(self._version, payload, sid=self._solution["sid"]) @@ -342,6 +356,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -373,6 +391,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -506,7 +528,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return IpRecordPage(self._version, response) async def page_async( @@ -533,8 +561,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return IpRecordPage(self._version, response) diff --git a/twilio/rest/voice/v1/source_ip_mapping.py b/twilio/rest/voice/v1/source_ip_mapping.py index 50e2bbe361..749d2b0034 100644 --- a/twilio/rest/voice/v1/source_ip_mapping.py +++ b/twilio/rest/voice/v1/source_ip_mapping.py @@ -162,10 +162,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -174,9 +174,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> SourceIpMappingInstance: @@ -187,10 +189,11 @@ def fetch(self) -> SourceIpMappingInstance: :returns: The fetched SourceIpMappingInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return SourceIpMappingInstance( self._version, @@ -206,9 +209,12 @@ async def fetch_async(self) -> SourceIpMappingInstance: :returns: The fetched SourceIpMappingInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return SourceIpMappingInstance( @@ -225,16 +231,20 @@ def update(self, sip_domain_sid: str) -> SourceIpMappingInstance: :returns: The updated SourceIpMappingInstance """ + data = values.of( { "SipDomainSid": sip_domain_sid, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SourceIpMappingInstance( @@ -249,16 +259,20 @@ async def update_async(self, sip_domain_sid: str) -> SourceIpMappingInstance: :returns: The updated SourceIpMappingInstance """ + data = values.of( { "SipDomainSid": sip_domain_sid, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SourceIpMappingInstance( @@ -327,6 +341,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -353,6 +371,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -486,7 +508,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return SourceIpMappingPage(self._version, response) async def page_async( @@ -513,8 +541,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return SourceIpMappingPage(self._version, response) diff --git a/twilio/rest/wireless/v1/command.py b/twilio/rest/wireless/v1/command.py index 3dc78e9b8f..a6e8f0b39d 100644 --- a/twilio/rest/wireless/v1/command.py +++ b/twilio/rest/wireless/v1/command.py @@ -174,10 +174,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -186,9 +186,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> CommandInstance: @@ -199,10 +201,11 @@ def fetch(self) -> CommandInstance: :returns: The fetched CommandInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return CommandInstance( self._version, @@ -218,9 +221,12 @@ async def fetch_async(self) -> CommandInstance: :returns: The fetched CommandInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return CommandInstance( @@ -310,6 +316,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -355,6 +365,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -552,7 +566,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return CommandPage(self._version, response) async def page_async( @@ -591,8 +611,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return CommandPage(self._version, response) diff --git a/twilio/rest/wireless/v1/rate_plan.py b/twilio/rest/wireless/v1/rate_plan.py index 5370ef2ae3..458ade0ad5 100644 --- a/twilio/rest/wireless/v1/rate_plan.py +++ b/twilio/rest/wireless/v1/rate_plan.py @@ -202,10 +202,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -214,9 +214,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> RatePlanInstance: @@ -227,10 +229,11 @@ def fetch(self) -> RatePlanInstance: :returns: The fetched RatePlanInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return RatePlanInstance( self._version, @@ -246,9 +249,12 @@ async def fetch_async(self) -> RatePlanInstance: :returns: The fetched RatePlanInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return RatePlanInstance( @@ -270,17 +276,21 @@ def update( :returns: The updated RatePlanInstance """ + data = values.of( { "UniqueName": unique_name, "FriendlyName": friendly_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RatePlanInstance(self._version, payload, sid=self._solution["sid"]) @@ -298,17 +308,21 @@ async def update_async( :returns: The updated RatePlanInstance """ + data = values.of( { "UniqueName": unique_name, "FriendlyName": friendly_name, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return RatePlanInstance(self._version, payload, sid=self._solution["sid"]) @@ -408,6 +422,10 @@ def create( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -467,6 +485,10 @@ async def create_async( ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) @@ -600,7 +622,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return RatePlanPage(self._version, response) async def page_async( @@ -627,8 +655,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return RatePlanPage(self._version, response) diff --git a/twilio/rest/wireless/v1/sim/__init__.py b/twilio/rest/wireless/v1/sim/__init__.py index f0d21c447e..cba0eeec71 100644 --- a/twilio/rest/wireless/v1/sim/__init__.py +++ b/twilio/rest/wireless/v1/sim/__init__.py @@ -343,10 +343,10 @@ def delete(self) -> bool: :returns: True if delete succeeds, False otherwise """ - return self._version.delete( - method="DELETE", - uri=self._uri, - ) + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) async def delete_async(self) -> bool: """ @@ -355,9 +355,11 @@ async def delete_async(self) -> bool: :returns: True if delete succeeds, False otherwise """ + + headers = values.of({}) + return await self._version.delete_async( - method="DELETE", - uri=self._uri, + method="DELETE", uri=self._uri, headers=headers ) def fetch(self) -> SimInstance: @@ -368,10 +370,11 @@ def fetch(self) -> SimInstance: :returns: The fetched SimInstance """ - payload = self._version.fetch( - method="GET", - uri=self._uri, - ) + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return SimInstance( self._version, @@ -387,9 +390,12 @@ async def fetch_async(self) -> SimInstance: :returns: The fetched SimInstance """ + headers = values.of({}) + + headers["Accept"] = "application/json" + payload = await self._version.fetch_async( - method="GET", - uri=self._uri, + method="GET", uri=self._uri, headers=headers ) return SimInstance( @@ -443,6 +449,7 @@ def update( :returns: The updated SimInstance """ + data = values.of( { "UniqueName": unique_name, @@ -465,11 +472,14 @@ def update( "AccountSid": account_sid, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = self._version.update( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SimInstance(self._version, payload, sid=self._solution["sid"]) @@ -519,6 +529,7 @@ async def update_async( :returns: The updated SimInstance """ + data = values.of( { "UniqueName": unique_name, @@ -541,11 +552,14 @@ async def update_async( "AccountSid": account_sid, } ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" payload = await self._version.update_async( - method="POST", - uri=self._uri, - data=data, + method="POST", uri=self._uri, data=data, headers=headers ) return SimInstance(self._version, payload, sid=self._solution["sid"]) @@ -822,7 +836,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return SimPage(self._version, response) async def page_async( @@ -864,8 +884,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return SimPage(self._version, response) diff --git a/twilio/rest/wireless/v1/sim/data_session.py b/twilio/rest/wireless/v1/sim/data_session.py index 649eb49631..b4c50d608d 100644 --- a/twilio/rest/wireless/v1/sim/data_session.py +++ b/twilio/rest/wireless/v1/sim/data_session.py @@ -252,7 +252,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return DataSessionPage(self._version, response, self._solution) async def page_async( @@ -279,8 +285,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return DataSessionPage(self._version, response, self._solution) diff --git a/twilio/rest/wireless/v1/sim/usage_record.py b/twilio/rest/wireless/v1/sim/usage_record.py index 8b1db6d0da..1cd26b6c2e 100644 --- a/twilio/rest/wireless/v1/sim/usage_record.py +++ b/twilio/rest/wireless/v1/sim/usage_record.py @@ -269,7 +269,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return UsageRecordPage(self._version, response, self._solution) async def page_async( @@ -305,8 +311,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return UsageRecordPage(self._version, response, self._solution) diff --git a/twilio/rest/wireless/v1/usage_record.py b/twilio/rest/wireless/v1/usage_record.py index 43e34469ce..07135cf98b 100644 --- a/twilio/rest/wireless/v1/usage_record.py +++ b/twilio/rest/wireless/v1/usage_record.py @@ -256,7 +256,13 @@ def page( } ) - response = self._version.page(method="GET", uri=self._uri, params=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) return UsageRecordPage(self._version, response) async def page_async( @@ -292,8 +298,12 @@ async def page_async( } ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + response = await self._version.page_async( - method="GET", uri=self._uri, params=data + method="GET", uri=self._uri, params=data, headers=headers ) return UsageRecordPage(self._version, response) From e256e92103cf1aa03d9c85fd89ed9a3bb3cac7b0 Mon Sep 17 00:00:00 2001 From: Twilio Date: Thu, 12 Dec 2024 17:12:01 +0000 Subject: [PATCH 54/87] Release 9.4.0 --- setup.py | 2 +- twilio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 016e3b95ca..08c45fb9b8 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name="twilio", - version="9.3.8", + version="9.4.0", description="Twilio API client and TwiML generator", author="Twilio", help_center="https://www.twilio.com/help/contact", diff --git a/twilio/__init__.py b/twilio/__init__.py index a574bfeb0c..fef80b04ae 100644 --- a/twilio/__init__.py +++ b/twilio/__init__.py @@ -1,2 +1,2 @@ -__version_info__ = ("9", "3", "8") +__version_info__ = ("9", "4", "0") __version__ = ".".join(__version_info__) From 541b312371aaac418f5180141847094db9e1a4c0 Mon Sep 17 00:00:00 2001 From: Shubham Date: Fri, 13 Dec 2024 11:18:41 +0530 Subject: [PATCH 55/87] chore: fix orgs api changes (#826) --- twilio/rest/preview_iam/__init__.py | 68 +- .../preview_iam/organizations/__init__.py | 59 - .../rest/preview_iam/organizations/account.py | 436 ------- .../organizations/role_assignment.py | 588 --------- twilio/rest/preview_iam/organizations/user.py | 1052 ----------------- 5 files changed, 17 insertions(+), 2186 deletions(-) delete mode 100644 twilio/rest/preview_iam/organizations/__init__.py delete mode 100644 twilio/rest/preview_iam/organizations/account.py delete mode 100644 twilio/rest/preview_iam/organizations/role_assignment.py delete mode 100644 twilio/rest/preview_iam/organizations/user.py diff --git a/twilio/rest/preview_iam/__init__.py b/twilio/rest/preview_iam/__init__.py index dd51b97489..9103436220 100644 --- a/twilio/rest/preview_iam/__init__.py +++ b/twilio/rest/preview_iam/__init__.py @@ -1,59 +1,25 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ +from twilio.rest.preview_iam.PreviewIamBase import PreviewIamBase - Organization Public API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) +from twilio.rest.preview_iam.v1.authorize import ( + AuthorizeList, +) +from twilio.rest.preview_iam.v1.token import ( + TokenList, +) +from twilio.rest.preview_iam.versionless.organization import ( + OrganizationList, +) - 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_iam.organizations.account import AccountList -from twilio.rest.preview_iam.organizations.role_assignment import RoleAssignmentList -from twilio.rest.preview_iam.organizations.user import UserList - - -class Organizations(Version): - - def __init__(self, domain: Domain): - """ - Initialize the Organizations version of PreviewIam - - :param domain: The Twilio.preview_iam domain - """ - super().__init__(domain, "Organizations") - self._accounts: Optional[AccountList] = None - self._role_assignments: Optional[RoleAssignmentList] = None - self._users: Optional[UserList] = None +class PreviewIam(PreviewIamBase): @property - def accounts(self) -> AccountList: - if self._accounts is None: - self._accounts = AccountList(self) - return self._accounts + def organization(self) -> OrganizationList: + return self.versionless.organization @property - def role_assignments(self) -> RoleAssignmentList: - if self._role_assignments is None: - self._role_assignments = RoleAssignmentList(self) - return self._role_assignments + def authorize(self) -> AuthorizeList: + return self.v1.authorize @property - def users(self) -> UserList: - if self._users is None: - self._users = UserList(self) - return self._users - - def __repr__(self) -> str: - """ - Provide a friendly representation - :returns: Machine friendly representation - """ - return "" + def token(self) -> TokenList: + return self.v1.token diff --git a/twilio/rest/preview_iam/organizations/__init__.py b/twilio/rest/preview_iam/organizations/__init__.py deleted file mode 100644 index dd51b97489..0000000000 --- a/twilio/rest/preview_iam/organizations/__init__.py +++ /dev/null @@ -1,59 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Organization Public API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - - 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_iam.organizations.account import AccountList -from twilio.rest.preview_iam.organizations.role_assignment import RoleAssignmentList -from twilio.rest.preview_iam.organizations.user import UserList - - -class Organizations(Version): - - def __init__(self, domain: Domain): - """ - Initialize the Organizations version of PreviewIam - - :param domain: The Twilio.preview_iam domain - """ - super().__init__(domain, "Organizations") - self._accounts: Optional[AccountList] = None - self._role_assignments: Optional[RoleAssignmentList] = None - self._users: Optional[UserList] = None - - @property - def accounts(self) -> AccountList: - if self._accounts is None: - self._accounts = AccountList(self) - return self._accounts - - @property - def role_assignments(self) -> RoleAssignmentList: - if self._role_assignments is None: - self._role_assignments = RoleAssignmentList(self) - return self._role_assignments - - @property - def users(self) -> UserList: - if self._users is None: - self._users = UserList(self) - return self._users - - def __repr__(self) -> str: - """ - Provide a friendly representation - :returns: Machine friendly representation - """ - return "" diff --git a/twilio/rest/preview_iam/organizations/account.py b/twilio/rest/preview_iam/organizations/account.py deleted file mode 100644 index bc5f49e28f..0000000000 --- a/twilio/rest/preview_iam/organizations/account.py +++ /dev/null @@ -1,436 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Organization Public API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - - 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, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.version import Version -from twilio.base.page import Page - - -class AccountInstance(InstanceResource): - """ - :ivar account_sid: Twilio account sid - :ivar friendly_name: Account friendly name - :ivar status: Account status - :ivar owner_sid: Twilio account sid - :ivar date_created: The date and time when the account was created in the system - """ - - def __init__( - self, - version: Version, - payload: Dict[str, Any], - organization_sid: Optional[str] = None, - account_sid: Optional[str] = None, - ): - super().__init__(version) - - self.account_sid: Optional[str] = payload.get("account_sid") - self.friendly_name: Optional[str] = payload.get("friendly_name") - self.status: Optional[str] = payload.get("status") - self.owner_sid: Optional[str] = payload.get("owner_sid") - self.date_created: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("date_created") - ) - - self._solution = { - "organization_sid": organization_sid or self.organization_sid, - "account_sid": account_sid or self.account_sid, - } - self._context: Optional[AccountContext] = None - - @property - def _proxy(self) -> "AccountContext": - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AccountContext for this AccountInstance - """ - if self._context is None: - self._context = AccountContext( - self._version, - organization_sid=self._solution["organization_sid"], - account_sid=self._solution["account_sid"], - ) - return self._context - - def fetch(self) -> "AccountInstance": - """ - Fetch the AccountInstance - - - :returns: The fetched AccountInstance - """ - return self._proxy.fetch() - - async def fetch_async(self) -> "AccountInstance": - """ - Asynchronous coroutine to fetch the AccountInstance - - - :returns: The fetched AccountInstance - """ - return await self._proxy.fetch_async() - - 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 AccountContext(InstanceContext): - - def __init__(self, version: Version, organization_sid: str, account_sid: str): - """ - Initialize the AccountContext - - :param version: Version that contains the resource - :param organization_sid: - :param account_sid: - """ - super().__init__(version) - - # Path Solution - self._solution = { - "organization_sid": organization_sid, - "account_sid": account_sid, - } - self._uri = "/{organization_sid}/Accounts/{account_sid}".format( - **self._solution - ) - - def fetch(self) -> AccountInstance: - """ - Fetch the AccountInstance - - - :returns: The fetched AccountInstance - """ - - headers = values.of({}) - - headers["Accept"] = "application/json" - - payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) - - return AccountInstance( - self._version, - payload, - organization_sid=self._solution["organization_sid"], - account_sid=self._solution["account_sid"], - ) - - async def fetch_async(self) -> AccountInstance: - """ - Asynchronous coroutine to fetch the AccountInstance - - - :returns: The fetched AccountInstance - """ - - headers = values.of({}) - - headers["Accept"] = "application/json" - - payload = await self._version.fetch_async( - method="GET", uri=self._uri, headers=headers - ) - - return AccountInstance( - self._version, - payload, - organization_sid=self._solution["organization_sid"], - account_sid=self._solution["account_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 AccountPage(Page): - - def get_instance(self, payload: Dict[str, Any]) -> AccountInstance: - """ - Build an instance of AccountInstance - - :param payload: Payload response from the API - """ - return AccountInstance( - self._version, payload, organization_sid=self._solution["organization_sid"] - ) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" - - -class AccountList(ListResource): - - def __init__(self, version: Version, organization_sid: str): - """ - Initialize the AccountList - - :param version: Version that contains the resource - :param organization_sid: - - """ - super().__init__(version) - - # Path Solution - self._solution = { - "organization_sid": organization_sid, - } - self._uri = "/{organization_sid}/Accounts".format(**self._solution) - - def stream( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> Iterator[AccountInstance]: - """ - Streams AccountInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - """ - limits = self._version.read_limits(limit, page_size) - page = self.page(page_size=limits["page_size"]) - - return self._version.stream(page, limits["limit"]) - - async def stream_async( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> AsyncIterator[AccountInstance]: - """ - Asynchronously streams AccountInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - """ - limits = self._version.read_limits(limit, page_size) - page = await self.page_async(page_size=limits["page_size"]) - - return self._version.stream_async(page, limits["limit"]) - - def list( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[AccountInstance]: - """ - Lists AccountInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: list that will contain up to limit results - """ - return list( - self.stream( - limit=limit, - page_size=page_size, - ) - ) - - async def list_async( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[AccountInstance]: - """ - Asynchronously lists AccountInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: list that will contain up to limit results - """ - return [ - record - async for record in await self.stream_async( - limit=limit, - page_size=page_size, - ) - ] - - def page( - self, - page_token: Union[str, object] = values.unset, - page_number: Union[int, object] = values.unset, - page_size: Union[int, object] = values.unset, - ) -> AccountPage: - """ - Retrieve a single page of AccountInstance records from the API. - Request is executed immediately - - :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 - - :returns: Page of AccountInstance - """ - data = values.of( - { - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Accept"] = "application/json" - - response = self._version.page( - method="GET", uri=self._uri, params=data, headers=headers - ) - return AccountPage(self._version, response, self._solution) - - async def page_async( - self, - page_token: Union[str, object] = values.unset, - page_number: Union[int, object] = values.unset, - page_size: Union[int, object] = values.unset, - ) -> AccountPage: - """ - Asynchronously retrieve a single page of AccountInstance records from the API. - Request is executed immediately - - :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 - - :returns: Page of AccountInstance - """ - data = values.of( - { - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Accept"] = "application/json" - - response = await self._version.page_async( - method="GET", uri=self._uri, params=data, headers=headers - ) - return AccountPage(self._version, response, self._solution) - - def get_page(self, target_url: str) -> AccountPage: - """ - Retrieve a specific page of AccountInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of AccountInstance - """ - response = self._version.domain.twilio.request("GET", target_url) - return AccountPage(self._version, response, self._solution) - - async def get_page_async(self, target_url: str) -> AccountPage: - """ - Asynchronously retrieve a specific page of AccountInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of AccountInstance - """ - response = await self._version.domain.twilio.request_async("GET", target_url) - return AccountPage(self._version, response, self._solution) - - def get(self, organization_sid: str, account_sid: str) -> AccountContext: - """ - Constructs a AccountContext - - :param organization_sid: - :param account_sid: - """ - return AccountContext( - self._version, organization_sid=organization_sid, account_sid=account_sid - ) - - def __call__(self, organization_sid: str, account_sid: str) -> AccountContext: - """ - Constructs a AccountContext - - :param organization_sid: - :param account_sid: - """ - return AccountContext( - self._version, organization_sid=organization_sid, account_sid=account_sid - ) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" diff --git a/twilio/rest/preview_iam/organizations/role_assignment.py b/twilio/rest/preview_iam/organizations/role_assignment.py deleted file mode 100644 index 9608e2b806..0000000000 --- a/twilio/rest/preview_iam/organizations/role_assignment.py +++ /dev/null @@ -1,588 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Organization Public API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - - 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, Union, Iterator, AsyncIterator -from twilio.base import values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.version import Version -from twilio.base.page import Page - - -class RoleAssignmentInstance(InstanceResource): - - class PublicApiCreateRoleAssignmentRequest(object): - """ - :ivar role_sid: Twilio Role Sid representing assigned role - :ivar scope: Twilio Sid representing scope of this assignment - :ivar identity: Twilio Sid representing identity of this assignment - """ - - def __init__(self, payload: Dict[str, Any]): - - self.role_sid: Optional[str] = payload.get("role_sid") - self.scope: Optional[str] = payload.get("scope") - self.identity: Optional[str] = payload.get("identity") - - def to_dict(self): - return { - "role_sid": self.role_sid, - "scope": self.scope, - "identity": self.identity, - } - - """ - :ivar sid: Twilio Role Assignment Sid representing this role assignment - :ivar role_sid: Twilio Role Sid representing assigned role - :ivar scope: Twilio Sid representing identity of this assignment - :ivar identity: Twilio Sid representing scope of this assignment - :ivar code: Twilio-specific error code - :ivar message: Error message - :ivar more_info: Link to Error Code References - :ivar status: HTTP response status code - """ - - def __init__( - self, - version: Version, - payload: Dict[str, Any], - organization_sid: Optional[str] = None, - role_assignment_sid: Optional[str] = None, - ): - super().__init__(version) - - self.sid: Optional[str] = payload.get("sid") - self.role_sid: Optional[str] = payload.get("role_sid") - self.scope: Optional[str] = payload.get("scope") - self.identity: Optional[str] = payload.get("identity") - self.code: Optional[int] = payload.get("code") - self.message: Optional[str] = payload.get("message") - self.more_info: Optional[str] = payload.get("moreInfo") - self.status: Optional[int] = payload.get("status") - - self._solution = { - "organization_sid": organization_sid or self.organization_sid, - "role_assignment_sid": role_assignment_sid or self.role_assignment_sid, - } - self._context: Optional[RoleAssignmentContext] = None - - @property - def _proxy(self) -> "RoleAssignmentContext": - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: RoleAssignmentContext for this RoleAssignmentInstance - """ - if self._context is None: - self._context = RoleAssignmentContext( - self._version, - organization_sid=self._solution["organization_sid"], - role_assignment_sid=self._solution["role_assignment_sid"], - ) - return self._context - - def delete(self) -> bool: - """ - Deletes the RoleAssignmentInstance - - - :returns: True if delete succeeds, False otherwise - """ - return self._proxy.delete() - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the RoleAssignmentInstance - - - :returns: True if delete succeeds, False otherwise - """ - return await self._proxy.delete_async() - - 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 RoleAssignmentContext(InstanceContext): - - class PublicApiCreateRoleAssignmentRequest(object): - """ - :ivar role_sid: Twilio Role Sid representing assigned role - :ivar scope: Twilio Sid representing scope of this assignment - :ivar identity: Twilio Sid representing identity of this assignment - """ - - def __init__(self, payload: Dict[str, Any]): - - self.role_sid: Optional[str] = payload.get("role_sid") - self.scope: Optional[str] = payload.get("scope") - self.identity: Optional[str] = payload.get("identity") - - def to_dict(self): - return { - "role_sid": self.role_sid, - "scope": self.scope, - "identity": self.identity, - } - - def __init__( - self, version: Version, organization_sid: str, role_assignment_sid: str - ): - """ - Initialize the RoleAssignmentContext - - :param version: Version that contains the resource - :param organization_sid: - :param role_assignment_sid: - """ - super().__init__(version) - - # Path Solution - self._solution = { - "organization_sid": organization_sid, - "role_assignment_sid": role_assignment_sid, - } - self._uri = "/{organization_sid}/RoleAssignments/{role_assignment_sid}".format( - **self._solution - ) - - def delete(self) -> bool: - """ - Deletes the RoleAssignmentInstance - - - :returns: True if delete succeeds, False otherwise - """ - - headers = values.of({}) - - headers["Accept"] = "application/scim+json" - - return self._version.delete(method="DELETE", uri=self._uri, headers=headers) - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the RoleAssignmentInstance - - - :returns: True if delete succeeds, False otherwise - """ - - headers = values.of({}) - - headers["Accept"] = "application/scim+json" - - return await self._version.delete_async( - method="DELETE", uri=self._uri, headers=headers - ) - - 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 RoleAssignmentPage(Page): - - def get_instance(self, payload: Dict[str, Any]) -> RoleAssignmentInstance: - """ - Build an instance of RoleAssignmentInstance - - :param payload: Payload response from the API - """ - return RoleAssignmentInstance( - self._version, payload, organization_sid=self._solution["organization_sid"] - ) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" - - -class RoleAssignmentList(ListResource): - - class PublicApiCreateRoleAssignmentRequest(object): - """ - :ivar role_sid: Twilio Role Sid representing assigned role - :ivar scope: Twilio Sid representing scope of this assignment - :ivar identity: Twilio Sid representing identity of this assignment - """ - - def __init__(self, payload: Dict[str, Any]): - - self.role_sid: Optional[str] = payload.get("role_sid") - self.scope: Optional[str] = payload.get("scope") - self.identity: Optional[str] = payload.get("identity") - - def to_dict(self): - return { - "role_sid": self.role_sid, - "scope": self.scope, - "identity": self.identity, - } - - def __init__(self, version: Version, organization_sid: str): - """ - Initialize the RoleAssignmentList - - :param version: Version that contains the resource - :param organization_sid: - - """ - super().__init__(version) - - # Path Solution - self._solution = { - "organization_sid": organization_sid, - } - self._uri = "/{organization_sid}/RoleAssignments".format(**self._solution) - - def create( - self, - public_api_create_role_assignment_request: PublicApiCreateRoleAssignmentRequest, - ) -> RoleAssignmentInstance: - """ - Create the RoleAssignmentInstance - - :param public_api_create_role_assignment_request: - - :returns: The created RoleAssignmentInstance - """ - data = public_api_create_role_assignment_request.to_dict() - - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Content-Type"] = "application/json" - - headers["Accept"] = "application/json" - - payload = self._version.create( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return RoleAssignmentInstance( - self._version, payload, organization_sid=self._solution["organization_sid"] - ) - - async def create_async( - self, - public_api_create_role_assignment_request: PublicApiCreateRoleAssignmentRequest, - ) -> RoleAssignmentInstance: - """ - Asynchronously create the RoleAssignmentInstance - - :param public_api_create_role_assignment_request: - - :returns: The created RoleAssignmentInstance - """ - data = public_api_create_role_assignment_request.to_dict() - - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Content-Type"] = "application/json" - - headers["Accept"] = "application/json" - - payload = await self._version.create_async( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return RoleAssignmentInstance( - self._version, payload, organization_sid=self._solution["organization_sid"] - ) - - def stream( - self, - identity: Union[str, object] = values.unset, - scope: Union[str, object] = values.unset, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> Iterator[RoleAssignmentInstance]: - """ - Streams RoleAssignmentInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param str identity: - :param str scope: - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - """ - limits = self._version.read_limits(limit, page_size) - page = self.page(identity=identity, scope=scope, page_size=limits["page_size"]) - - return self._version.stream(page, limits["limit"]) - - async def stream_async( - self, - identity: Union[str, object] = values.unset, - scope: Union[str, object] = values.unset, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> AsyncIterator[RoleAssignmentInstance]: - """ - Asynchronously streams RoleAssignmentInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param str identity: - :param str scope: - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - """ - limits = self._version.read_limits(limit, page_size) - page = await self.page_async( - identity=identity, scope=scope, page_size=limits["page_size"] - ) - - return self._version.stream_async(page, limits["limit"]) - - def list( - self, - identity: Union[str, object] = values.unset, - scope: Union[str, object] = values.unset, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[RoleAssignmentInstance]: - """ - Lists RoleAssignmentInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param str identity: - :param str scope: - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: list that will contain up to limit results - """ - return list( - self.stream( - identity=identity, - scope=scope, - limit=limit, - page_size=page_size, - ) - ) - - async def list_async( - self, - identity: Union[str, object] = values.unset, - scope: Union[str, object] = values.unset, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[RoleAssignmentInstance]: - """ - Asynchronously lists RoleAssignmentInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param str identity: - :param str scope: - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: list that will contain up to limit results - """ - return [ - record - async for record in await self.stream_async( - identity=identity, - scope=scope, - limit=limit, - page_size=page_size, - ) - ] - - def page( - self, - identity: Union[str, object] = values.unset, - scope: Union[str, object] = values.unset, - page_token: Union[str, object] = values.unset, - page_number: Union[int, object] = values.unset, - page_size: Union[int, object] = values.unset, - ) -> RoleAssignmentPage: - """ - Retrieve a single page of RoleAssignmentInstance records from the API. - Request is executed immediately - - :param identity: - :param scope: - :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 - - :returns: Page of RoleAssignmentInstance - """ - data = values.of( - { - "Identity": identity, - "Scope": scope, - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Accept"] = "application/json" - - response = self._version.page( - method="GET", uri=self._uri, params=data, headers=headers - ) - return RoleAssignmentPage(self._version, response, self._solution) - - async def page_async( - self, - identity: Union[str, object] = values.unset, - scope: Union[str, object] = values.unset, - page_token: Union[str, object] = values.unset, - page_number: Union[int, object] = values.unset, - page_size: Union[int, object] = values.unset, - ) -> RoleAssignmentPage: - """ - Asynchronously retrieve a single page of RoleAssignmentInstance records from the API. - Request is executed immediately - - :param identity: - :param scope: - :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 - - :returns: Page of RoleAssignmentInstance - """ - data = values.of( - { - "Identity": identity, - "Scope": scope, - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Accept"] = "application/json" - - response = await self._version.page_async( - method="GET", uri=self._uri, params=data, headers=headers - ) - return RoleAssignmentPage(self._version, response, self._solution) - - def get_page(self, target_url: str) -> RoleAssignmentPage: - """ - Retrieve a specific page of RoleAssignmentInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of RoleAssignmentInstance - """ - response = self._version.domain.twilio.request("GET", target_url) - return RoleAssignmentPage(self._version, response, self._solution) - - async def get_page_async(self, target_url: str) -> RoleAssignmentPage: - """ - Asynchronously retrieve a specific page of RoleAssignmentInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of RoleAssignmentInstance - """ - response = await self._version.domain.twilio.request_async("GET", target_url) - return RoleAssignmentPage(self._version, response, self._solution) - - def get( - self, organization_sid: str, role_assignment_sid: str - ) -> RoleAssignmentContext: - """ - Constructs a RoleAssignmentContext - - :param organization_sid: - :param role_assignment_sid: - """ - return RoleAssignmentContext( - self._version, - organization_sid=organization_sid, - role_assignment_sid=role_assignment_sid, - ) - - def __call__( - self, organization_sid: str, role_assignment_sid: str - ) -> RoleAssignmentContext: - """ - Constructs a RoleAssignmentContext - - :param organization_sid: - :param role_assignment_sid: - """ - return RoleAssignmentContext( - self._version, - organization_sid=organization_sid, - role_assignment_sid=role_assignment_sid, - ) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" diff --git a/twilio/rest/preview_iam/organizations/user.py b/twilio/rest/preview_iam/organizations/user.py deleted file mode 100644 index 31ee699422..0000000000 --- a/twilio/rest/preview_iam/organizations/user.py +++ /dev/null @@ -1,1052 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Organization Public API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - - 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, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.version import Version -from twilio.base.page import Page - - -class UserInstance(InstanceResource): - - class ScimEmailAddress(object): - """ - :ivar primary: Indicates if this email address is the primary one - :ivar value: The actual email address value - :ivar type: The type of email address (e.g., work, home, etc.) - """ - - def __init__(self, payload: Dict[str, Any]): - - self.primary: Optional[bool] = payload.get("primary") - self.value: Optional[str] = payload.get("value") - self.type: Optional[str] = payload.get("type") - - def to_dict(self): - return { - "primary": self.primary, - "value": self.value, - "type": self.type, - } - - class ScimMeta(object): - """ - :ivar resource_type: Indicates the type of the resource - :ivar created: The date and time when the resource was created in the system - :ivar last_modified: The date and time when the resource was last modified - :ivar version: A version identifier for the resource. This can be used to manage resource versioning and concurrency control. - """ - - def __init__(self, payload: Dict[str, Any]): - - self.resource_type: Optional[str] = payload.get("resource_type") - self.created: Optional[datetime] = payload.get("created") - self.last_modified: Optional[datetime] = payload.get("last_modified") - self.version: Optional[str] = payload.get("version") - - def to_dict(self): - return { - "resource_type": self.resource_type, - "created": self.created, - "last_modified": self.last_modified, - "version": self.version, - } - - class ScimName(object): - """ - :ivar given_name: The user's first or given name - :ivar family_name: The user's last or family name - """ - - def __init__(self, payload: Dict[str, Any]): - - self.given_name: Optional[str] = payload.get("given_name") - self.family_name: Optional[str] = payload.get("family_name") - - def to_dict(self): - return { - "given_name": self.given_name, - "family_name": self.family_name, - } - - class ScimUser(object): - """ - :ivar id: Unique Twilio user sid - :ivar external_id: External unique resource id defined by provisioning client - :ivar user_name: Unique username, MUST be same as primary email address - :ivar display_name: User friendly display name - :ivar name: - :ivar emails: Email address list of the user. Primary email must be defined if there are more than 1 email. Primary email must match the username. - :ivar active: Indicates whether the user is active - :ivar locale: User's locale - :ivar timezone: User's time zone - :ivar schemas: An array of URIs that indicate the schemas supported for this user resource - :ivar meta: - :ivar detail: A human-readable description of the error - :ivar scim_type: A scimType error code as defined in RFC7644 - :ivar status: Http status code - :ivar code: Twilio-specific error code - :ivar more_info: Link to Error Code References - """ - - def __init__(self, payload: Dict[str, Any]): - - self.id: Optional[str] = payload.get("id") - self.external_id: Optional[str] = payload.get("external_id") - self.user_name: Optional[str] = payload.get("user_name") - self.display_name: Optional[str] = payload.get("display_name") - self.name: Optional[UserList.ScimName] = payload.get("name") - self.emails: Optional[List[UserList.ScimEmailAddress]] = payload.get( - "emails" - ) - self.active: Optional[bool] = payload.get("active") - self.locale: Optional[str] = payload.get("locale") - self.timezone: Optional[str] = payload.get("timezone") - self.schemas: Optional[List[str]] = payload.get("schemas") - self.meta: Optional[UserList.ScimMeta] = payload.get("meta") - self.detail: Optional[str] = payload.get("detail") - self.scim_type: Optional[str] = payload.get("scim_type") - self.status: Optional[str] = payload.get("status") - self.code: Optional[int] = payload.get("code") - self.more_info: Optional[str] = payload.get("more_info") - - def to_dict(self): - return { - "id": self.id, - "externalId": self.external_id, - "userName": self.user_name, - "displayName": self.display_name, - "name": self.name.to_dict() if self.name is not None else None, - "emails": ( - [emails.to_dict() for emails in self.emails] - if self.emails is not None - else None - ), - "active": self.active, - "locale": self.locale, - "timezone": self.timezone, - "schemas": self.schemas, - "meta": self.meta.to_dict() if self.meta is not None else None, - "detail": self.detail, - "scimType": self.scim_type, - "status": self.status, - "code": self.code, - "moreInfo": self.more_info, - } - - """ - :ivar id: Unique Twilio user sid - :ivar external_id: External unique resource id defined by provisioning client - :ivar user_name: Unique username, MUST be same as primary email address - :ivar display_name: User friendly display name - :ivar name: - :ivar emails: Email address list of the user. Primary email must be defined if there are more than 1 email. Primary email must match the username. - :ivar active: Indicates whether the user is active - :ivar locale: User's locale - :ivar timezone: User's time zone - :ivar schemas: An array of URIs that indicate the schemas supported for this user resource - :ivar meta: - :ivar detail: A human-readable description of the error - :ivar scim_type: A scimType error code as defined in RFC7644 - :ivar status: Http status code - :ivar code: Twilio-specific error code - :ivar more_info: Link to Error Code References - """ - - def __init__( - self, - version: Version, - payload: Dict[str, Any], - organization_sid: Optional[str] = None, - user_sid: Optional[str] = None, - ): - super().__init__(version) - - self.id: Optional[str] = payload.get("id") - self.external_id: Optional[str] = payload.get("externalId") - self.user_name: Optional[str] = payload.get("userName") - self.display_name: Optional[str] = payload.get("displayName") - self.name: Optional[UserList.str] = payload.get("name") - self.emails: Optional[List[UserList.str]] = payload.get("emails") - self.active: Optional[bool] = payload.get("active") - self.locale: Optional[str] = payload.get("locale") - self.timezone: Optional[str] = payload.get("timezone") - self.schemas: Optional[List[str]] = payload.get("schemas") - self.meta: Optional[UserList.str] = payload.get("meta") - self.detail: Optional[str] = payload.get("detail") - self.scim_type: Optional[str] = payload.get("scimType") - self.status: Optional[str] = payload.get("status") - self.code: Optional[int] = payload.get("code") - self.more_info: Optional[str] = payload.get("moreInfo") - - self._solution = { - "organization_sid": organization_sid or self.organization_sid, - "user_sid": user_sid or self.user_sid, - } - self._context: Optional[UserContext] = None - - @property - def _proxy(self) -> "UserContext": - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: UserContext for this UserInstance - """ - if self._context is None: - self._context = UserContext( - self._version, - organization_sid=self._solution["organization_sid"], - user_sid=self._solution["user_sid"], - ) - return self._context - - def delete(self) -> bool: - """ - Deletes the UserInstance - - - :returns: True if delete succeeds, False otherwise - """ - return self._proxy.delete() - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the UserInstance - - - :returns: True if delete succeeds, False otherwise - """ - return await self._proxy.delete_async() - - def fetch(self) -> "UserInstance": - """ - Fetch the UserInstance - - - :returns: The fetched UserInstance - """ - return self._proxy.fetch() - - async def fetch_async(self) -> "UserInstance": - """ - Asynchronous coroutine to fetch the UserInstance - - - :returns: The fetched UserInstance - """ - return await self._proxy.fetch_async() - - def update( - self, scim_user: ScimUser, if_match: Union[str, object] = values.unset - ) -> "UserInstance": - """ - Update the UserInstance - - :param scim_user: - :param if_match: - - :returns: The updated UserInstance - """ - return self._proxy.update( - scim_user=scim_user, - if_match=if_match, - ) - - async def update_async( - self, scim_user: ScimUser, if_match: Union[str, object] = values.unset - ) -> "UserInstance": - """ - Asynchronous coroutine to update the UserInstance - - :param scim_user: - :param if_match: - - :returns: The updated UserInstance - """ - return await self._proxy.update_async( - scim_user=scim_user, - if_match=if_match, - ) - - 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 UserContext(InstanceContext): - - class ScimEmailAddress(object): - """ - :ivar primary: Indicates if this email address is the primary one - :ivar value: The actual email address value - :ivar type: The type of email address (e.g., work, home, etc.) - """ - - def __init__(self, payload: Dict[str, Any]): - - self.primary: Optional[bool] = payload.get("primary") - self.value: Optional[str] = payload.get("value") - self.type: Optional[str] = payload.get("type") - - def to_dict(self): - return { - "primary": self.primary, - "value": self.value, - "type": self.type, - } - - class ScimMeta(object): - """ - :ivar resource_type: Indicates the type of the resource - :ivar created: The date and time when the resource was created in the system - :ivar last_modified: The date and time when the resource was last modified - :ivar version: A version identifier for the resource. This can be used to manage resource versioning and concurrency control. - """ - - def __init__(self, payload: Dict[str, Any]): - - self.resource_type: Optional[str] = payload.get("resource_type") - self.created: Optional[datetime] = payload.get("created") - self.last_modified: Optional[datetime] = payload.get("last_modified") - self.version: Optional[str] = payload.get("version") - - def to_dict(self): - return { - "resource_type": self.resource_type, - "created": self.created, - "last_modified": self.last_modified, - "version": self.version, - } - - class ScimName(object): - """ - :ivar given_name: The user's first or given name - :ivar family_name: The user's last or family name - """ - - def __init__(self, payload: Dict[str, Any]): - - self.given_name: Optional[str] = payload.get("given_name") - self.family_name: Optional[str] = payload.get("family_name") - - def to_dict(self): - return { - "given_name": self.given_name, - "family_name": self.family_name, - } - - class ScimUser(object): - """ - :ivar id: Unique Twilio user sid - :ivar external_id: External unique resource id defined by provisioning client - :ivar user_name: Unique username, MUST be same as primary email address - :ivar display_name: User friendly display name - :ivar name: - :ivar emails: Email address list of the user. Primary email must be defined if there are more than 1 email. Primary email must match the username. - :ivar active: Indicates whether the user is active - :ivar locale: User's locale - :ivar timezone: User's time zone - :ivar schemas: An array of URIs that indicate the schemas supported for this user resource - :ivar meta: - :ivar detail: A human-readable description of the error - :ivar scim_type: A scimType error code as defined in RFC7644 - :ivar status: Http status code - :ivar code: Twilio-specific error code - :ivar more_info: Link to Error Code References - """ - - def __init__(self, payload: Dict[str, Any]): - - self.id: Optional[str] = payload.get("id") - self.external_id: Optional[str] = payload.get("external_id") - self.user_name: Optional[str] = payload.get("user_name") - self.display_name: Optional[str] = payload.get("display_name") - self.name: Optional[UserList.ScimName] = payload.get("name") - self.emails: Optional[List[UserList.ScimEmailAddress]] = payload.get( - "emails" - ) - self.active: Optional[bool] = payload.get("active") - self.locale: Optional[str] = payload.get("locale") - self.timezone: Optional[str] = payload.get("timezone") - self.schemas: Optional[List[str]] = payload.get("schemas") - self.meta: Optional[UserList.ScimMeta] = payload.get("meta") - self.detail: Optional[str] = payload.get("detail") - self.scim_type: Optional[str] = payload.get("scim_type") - self.status: Optional[str] = payload.get("status") - self.code: Optional[int] = payload.get("code") - self.more_info: Optional[str] = payload.get("more_info") - - def to_dict(self): - return { - "id": self.id, - "externalId": self.external_id, - "userName": self.user_name, - "displayName": self.display_name, - "name": self.name.to_dict() if self.name is not None else None, - "emails": ( - [emails.to_dict() for emails in self.emails] - if self.emails is not None - else None - ), - "active": self.active, - "locale": self.locale, - "timezone": self.timezone, - "schemas": self.schemas, - "meta": self.meta.to_dict() if self.meta is not None else None, - "detail": self.detail, - "scimType": self.scim_type, - "status": self.status, - "code": self.code, - "moreInfo": self.more_info, - } - - def __init__(self, version: Version, organization_sid: str, user_sid: str): - """ - Initialize the UserContext - - :param version: Version that contains the resource - :param organization_sid: - :param user_sid: - """ - super().__init__(version) - - # Path Solution - self._solution = { - "organization_sid": organization_sid, - "user_sid": user_sid, - } - self._uri = "/{organization_sid}/scim/Users/{user_sid}".format(**self._solution) - - def delete(self) -> bool: - """ - Deletes the UserInstance - - - :returns: True if delete succeeds, False otherwise - """ - - headers = values.of({}) - - headers["Accept"] = "application/scim+json" - - return self._version.delete(method="DELETE", uri=self._uri, headers=headers) - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the UserInstance - - - :returns: True if delete succeeds, False otherwise - """ - - headers = values.of({}) - - headers["Accept"] = "application/scim+json" - - return await self._version.delete_async( - method="DELETE", uri=self._uri, headers=headers - ) - - def fetch(self) -> UserInstance: - """ - Fetch the UserInstance - - - :returns: The fetched UserInstance - """ - - headers = values.of({}) - - headers["Accept"] = "application/scim+json" - - payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) - - return UserInstance( - self._version, - payload, - organization_sid=self._solution["organization_sid"], - user_sid=self._solution["user_sid"], - ) - - async def fetch_async(self) -> UserInstance: - """ - Asynchronous coroutine to fetch the UserInstance - - - :returns: The fetched UserInstance - """ - - headers = values.of({}) - - headers["Accept"] = "application/scim+json" - - payload = await self._version.fetch_async( - method="GET", uri=self._uri, headers=headers - ) - - return UserInstance( - self._version, - payload, - organization_sid=self._solution["organization_sid"], - user_sid=self._solution["user_sid"], - ) - - def update( - self, scim_user: ScimUser, if_match: Union[str, object] = values.unset - ) -> UserInstance: - """ - Update the UserInstance - - :param scim_user: - :param if_match: - - :returns: The updated UserInstance - """ - data = scim_user.to_dict() - - headers = values.of({}) - - if not ( - if_match is values.unset or (isinstance(if_match, str) and not if_match) - ): - headers["If-Match"] = if_match - - headers["Content-Type"] = "application/json" - - headers["Content-Type"] = "application/scim+json" - - headers["Accept"] = "application/scim+json" - - payload = self._version.update( - method="PUT", uri=self._uri, data=data, headers=headers - ) - - return UserInstance( - self._version, - payload, - organization_sid=self._solution["organization_sid"], - user_sid=self._solution["user_sid"], - ) - - async def update_async( - self, scim_user: ScimUser, if_match: Union[str, object] = values.unset - ) -> UserInstance: - """ - Asynchronous coroutine to update the UserInstance - - :param scim_user: - :param if_match: - - :returns: The updated UserInstance - """ - data = scim_user.to_dict() - - headers = values.of({}) - - if not ( - if_match is values.unset or (isinstance(if_match, str) and not if_match) - ): - headers["If-Match"] = if_match - - headers["Content-Type"] = "application/json" - - headers["Content-Type"] = "application/scim+json" - - headers["Accept"] = "application/scim+json" - - payload = await self._version.update_async( - method="PUT", uri=self._uri, data=data, headers=headers - ) - - return UserInstance( - self._version, - payload, - organization_sid=self._solution["organization_sid"], - user_sid=self._solution["user_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 UserPage(Page): - - def get_instance(self, payload: Dict[str, Any]) -> UserInstance: - """ - Build an instance of UserInstance - - :param payload: Payload response from the API - """ - return UserInstance( - self._version, payload, organization_sid=self._solution["organization_sid"] - ) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" - - -class UserList(ListResource): - - class ScimEmailAddress(object): - """ - :ivar primary: Indicates if this email address is the primary one - :ivar value: The actual email address value - :ivar type: The type of email address (e.g., work, home, etc.) - """ - - def __init__(self, payload: Dict[str, Any]): - - self.primary: Optional[bool] = payload.get("primary") - self.value: Optional[str] = payload.get("value") - self.type: Optional[str] = payload.get("type") - - def to_dict(self): - return { - "primary": self.primary, - "value": self.value, - "type": self.type, - } - - class ScimMeta(object): - """ - :ivar resource_type: Indicates the type of the resource - :ivar created: The date and time when the resource was created in the system - :ivar last_modified: The date and time when the resource was last modified - :ivar version: A version identifier for the resource. This can be used to manage resource versioning and concurrency control. - """ - - def __init__(self, payload: Dict[str, Any]): - - self.resource_type: Optional[str] = payload.get("resource_type") - self.created: Optional[datetime] = payload.get("created") - self.last_modified: Optional[datetime] = payload.get("last_modified") - self.version: Optional[str] = payload.get("version") - - def to_dict(self): - return { - "resource_type": self.resource_type, - "created": self.created, - "last_modified": self.last_modified, - "version": self.version, - } - - class ScimName(object): - """ - :ivar given_name: The user's first or given name - :ivar family_name: The user's last or family name - """ - - def __init__(self, payload: Dict[str, Any]): - - self.given_name: Optional[str] = payload.get("given_name") - self.family_name: Optional[str] = payload.get("family_name") - - def to_dict(self): - return { - "given_name": self.given_name, - "family_name": self.family_name, - } - - class ScimUser(object): - """ - :ivar id: Unique Twilio user sid - :ivar external_id: External unique resource id defined by provisioning client - :ivar user_name: Unique username, MUST be same as primary email address - :ivar display_name: User friendly display name - :ivar name: - :ivar emails: Email address list of the user. Primary email must be defined if there are more than 1 email. Primary email must match the username. - :ivar active: Indicates whether the user is active - :ivar locale: User's locale - :ivar timezone: User's time zone - :ivar schemas: An array of URIs that indicate the schemas supported for this user resource - :ivar meta: - :ivar detail: A human-readable description of the error - :ivar scim_type: A scimType error code as defined in RFC7644 - :ivar status: Http status code - :ivar code: Twilio-specific error code - :ivar more_info: Link to Error Code References - """ - - def __init__(self, payload: Dict[str, Any]): - - self.id: Optional[str] = payload.get("id") - self.external_id: Optional[str] = payload.get("external_id") - self.user_name: Optional[str] = payload.get("user_name") - self.display_name: Optional[str] = payload.get("display_name") - self.name: Optional[UserList.ScimName] = payload.get("name") - self.emails: Optional[List[UserList.ScimEmailAddress]] = payload.get( - "emails" - ) - self.active: Optional[bool] = payload.get("active") - self.locale: Optional[str] = payload.get("locale") - self.timezone: Optional[str] = payload.get("timezone") - self.schemas: Optional[List[str]] = payload.get("schemas") - self.meta: Optional[UserList.ScimMeta] = payload.get("meta") - self.detail: Optional[str] = payload.get("detail") - self.scim_type: Optional[str] = payload.get("scim_type") - self.status: Optional[str] = payload.get("status") - self.code: Optional[int] = payload.get("code") - self.more_info: Optional[str] = payload.get("more_info") - - def to_dict(self): - return { - "id": self.id, - "externalId": self.external_id, - "userName": self.user_name, - "displayName": self.display_name, - "name": self.name.to_dict() if self.name is not None else None, - "emails": ( - [emails.to_dict() for emails in self.emails] - if self.emails is not None - else None - ), - "active": self.active, - "locale": self.locale, - "timezone": self.timezone, - "schemas": self.schemas, - "meta": self.meta.to_dict() if self.meta is not None else None, - "detail": self.detail, - "scimType": self.scim_type, - "status": self.status, - "code": self.code, - "moreInfo": self.more_info, - } - - def __init__(self, version: Version, organization_sid: str): - """ - Initialize the UserList - - :param version: Version that contains the resource - :param organization_sid: - - """ - super().__init__(version) - - # Path Solution - self._solution = { - "organization_sid": organization_sid, - } - self._uri = "/{organization_sid}/scim/Users".format(**self._solution) - - def create(self, scim_user: ScimUser) -> UserInstance: - """ - Create the UserInstance - - :param scim_user: - - :returns: The created UserInstance - """ - data = scim_user.to_dict() - - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Content-Type"] = "application/json" - - headers["Content-Type"] = "application/scim+json" - - headers["Accept"] = "application/scim+json" - - payload = self._version.create( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return UserInstance( - self._version, payload, organization_sid=self._solution["organization_sid"] - ) - - async def create_async(self, scim_user: ScimUser) -> UserInstance: - """ - Asynchronously create the UserInstance - - :param scim_user: - - :returns: The created UserInstance - """ - data = scim_user.to_dict() - - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Content-Type"] = "application/json" - - headers["Content-Type"] = "application/scim+json" - - headers["Accept"] = "application/scim+json" - - payload = await self._version.create_async( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return UserInstance( - self._version, payload, organization_sid=self._solution["organization_sid"] - ) - - def stream( - self, - filter: Union[str, object] = values.unset, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> Iterator[UserInstance]: - """ - Streams UserInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param str filter: - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - """ - limits = self._version.read_limits(limit, page_size) - page = self.page(filter=filter, page_size=limits["page_size"]) - - return self._version.stream(page, limits["limit"]) - - async def stream_async( - self, - filter: Union[str, object] = values.unset, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> AsyncIterator[UserInstance]: - """ - Asynchronously streams UserInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param str filter: - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - """ - limits = self._version.read_limits(limit, page_size) - page = await self.page_async(filter=filter, page_size=limits["page_size"]) - - return self._version.stream_async(page, limits["limit"]) - - def list( - self, - filter: Union[str, object] = values.unset, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[UserInstance]: - """ - Lists UserInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param str filter: - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: list that will contain up to limit results - """ - return list( - self.stream( - filter=filter, - limit=limit, - page_size=page_size, - ) - ) - - async def list_async( - self, - filter: Union[str, object] = values.unset, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[UserInstance]: - """ - Asynchronously lists UserInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param str filter: - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: list that will contain up to limit results - """ - return [ - record - async for record in await self.stream_async( - filter=filter, - limit=limit, - page_size=page_size, - ) - ] - - def page( - self, - filter: Union[str, object] = values.unset, - page_token: Union[str, object] = values.unset, - page_number: Union[int, object] = values.unset, - page_size: Union[int, object] = values.unset, - ) -> UserPage: - """ - Retrieve a single page of UserInstance records from the API. - Request is executed immediately - - :param filter: - :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 - - :returns: Page of UserInstance - """ - data = values.of( - { - "filter": filter, - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Accept"] = "application/scim+json" - - response = self._version.page( - method="GET", uri=self._uri, params=data, headers=headers - ) - return UserPage(self._version, response, self._solution) - - async def page_async( - self, - filter: Union[str, object] = values.unset, - page_token: Union[str, object] = values.unset, - page_number: Union[int, object] = values.unset, - page_size: Union[int, object] = values.unset, - ) -> UserPage: - """ - Asynchronously retrieve a single page of UserInstance records from the API. - Request is executed immediately - - :param filter: - :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 - - :returns: Page of UserInstance - """ - data = values.of( - { - "filter": filter, - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Accept"] = "application/scim+json" - - response = await self._version.page_async( - method="GET", uri=self._uri, params=data, headers=headers - ) - return UserPage(self._version, response, self._solution) - - def get_page(self, target_url: str) -> UserPage: - """ - Retrieve a specific page of UserInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of UserInstance - """ - response = self._version.domain.twilio.request("GET", target_url) - return UserPage(self._version, response, self._solution) - - async def get_page_async(self, target_url: str) -> UserPage: - """ - Asynchronously retrieve a specific page of UserInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of UserInstance - """ - response = await self._version.domain.twilio.request_async("GET", target_url) - return UserPage(self._version, response, self._solution) - - def get(self, organization_sid: str, user_sid: str) -> UserContext: - """ - Constructs a UserContext - - :param organization_sid: - :param user_sid: - """ - return UserContext( - self._version, organization_sid=organization_sid, user_sid=user_sid - ) - - def __call__(self, organization_sid: str, user_sid: str) -> UserContext: - """ - Constructs a UserContext - - :param organization_sid: - :param user_sid: - """ - return UserContext( - self._version, organization_sid=organization_sid, user_sid=user_sid - ) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" From 0b16947b3ec7991a373ce68288dc2adf6be8f706 Mon Sep 17 00:00:00 2001 From: Athira Sabu <102021496+AsabuHere@users.noreply.github.com> Date: Fri, 13 Dec 2024 11:56:19 +0530 Subject: [PATCH 56/87] Update __init__.py (#827) --- twilio/rest/preview_iam/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/twilio/rest/preview_iam/__init__.py b/twilio/rest/preview_iam/__init__.py index 9103436220..f183fb8393 100644 --- a/twilio/rest/preview_iam/__init__.py +++ b/twilio/rest/preview_iam/__init__.py @@ -9,12 +9,12 @@ from twilio.rest.preview_iam.versionless.organization import ( OrganizationList, ) - +from twilio.rest.preview_iam.versionless import Versionless class PreviewIam(PreviewIamBase): @property def organization(self) -> OrganizationList: - return self.versionless.organization + return Versionless(self).organization @property def authorize(self) -> AuthorizeList: From 38ab9a40aeccb746b4fbfd02d17e30a84605ae23 Mon Sep 17 00:00:00 2001 From: Twilio Date: Fri, 13 Dec 2024 13:48:19 +0000 Subject: [PATCH 57/87] [Librarian] Regenerated @ b65acba5c4232d15904620906c50336624531359 f22b1df4a255e9c39bba77d26124d8caa19d2902 --- CHANGES.md | 9 +++++++++ twilio/rest/__init__.py | 2 ++ twilio/rest/preview_iam/PreviewIamBase.py | 11 ----------- twilio/rest/preview_iam/__init__.py | 1 + 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 3c59707068..f95edb2e60 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,15 @@ twilio-python Changelog Here you can see the full list of changes between each twilio-python release. +[2024-12-13] Version 9.4.1 +-------------------------- +**Library - Fix** +- [PR #827](https://github.com/twilio/twilio-python/pull/827): Fixing init file for preview iam domain. Thanks to [@AsabuHere](https://github.com/AsabuHere)! + +**Library - Chore** +- [PR #826](https://github.com/twilio/twilio-python/pull/826): fix orgs api changes. Thanks to [@tiwarishubham635](https://github.com/tiwarishubham635)! + + [2024-12-12] Version 9.4.0 -------------------------- **Library - Feature** diff --git a/twilio/rest/__init__.py b/twilio/rest/__init__.py index d727b2467e..5838363c52 100644 --- a/twilio/rest/__init__.py +++ b/twilio/rest/__init__.py @@ -97,6 +97,7 @@ def __init__( environment=None, edge=None, user_agent_extensions=None, + credential_provider=None, ): """ Initializes the Twilio Client @@ -122,6 +123,7 @@ def __init__( environment, edge, user_agent_extensions, + credential_provider, ) # Domains diff --git a/twilio/rest/preview_iam/PreviewIamBase.py b/twilio/rest/preview_iam/PreviewIamBase.py index bdf047ecd2..22fcbe70b1 100644 --- a/twilio/rest/preview_iam/PreviewIamBase.py +++ b/twilio/rest/preview_iam/PreviewIamBase.py @@ -13,7 +13,6 @@ from twilio.base.domain import Domain from twilio.rest import Client -from twilio.rest.preview_iam.organizations import Organizations from twilio.rest.preview_iam.v1 import V1 @@ -26,18 +25,8 @@ def __init__(self, twilio: Client): :returns: Domain for PreviewIam """ super().__init__(twilio, "https://preview-iam.twilio.com") - self._organizations: Optional[Organizations] = None self._v1: Optional[V1] = None - @property - def organizations(self) -> Organizations: - """ - :returns: Versions organizations of PreviewIam - """ - if self._organizations is None: - self._organizations = Organizations(self) - return self._organizations - @property def v1(self) -> V1: """ diff --git a/twilio/rest/preview_iam/__init__.py b/twilio/rest/preview_iam/__init__.py index f183fb8393..9a5bf85b24 100644 --- a/twilio/rest/preview_iam/__init__.py +++ b/twilio/rest/preview_iam/__init__.py @@ -11,6 +11,7 @@ ) from twilio.rest.preview_iam.versionless import Versionless + class PreviewIam(PreviewIamBase): @property def organization(self) -> OrganizationList: From f61eb7c08b71a7360fbe11bfee6abf9216611e2e Mon Sep 17 00:00:00 2001 From: Twilio Date: Fri, 13 Dec 2024 13:52:44 +0000 Subject: [PATCH 58/87] Release 9.4.1 --- setup.py | 2 +- twilio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 08c45fb9b8..d8a0907ea4 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name="twilio", - version="9.4.0", + version="9.4.1", description="Twilio API client and TwiML generator", author="Twilio", help_center="https://www.twilio.com/help/contact", diff --git a/twilio/__init__.py b/twilio/__init__.py index fef80b04ae..586ef4d4ab 100644 --- a/twilio/__init__.py +++ b/twilio/__init__.py @@ -1,2 +1,2 @@ -__version_info__ = ("9", "4", "0") +__version_info__ = ("9", "4", "1") __version__ = ".".join(__version_info__) From 6d40febd0bff6f56adcf2ac78e476f648a6af57e Mon Sep 17 00:00:00 2001 From: Shubham Date: Thu, 9 Jan 2025 13:50:41 +0530 Subject: [PATCH 59/87] chore: remove test for 3.7 (#832) --- .github/workflows/test-and-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-and-deploy.yml b/.github/workflows/test-and-deploy.yml index 9fdcf4c752..1e1c04d500 100644 --- a/.github/workflows/test-and-deploy.yml +++ b/.github/workflows/test-and-deploy.yml @@ -17,7 +17,7 @@ jobs: timeout-minutes: 20 strategy: matrix: - python-version: [ '3.7', '3.8', '3.9', '3.10', '3.11', '3.12' ] + python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ] steps: - name: Checkout twilio-python uses: actions/checkout@v3 From 45523ffa72ef79590f9f8e9f7429e6739c14cb0f Mon Sep 17 00:00:00 2001 From: Twilio Date: Thu, 9 Jan 2025 10:23:49 +0000 Subject: [PATCH 60/87] [Librarian] Regenerated @ 0a245f5931e0ff292c12b643839bbb9a1b3831e3 4727b4211b32329ec55ad87676be1f406d3fd9e9 --- CHANGES.md | 9 ++ .../api/v2010/account/call/transcription.py | 4 +- .../v1/assistant/assistants_knowledge.py | 2 + .../rest/assistants/v1/knowledge/__init__.py | 20 +++++ twilio/rest/content/v1/content/__init__.py | 87 ------------------- .../conversations/v1/address_configuration.py | 1 + twilio/rest/insights/v1/call/call_summary.py | 1 + twilio/rest/insights/v1/call_summaries.py | 1 + twilio/rest/numbers/v1/__init__.py | 24 +++-- ...=> porting_webhook_configuration_fetch.py} | 26 +++--- 10 files changed, 65 insertions(+), 110 deletions(-) rename twilio/rest/numbers/v1/{webhook.py => porting_webhook_configuration_fetch.py} (78%) diff --git a/CHANGES.md b/CHANGES.md index f95edb2e60..b7904a9901 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,15 @@ twilio-python Changelog Here you can see the full list of changes between each twilio-python release. +[2025-01-09] Version 9.4.2 +-------------------------- +**Library - Chore** +- [PR #832](https://github.com/twilio/twilio-python/pull/832): remove test for 3.7. Thanks to [@tiwarishubham635](https://github.com/tiwarishubham635)! + +**Numbers** +- Change beta feature flag to use v2/BulkHostedNumberOrders + + [2024-12-13] Version 9.4.1 -------------------------- **Library - Fix** diff --git a/twilio/rest/api/v2010/account/call/transcription.py b/twilio/rest/api/v2010/account/call/transcription.py index f415928cc8..5921cce12f 100644 --- a/twilio/rest/api/v2010/account/call/transcription.py +++ b/twilio/rest/api/v2010/account/call/transcription.py @@ -287,7 +287,7 @@ def create( :param speech_model: Recognition model used by the transcription engine, among those supported by the provider :param hints: A Phrase contains words and phrase \\\"hints\\\" so that the speech recognition engine is more likely to recognize them. :param enable_automatic_punctuation: The provider will add punctuation to recognition result - :param intelligence_service: The SID or the unique name of the [IntelligentService](https://www.twilio.com/docs/voice/intelligence/api/service-resource) to process the transcription. + :param intelligence_service: The SID or the unique name of the [Voice Intelligence Service](https://www.twilio.com/docs/voice/intelligence/api/service-resource) to process the transcription. :returns: The created TranscriptionInstance """ @@ -362,7 +362,7 @@ async def create_async( :param speech_model: Recognition model used by the transcription engine, among those supported by the provider :param hints: A Phrase contains words and phrase \\\"hints\\\" so that the speech recognition engine is more likely to recognize them. :param enable_automatic_punctuation: The provider will add punctuation to recognition result - :param intelligence_service: The SID or the unique name of the [IntelligentService](https://www.twilio.com/docs/voice/intelligence/api/service-resource) to process the transcription. + :param intelligence_service: The SID or the unique name of the [Voice Intelligence Service](https://www.twilio.com/docs/voice/intelligence/api/service-resource) to process the transcription. :returns: The created TranscriptionInstance """ diff --git a/twilio/rest/assistants/v1/assistant/assistants_knowledge.py b/twilio/rest/assistants/v1/assistant/assistants_knowledge.py index c3767223e1..681d71789b 100644 --- a/twilio/rest/assistants/v1/assistant/assistants_knowledge.py +++ b/twilio/rest/assistants/v1/assistant/assistants_knowledge.py @@ -32,6 +32,7 @@ class AssistantsKnowledgeInstance(InstanceResource): :ivar status: The status of processing the knowledge source ('QUEUED', 'PROCESSING', 'COMPLETED', 'FAILED') :ivar type: The type of knowledge source ('Web', 'Database', 'Text', 'File') :ivar url: The url of the knowledge resource. + :ivar embedding_model: The embedding model to be used for the knowledge source. :ivar date_created: The date and time in GMT when the Knowledge was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. :ivar date_updated: The date and time in GMT when the Knowledge was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. """ @@ -55,6 +56,7 @@ def __init__( self.status: Optional[str] = payload.get("status") self.type: Optional[str] = payload.get("type") self.url: Optional[str] = payload.get("url") + self.embedding_model: Optional[str] = payload.get("embedding_model") self.date_created: Optional[datetime] = deserialize.iso8601_datetime( payload.get("date_created") ) diff --git a/twilio/rest/assistants/v1/knowledge/__init__.py b/twilio/rest/assistants/v1/knowledge/__init__.py index 993ed922ce..7d616f8682 100644 --- a/twilio/rest/assistants/v1/knowledge/__init__.py +++ b/twilio/rest/assistants/v1/knowledge/__init__.py @@ -34,6 +34,7 @@ class AssistantsV1ServiceCreateKnowledgeRequest(object): :ivar name: The name of the tool. :ivar policy: :ivar type: The type of the knowledge source. + :ivar embedding_model: The embedding model to be used for the knowledge source. It's required for 'Database' type but disallowed for other types. """ def __init__(self, payload: Dict[str, Any]): @@ -48,6 +49,7 @@ def __init__(self, payload: Dict[str, Any]): KnowledgeList.AssistantsV1ServiceCreatePolicyRequest ] = payload.get("policy") self.type: Optional[str] = payload.get("type") + self.embedding_model: Optional[str] = payload.get("embedding_model") def to_dict(self): return { @@ -57,6 +59,7 @@ def to_dict(self): "name": self.name, "policy": self.policy.to_dict() if self.policy is not None else None, "type": self.type, + "embedding_model": self.embedding_model, } class AssistantsV1ServiceCreatePolicyRequest(object): @@ -94,6 +97,7 @@ class AssistantsV1ServiceUpdateKnowledgeRequest(object): :ivar name: The name of the knowledge source. :ivar policy: :ivar type: The description of the knowledge source. + :ivar embedding_model: The embedding model to be used for the knowledge source. It's only applicable to 'Database' type. """ def __init__(self, payload: Dict[str, Any]): @@ -107,6 +111,7 @@ def __init__(self, payload: Dict[str, Any]): KnowledgeList.AssistantsV1ServiceCreatePolicyRequest ] = payload.get("policy") self.type: Optional[str] = payload.get("type") + self.embedding_model: Optional[str] = payload.get("embedding_model") def to_dict(self): return { @@ -115,6 +120,7 @@ def to_dict(self): "name": self.name, "policy": self.policy.to_dict() if self.policy is not None else None, "type": self.type, + "embedding_model": self.embedding_model, } """ @@ -126,6 +132,7 @@ def to_dict(self): :ivar status: The status of processing the knowledge source ('QUEUED', 'PROCESSING', 'COMPLETED', 'FAILED') :ivar type: The type of knowledge source ('Web', 'Database', 'Text', 'File') :ivar url: The url of the knowledge resource. + :ivar embedding_model: The embedding model to be used for the knowledge source. :ivar date_created: The date and time in GMT when the Knowledge was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. :ivar date_updated: The date and time in GMT when the Knowledge was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. """ @@ -145,6 +152,7 @@ def __init__( self.status: Optional[str] = payload.get("status") self.type: Optional[str] = payload.get("type") self.url: Optional[str] = payload.get("url") + self.embedding_model: Optional[str] = payload.get("embedding_model") self.date_created: Optional[datetime] = deserialize.iso8601_datetime( payload.get("date_created") ) @@ -276,6 +284,7 @@ class AssistantsV1ServiceCreateKnowledgeRequest(object): :ivar name: The name of the tool. :ivar policy: :ivar type: The type of the knowledge source. + :ivar embedding_model: The embedding model to be used for the knowledge source. It's required for 'Database' type but disallowed for other types. """ def __init__(self, payload: Dict[str, Any]): @@ -290,6 +299,7 @@ def __init__(self, payload: Dict[str, Any]): KnowledgeList.AssistantsV1ServiceCreatePolicyRequest ] = payload.get("policy") self.type: Optional[str] = payload.get("type") + self.embedding_model: Optional[str] = payload.get("embedding_model") def to_dict(self): return { @@ -299,6 +309,7 @@ def to_dict(self): "name": self.name, "policy": self.policy.to_dict() if self.policy is not None else None, "type": self.type, + "embedding_model": self.embedding_model, } class AssistantsV1ServiceCreatePolicyRequest(object): @@ -336,6 +347,7 @@ class AssistantsV1ServiceUpdateKnowledgeRequest(object): :ivar name: The name of the knowledge source. :ivar policy: :ivar type: The description of the knowledge source. + :ivar embedding_model: The embedding model to be used for the knowledge source. It's only applicable to 'Database' type. """ def __init__(self, payload: Dict[str, Any]): @@ -349,6 +361,7 @@ def __init__(self, payload: Dict[str, Any]): KnowledgeList.AssistantsV1ServiceCreatePolicyRequest ] = payload.get("policy") self.type: Optional[str] = payload.get("type") + self.embedding_model: Optional[str] = payload.get("embedding_model") def to_dict(self): return { @@ -357,6 +370,7 @@ def to_dict(self): "name": self.name, "policy": self.policy.to_dict() if self.policy is not None else None, "type": self.type, + "embedding_model": self.embedding_model, } def __init__(self, version: Version, id: str): @@ -562,6 +576,7 @@ class AssistantsV1ServiceCreateKnowledgeRequest(object): :ivar name: The name of the tool. :ivar policy: :ivar type: The type of the knowledge source. + :ivar embedding_model: The embedding model to be used for the knowledge source. It's required for 'Database' type but disallowed for other types. """ def __init__(self, payload: Dict[str, Any]): @@ -576,6 +591,7 @@ def __init__(self, payload: Dict[str, Any]): KnowledgeList.AssistantsV1ServiceCreatePolicyRequest ] = payload.get("policy") self.type: Optional[str] = payload.get("type") + self.embedding_model: Optional[str] = payload.get("embedding_model") def to_dict(self): return { @@ -585,6 +601,7 @@ def to_dict(self): "name": self.name, "policy": self.policy.to_dict() if self.policy is not None else None, "type": self.type, + "embedding_model": self.embedding_model, } class AssistantsV1ServiceCreatePolicyRequest(object): @@ -622,6 +639,7 @@ class AssistantsV1ServiceUpdateKnowledgeRequest(object): :ivar name: The name of the knowledge source. :ivar policy: :ivar type: The description of the knowledge source. + :ivar embedding_model: The embedding model to be used for the knowledge source. It's only applicable to 'Database' type. """ def __init__(self, payload: Dict[str, Any]): @@ -635,6 +653,7 @@ def __init__(self, payload: Dict[str, Any]): KnowledgeList.AssistantsV1ServiceCreatePolicyRequest ] = payload.get("policy") self.type: Optional[str] = payload.get("type") + self.embedding_model: Optional[str] = payload.get("embedding_model") def to_dict(self): return { @@ -643,6 +662,7 @@ def to_dict(self): "name": self.name, "policy": self.policy.to_dict() if self.policy is not None else None, "type": self.type, + "embedding_model": self.embedding_model, } def __init__(self, version: Version): diff --git a/twilio/rest/content/v1/content/__init__.py b/twilio/rest/content/v1/content/__init__.py index d877b63bc4..60a5b05016 100644 --- a/twilio/rest/content/v1/content/__init__.py +++ b/twilio/rest/content/v1/content/__init__.py @@ -247,46 +247,17 @@ class FlowsPageComponent(object): """ :ivar label: :ivar type: - :ivar text: - :ivar options: """ def __init__(self, payload: Dict[str, Any]): self.label: Optional[str] = payload.get("label") self.type: Optional[str] = payload.get("type") - self.text: Optional[str] = payload.get("text") - self.options: Optional[List[ContentList.FlowsPageComponentSelectItem]] = ( - payload.get("options") - ) def to_dict(self): return { "label": self.label, "type": self.type, - "text": self.text, - "options": ( - [options.to_dict() for options in self.options] - if self.options is not None - else None - ), - } - - class FlowsPageComponentSelectItem(object): - """ - :ivar id: - :ivar title: - """ - - def __init__(self, payload: Dict[str, Any]): - - self.id: Optional[str] = payload.get("id") - self.title: Optional[str] = payload.get("title") - - def to_dict(self): - return { - "id": self.id, - "title": self.title, } class ListItem(object): @@ -1106,46 +1077,17 @@ class FlowsPageComponent(object): """ :ivar label: :ivar type: - :ivar text: - :ivar options: """ def __init__(self, payload: Dict[str, Any]): self.label: Optional[str] = payload.get("label") self.type: Optional[str] = payload.get("type") - self.text: Optional[str] = payload.get("text") - self.options: Optional[List[ContentList.FlowsPageComponentSelectItem]] = ( - payload.get("options") - ) def to_dict(self): return { "label": self.label, "type": self.type, - "text": self.text, - "options": ( - [options.to_dict() for options in self.options] - if self.options is not None - else None - ), - } - - class FlowsPageComponentSelectItem(object): - """ - :ivar id: - :ivar title: - """ - - def __init__(self, payload: Dict[str, Any]): - - self.id: Optional[str] = payload.get("id") - self.title: Optional[str] = payload.get("title") - - def to_dict(self): - return { - "id": self.id, - "title": self.title, } class ListItem(object): @@ -1966,46 +1908,17 @@ class FlowsPageComponent(object): """ :ivar label: :ivar type: - :ivar text: - :ivar options: """ def __init__(self, payload: Dict[str, Any]): self.label: Optional[str] = payload.get("label") self.type: Optional[str] = payload.get("type") - self.text: Optional[str] = payload.get("text") - self.options: Optional[List[ContentList.FlowsPageComponentSelectItem]] = ( - payload.get("options") - ) def to_dict(self): return { "label": self.label, "type": self.type, - "text": self.text, - "options": ( - [options.to_dict() for options in self.options] - if self.options is not None - else None - ), - } - - class FlowsPageComponentSelectItem(object): - """ - :ivar id: - :ivar title: - """ - - def __init__(self, payload: Dict[str, Any]): - - self.id: Optional[str] = payload.get("id") - self.title: Optional[str] = payload.get("title") - - def to_dict(self): - return { - "id": self.id, - "title": self.title, } class ListItem(object): diff --git a/twilio/rest/conversations/v1/address_configuration.py b/twilio/rest/conversations/v1/address_configuration.py index 096f023889..4ebfa47fc2 100644 --- a/twilio/rest/conversations/v1/address_configuration.py +++ b/twilio/rest/conversations/v1/address_configuration.py @@ -39,6 +39,7 @@ class Type(object): MESSENGER = "messenger" GBM = "gbm" EMAIL = "email" + RCS = "rcs" """ :ivar sid: A 34 character string that uniquely identifies this resource. diff --git a/twilio/rest/insights/v1/call/call_summary.py b/twilio/rest/insights/v1/call/call_summary.py index f11aa912ed..e21af100a1 100644 --- a/twilio/rest/insights/v1/call/call_summary.py +++ b/twilio/rest/insights/v1/call/call_summary.py @@ -47,6 +47,7 @@ class CallType(object): SIP = "sip" TRUNKING = "trunking" CLIENT = "client" + WHATSAPP = "whatsapp" class ProcessingState(object): COMPLETE = "complete" diff --git a/twilio/rest/insights/v1/call_summaries.py b/twilio/rest/insights/v1/call_summaries.py index 45fcce98c1..0a75e38454 100644 --- a/twilio/rest/insights/v1/call_summaries.py +++ b/twilio/rest/insights/v1/call_summaries.py @@ -48,6 +48,7 @@ class CallType(object): SIP = "sip" TRUNKING = "trunking" CLIENT = "client" + WHATSAPP = "whatsapp" class ProcessingState(object): COMPLETE = "complete" diff --git a/twilio/rest/numbers/v1/__init__.py b/twilio/rest/numbers/v1/__init__.py index 68f078a88d..043364c3d5 100644 --- a/twilio/rest/numbers/v1/__init__.py +++ b/twilio/rest/numbers/v1/__init__.py @@ -28,10 +28,12 @@ from twilio.rest.numbers.v1.porting_webhook_configuration_delete import ( PortingWebhookConfigurationDeleteList, ) +from twilio.rest.numbers.v1.porting_webhook_configuration_fetch import ( + PortingWebhookConfigurationFetchList, +) from twilio.rest.numbers.v1.signing_request_configuration import ( SigningRequestConfigurationList, ) -from twilio.rest.numbers.v1.webhook import WebhookList class V1(Version): @@ -56,10 +58,12 @@ def __init__(self, domain: Domain): self._porting_webhook_configurations_delete: Optional[ PortingWebhookConfigurationDeleteList ] = None + self._porting_webhook_configuration_fetch: Optional[ + PortingWebhookConfigurationFetchList + ] = None self._signing_request_configurations: Optional[ SigningRequestConfigurationList ] = None - self._webhook: Optional[WebhookList] = None @property def bulk_eligibilities(self) -> BulkEligibilityList: @@ -107,18 +111,22 @@ def porting_webhook_configurations_delete( ) return self._porting_webhook_configurations_delete + @property + def porting_webhook_configuration_fetch( + self, + ) -> PortingWebhookConfigurationFetchList: + if self._porting_webhook_configuration_fetch is None: + self._porting_webhook_configuration_fetch = ( + PortingWebhookConfigurationFetchList(self) + ) + return self._porting_webhook_configuration_fetch + @property def signing_request_configurations(self) -> SigningRequestConfigurationList: if self._signing_request_configurations is None: self._signing_request_configurations = SigningRequestConfigurationList(self) return self._signing_request_configurations - @property - def webhook(self) -> WebhookList: - if self._webhook is None: - self._webhook = WebhookList(self) - return self._webhook - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/numbers/v1/webhook.py b/twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py similarity index 78% rename from twilio/rest/numbers/v1/webhook.py rename to twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py index 69bd556326..5d381768c7 100644 --- a/twilio/rest/numbers/v1/webhook.py +++ b/twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py @@ -21,7 +21,7 @@ from twilio.base.version import Version -class WebhookInstance(InstanceResource): +class PortingWebhookConfigurationFetchInstance(InstanceResource): """ :ivar url: The URL of the webhook configuration request :ivar port_in_target_url: The complete webhook url that will be called when a notification event for port in request or port in phone number happens @@ -52,14 +52,14 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" -class WebhookList(ListResource): +class PortingWebhookConfigurationFetchList(ListResource): def __init__(self, version: Version): """ - Initialize the WebhookList + Initialize the PortingWebhookConfigurationFetchList :param version: Version that contains the resource @@ -68,12 +68,12 @@ def __init__(self, version: Version): self._uri = "/Porting/Configuration/Webhook" - def fetch(self) -> WebhookInstance: + def fetch(self) -> PortingWebhookConfigurationFetchInstance: """ - Asynchronously fetch the WebhookInstance + Asynchronously fetch the PortingWebhookConfigurationFetchInstance - :returns: The fetched WebhookInstance + :returns: The fetched PortingWebhookConfigurationFetchInstance """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -81,14 +81,14 @@ def fetch(self) -> WebhookInstance: payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) - return WebhookInstance(self._version, payload) + return PortingWebhookConfigurationFetchInstance(self._version, payload) - async def fetch_async(self) -> WebhookInstance: + async def fetch_async(self) -> PortingWebhookConfigurationFetchInstance: """ - Asynchronously fetch the WebhookInstance + Asynchronously fetch the PortingWebhookConfigurationFetchInstance - :returns: The fetched WebhookInstance + :returns: The fetched PortingWebhookConfigurationFetchInstance """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -98,7 +98,7 @@ async def fetch_async(self) -> WebhookInstance: method="GET", uri=self._uri, headers=headers ) - return WebhookInstance(self._version, payload) + return PortingWebhookConfigurationFetchInstance(self._version, payload) def __repr__(self) -> str: """ @@ -106,4 +106,4 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" From 5de6bde5d279f45bd97ac88ff589237379f4ce85 Mon Sep 17 00:00:00 2001 From: Twilio Date: Thu, 9 Jan 2025 10:28:47 +0000 Subject: [PATCH 61/87] Release 9.4.2 --- setup.py | 2 +- twilio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index d8a0907ea4..0ab6bc732a 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name="twilio", - version="9.4.1", + version="9.4.2", description="Twilio API client and TwiML generator", author="Twilio", help_center="https://www.twilio.com/help/contact", diff --git a/twilio/__init__.py b/twilio/__init__.py index 586ef4d4ab..145e35680b 100644 --- a/twilio/__init__.py +++ b/twilio/__init__.py @@ -1,2 +1,2 @@ -__version_info__ = ("9", "4", "1") +__version_info__ = ("9", "4", "2") __version__ = ".".join(__version_info__) From 6a576aedad5e5ff50cdc19e966b30311364d2c5d Mon Sep 17 00:00:00 2001 From: Twilio Date: Mon, 13 Jan 2025 11:43:33 +0000 Subject: [PATCH 62/87] [Librarian] Regenerated @ d9b0f7b0297f064eec2f219b29fd4193559c54f3 405f363a58346c6557d4194de16d9911b797e208 --- CHANGES.md | 6 + .../api/v2010/account/call/transcription.py | 4 +- .../conversations/v1/configuration/webhook.py | 10 +- twilio/rest/iam/v1/__init__.py | 12 +- twilio/rest/iam/v1/{new_api_key.py => key.py} | 30 +-- twilio/rest/marketplace/v1/__init__.py | 8 + twilio/rest/marketplace/v1/module_data.py | 176 ++++++++++++++++++ .../marketplace/v1/module_data_management.py | 4 +- twilio/rest/messaging/v1/service/__init__.py | 14 +- twilio/rest/numbers/v1/__init__.py | 24 +-- ...hook_configuration_fetch.py => webhook.py} | 26 +-- 11 files changed, 249 insertions(+), 65 deletions(-) rename twilio/rest/iam/v1/{new_api_key.py => key.py} (88%) create mode 100644 twilio/rest/marketplace/v1/module_data.py rename twilio/rest/numbers/v1/{porting_webhook_configuration_fetch.py => webhook.py} (78%) diff --git a/CHANGES.md b/CHANGES.md index b7904a9901..7c0335ea99 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,12 @@ twilio-python Changelog Here you can see the full list of changes between each twilio-python release. +[2025-01-13] Version 9.4.3 +-------------------------- +**Messaging** +- Adds validity period Default value in service resource documentation + + [2025-01-09] Version 9.4.2 -------------------------- **Library - Chore** diff --git a/twilio/rest/api/v2010/account/call/transcription.py b/twilio/rest/api/v2010/account/call/transcription.py index 5921cce12f..d64a5507b4 100644 --- a/twilio/rest/api/v2010/account/call/transcription.py +++ b/twilio/rest/api/v2010/account/call/transcription.py @@ -287,7 +287,7 @@ def create( :param speech_model: Recognition model used by the transcription engine, among those supported by the provider :param hints: A Phrase contains words and phrase \\\"hints\\\" so that the speech recognition engine is more likely to recognize them. :param enable_automatic_punctuation: The provider will add punctuation to recognition result - :param intelligence_service: The SID or the unique name of the [Voice Intelligence Service](https://www.twilio.com/docs/voice/intelligence/api/service-resource) to process the transcription. + :param intelligence_service: The SID of the [Voice Intelligence Service](https://www.twilio.com/docs/voice/intelligence/api/service-resource) for persisting transcripts and running post-call Language Operators . :returns: The created TranscriptionInstance """ @@ -362,7 +362,7 @@ async def create_async( :param speech_model: Recognition model used by the transcription engine, among those supported by the provider :param hints: A Phrase contains words and phrase \\\"hints\\\" so that the speech recognition engine is more likely to recognize them. :param enable_automatic_punctuation: The provider will add punctuation to recognition result - :param intelligence_service: The SID or the unique name of the [Voice Intelligence Service](https://www.twilio.com/docs/voice/intelligence/api/service-resource) to process the transcription. + :param intelligence_service: The SID of the [Voice Intelligence Service](https://www.twilio.com/docs/voice/intelligence/api/service-resource) for persisting transcripts and running post-call Language Operators . :returns: The created TranscriptionInstance """ diff --git a/twilio/rest/conversations/v1/configuration/webhook.py b/twilio/rest/conversations/v1/configuration/webhook.py index 183930708e..f471c879ab 100644 --- a/twilio/rest/conversations/v1/configuration/webhook.py +++ b/twilio/rest/conversations/v1/configuration/webhook.py @@ -33,7 +33,7 @@ class Target(object): """ :ivar account_sid: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. :ivar method: - :ivar filters: The list of webhook event triggers that are enabled for this Service: `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onConversationUpdated`, `onConversationRemoved`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved` + :ivar filters: The list of webhook event triggers that are enabled for this Service: `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onMessageAdd`, `onMessageUpdate`, `onMessageRemove`, `onConversationUpdated`, `onConversationRemoved`, `onConversationAdd`, `onConversationAdded`, `onConversationRemove`, `onConversationUpdate`, `onConversationStateUpdated`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved`, `onParticipantAdd`, `onParticipantRemove`, `onParticipantUpdate`, `onDeliveryUpdated`, `onUserAdded`, `onUserUpdate`, `onUserUpdated` :ivar pre_webhook_url: The absolute url the pre-event webhook request should be sent to. :ivar post_webhook_url: The absolute url the post-event webhook request should be sent to. :ivar target: @@ -97,7 +97,7 @@ def update( Update the WebhookInstance :param method: The HTTP method to be used when sending a webhook request. - :param filters: The list of webhook event triggers that are enabled for this Service: `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onConversationUpdated`, `onConversationRemoved`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved` + :param filters: The list of webhook event triggers that are enabled for this Service: `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onMessageAdd`, `onMessageUpdate`, `onMessageRemove`, `onConversationUpdated`, `onConversationRemoved`, `onConversationAdd`, `onConversationAdded`, `onConversationRemove`, `onConversationUpdate`, `onConversationStateUpdated`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved`, `onParticipantAdd`, `onParticipantRemove`, `onParticipantUpdate`, `onDeliveryUpdated`, `onUserAdded`, `onUserUpdate`, `onUserUpdated` :param pre_webhook_url: The absolute url the pre-event webhook request should be sent to. :param post_webhook_url: The absolute url the post-event webhook request should be sent to. :param target: @@ -124,7 +124,7 @@ async def update_async( Asynchronous coroutine to update the WebhookInstance :param method: The HTTP method to be used when sending a webhook request. - :param filters: The list of webhook event triggers that are enabled for this Service: `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onConversationUpdated`, `onConversationRemoved`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved` + :param filters: The list of webhook event triggers that are enabled for this Service: `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onMessageAdd`, `onMessageUpdate`, `onMessageRemove`, `onConversationUpdated`, `onConversationRemoved`, `onConversationAdd`, `onConversationAdded`, `onConversationRemove`, `onConversationUpdate`, `onConversationStateUpdated`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved`, `onParticipantAdd`, `onParticipantRemove`, `onParticipantUpdate`, `onDeliveryUpdated`, `onUserAdded`, `onUserUpdate`, `onUserUpdated` :param pre_webhook_url: The absolute url the pre-event webhook request should be sent to. :param post_webhook_url: The absolute url the post-event webhook request should be sent to. :param target: @@ -213,7 +213,7 @@ def update( Update the WebhookInstance :param method: The HTTP method to be used when sending a webhook request. - :param filters: The list of webhook event triggers that are enabled for this Service: `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onConversationUpdated`, `onConversationRemoved`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved` + :param filters: The list of webhook event triggers that are enabled for this Service: `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onMessageAdd`, `onMessageUpdate`, `onMessageRemove`, `onConversationUpdated`, `onConversationRemoved`, `onConversationAdd`, `onConversationAdded`, `onConversationRemove`, `onConversationUpdate`, `onConversationStateUpdated`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved`, `onParticipantAdd`, `onParticipantRemove`, `onParticipantUpdate`, `onDeliveryUpdated`, `onUserAdded`, `onUserUpdate`, `onUserUpdated` :param pre_webhook_url: The absolute url the pre-event webhook request should be sent to. :param post_webhook_url: The absolute url the post-event webhook request should be sent to. :param target: @@ -254,7 +254,7 @@ async def update_async( Asynchronous coroutine to update the WebhookInstance :param method: The HTTP method to be used when sending a webhook request. - :param filters: The list of webhook event triggers that are enabled for this Service: `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onConversationUpdated`, `onConversationRemoved`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved` + :param filters: The list of webhook event triggers that are enabled for this Service: `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onMessageAdd`, `onMessageUpdate`, `onMessageRemove`, `onConversationUpdated`, `onConversationRemoved`, `onConversationAdd`, `onConversationAdded`, `onConversationRemove`, `onConversationUpdate`, `onConversationStateUpdated`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved`, `onParticipantAdd`, `onParticipantRemove`, `onParticipantUpdate`, `onDeliveryUpdated`, `onUserAdded`, `onUserUpdate`, `onUserUpdated` :param pre_webhook_url: The absolute url the pre-event webhook request should be sent to. :param post_webhook_url: The absolute url the post-event webhook request should be sent to. :param target: diff --git a/twilio/rest/iam/v1/__init__.py b/twilio/rest/iam/v1/__init__.py index 0c46947341..408de11acb 100644 --- a/twilio/rest/iam/v1/__init__.py +++ b/twilio/rest/iam/v1/__init__.py @@ -17,7 +17,7 @@ from twilio.base.domain import Domain from twilio.rest.iam.v1.api_key import ApiKeyList from twilio.rest.iam.v1.get_api_keys import GetApiKeysList -from twilio.rest.iam.v1.new_api_key import NewApiKeyList +from twilio.rest.iam.v1.key import KeyList class V1(Version): @@ -31,7 +31,7 @@ def __init__(self, domain: Domain): super().__init__(domain, "v1") self._api_key: Optional[ApiKeyList] = None self._get_api_keys: Optional[GetApiKeysList] = None - self._new_api_key: Optional[NewApiKeyList] = None + self._keys: Optional[KeyList] = None @property def api_key(self) -> ApiKeyList: @@ -46,10 +46,10 @@ def get_api_keys(self) -> GetApiKeysList: return self._get_api_keys @property - def new_api_key(self) -> NewApiKeyList: - if self._new_api_key is None: - self._new_api_key = NewApiKeyList(self) - return self._new_api_key + def keys(self) -> KeyList: + if self._keys is None: + self._keys = KeyList(self) + return self._keys def __repr__(self) -> str: """ diff --git a/twilio/rest/iam/v1/new_api_key.py b/twilio/rest/iam/v1/key.py similarity index 88% rename from twilio/rest/iam/v1/new_api_key.py rename to twilio/rest/iam/v1/key.py index 760ce79ca3..cd5556df94 100644 --- a/twilio/rest/iam/v1/new_api_key.py +++ b/twilio/rest/iam/v1/key.py @@ -21,7 +21,7 @@ from twilio.base.version import Version -class NewApiKeyInstance(InstanceResource): +class KeyInstance(InstanceResource): class Keytype(object): RESTRICTED = "restricted" @@ -56,14 +56,14 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" -class NewApiKeyList(ListResource): +class KeyList(ListResource): def __init__(self, version: Version): """ - Initialize the NewApiKeyList + Initialize the KeyList :param version: Version that contains the resource @@ -76,18 +76,18 @@ def create( self, account_sid: str, friendly_name: Union[str, object] = values.unset, - key_type: Union["NewApiKeyInstance.Keytype", object] = values.unset, + key_type: Union["KeyInstance.Keytype", object] = values.unset, policy: Union[object, object] = values.unset, - ) -> NewApiKeyInstance: + ) -> KeyInstance: """ - Create the NewApiKeyInstance + Create the KeyInstance :param account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Payments resource. :param friendly_name: A descriptive string that you create to describe the resource. It can be up to 64 characters long. :param key_type: :param policy: The \\\\`Policy\\\\` object is a collection that specifies the allowed Twilio permissions for the restricted key. For more information on the permissions available with restricted API keys, refer to the [Twilio documentation](https://www.twilio.com/docs/iam/api-keys/restricted-api-keys#permissions-available-with-restricted-api-keys). - :returns: The created NewApiKeyInstance + :returns: The created KeyInstance """ data = values.of( @@ -108,24 +108,24 @@ def create( method="POST", uri=self._uri, data=data, headers=headers ) - return NewApiKeyInstance(self._version, payload) + return KeyInstance(self._version, payload) async def create_async( self, account_sid: str, friendly_name: Union[str, object] = values.unset, - key_type: Union["NewApiKeyInstance.Keytype", object] = values.unset, + key_type: Union["KeyInstance.Keytype", object] = values.unset, policy: Union[object, object] = values.unset, - ) -> NewApiKeyInstance: + ) -> KeyInstance: """ - Asynchronously create the NewApiKeyInstance + Asynchronously create the KeyInstance :param account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Payments resource. :param friendly_name: A descriptive string that you create to describe the resource. It can be up to 64 characters long. :param key_type: :param policy: The \\\\`Policy\\\\` object is a collection that specifies the allowed Twilio permissions for the restricted key. For more information on the permissions available with restricted API keys, refer to the [Twilio documentation](https://www.twilio.com/docs/iam/api-keys/restricted-api-keys#permissions-available-with-restricted-api-keys). - :returns: The created NewApiKeyInstance + :returns: The created KeyInstance """ data = values.of( @@ -146,7 +146,7 @@ async def create_async( method="POST", uri=self._uri, data=data, headers=headers ) - return NewApiKeyInstance(self._version, payload) + return KeyInstance(self._version, payload) def __repr__(self) -> str: """ @@ -154,4 +154,4 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" diff --git a/twilio/rest/marketplace/v1/__init__.py b/twilio/rest/marketplace/v1/__init__.py index 9a29e0b691..6a84b31cd9 100644 --- a/twilio/rest/marketplace/v1/__init__.py +++ b/twilio/rest/marketplace/v1/__init__.py @@ -17,6 +17,7 @@ from twilio.base.domain import Domain from twilio.rest.marketplace.v1.available_add_on import AvailableAddOnList from twilio.rest.marketplace.v1.installed_add_on import InstalledAddOnList +from twilio.rest.marketplace.v1.module_data import ModuleDataList from twilio.rest.marketplace.v1.module_data_management import ModuleDataManagementList from twilio.rest.marketplace.v1.referral_conversion import ReferralConversionList @@ -32,6 +33,7 @@ def __init__(self, domain: Domain): super().__init__(domain, "v1") self._available_add_ons: Optional[AvailableAddOnList] = None self._installed_add_ons: Optional[InstalledAddOnList] = None + self._module_data: Optional[ModuleDataList] = None self._module_data_management: Optional[ModuleDataManagementList] = None self._referral_conversion: Optional[ReferralConversionList] = None @@ -47,6 +49,12 @@ def installed_add_ons(self) -> InstalledAddOnList: self._installed_add_ons = InstalledAddOnList(self) return self._installed_add_ons + @property + def module_data(self) -> ModuleDataList: + if self._module_data is None: + self._module_data = ModuleDataList(self) + return self._module_data + @property def module_data_management(self) -> ModuleDataManagementList: if self._module_data_management is None: diff --git a/twilio/rest/marketplace/v1/module_data.py b/twilio/rest/marketplace/v1/module_data.py new file mode 100644 index 0000000000..1308c17a91 --- /dev/null +++ b/twilio/rest/marketplace/v1/module_data.py @@ -0,0 +1,176 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Marketplace + 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, Union +from twilio.base import values + +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class ModuleDataInstance(InstanceResource): + """ + :ivar url: URL to query the subresource. + :ivar sid: ModuleSid that identifies this Listing. + :ivar description: A JSON object describing the module and is displayed under the Description tab of the Module detail page. You can define the main body of the description, highlight key features or aspects of the module and if applicable, provide code samples for developers + :ivar support: A JSON object containing information on how customers can obtain support for the module. Use this parameter to provide details such as contact information and support description. + :ivar policies: A JSON object describing the module's privacy and legal policies and is displayed under the Policies tab of the Module detail page. The maximum file size for Policies is 5MB + :ivar module_info: A JSON object containing essential attributes that define a module. This information is presented on the Module detail page in the Twilio Marketplace Catalog. You can pass the following attributes in the JSON object + :ivar documentation: A JSON object for providing comprehensive information, instructions, and resources related to the module + :ivar configuration: A JSON object for providing listing specific configuration. Contains button setup, notification url, among others. + :ivar pricing: A JSON object for providing Listing specific pricing information. + :ivar listings: + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) + + self.url: Optional[str] = payload.get("url") + self.sid: Optional[str] = payload.get("sid") + self.description: Optional[Dict[str, object]] = payload.get("description") + self.support: Optional[Dict[str, object]] = payload.get("support") + self.policies: Optional[Dict[str, object]] = payload.get("policies") + self.module_info: Optional[Dict[str, object]] = payload.get("module_info") + self.documentation: Optional[Dict[str, object]] = payload.get("documentation") + self.configuration: Optional[Dict[str, object]] = payload.get("configuration") + self.pricing: Optional[Dict[str, object]] = payload.get("pricing") + self.listings: Optional[List[Dict[str, object]]] = payload.get("listings") + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "" + + +class ModuleDataList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the ModuleDataList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/Listings" + + def create( + self, + module_info: Union[str, object] = values.unset, + configuration: Union[str, object] = values.unset, + ) -> ModuleDataInstance: + """ + Create the ModuleDataInstance + + :param module_info: A JSON object containing essential attributes that define a Listing. + :param configuration: A JSON object for providing Listing-specific configuration. Contains button setup, notification URL, and more. + + :returns: The created ModuleDataInstance + """ + + data = values.of( + { + "ModuleInfo": module_info, + "Configuration": configuration, + } + ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return ModuleDataInstance(self._version, payload) + + async def create_async( + self, + module_info: Union[str, object] = values.unset, + configuration: Union[str, object] = values.unset, + ) -> ModuleDataInstance: + """ + Asynchronously create the ModuleDataInstance + + :param module_info: A JSON object containing essential attributes that define a Listing. + :param configuration: A JSON object for providing Listing-specific configuration. Contains button setup, notification URL, and more. + + :returns: The created ModuleDataInstance + """ + + data = values.of( + { + "ModuleInfo": module_info, + "Configuration": configuration, + } + ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return ModuleDataInstance(self._version, payload) + + def fetch(self) -> ModuleDataInstance: + """ + Asynchronously fetch the ModuleDataInstance + + + :returns: The fetched ModuleDataInstance + """ + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) + + return ModuleDataInstance(self._version, payload) + + async def fetch_async(self) -> ModuleDataInstance: + """ + Asynchronously fetch the ModuleDataInstance + + + :returns: The fetched ModuleDataInstance + """ + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + payload = await self._version.fetch_async( + method="GET", uri=self._uri, headers=headers + ) + + return ModuleDataInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/marketplace/v1/module_data_management.py b/twilio/rest/marketplace/v1/module_data_management.py index 2dbdfe055f..6ed82d846d 100644 --- a/twilio/rest/marketplace/v1/module_data_management.py +++ b/twilio/rest/marketplace/v1/module_data_management.py @@ -12,7 +12,7 @@ Do not edit the class manually. """ -from typing import Any, Dict, Optional, Union +from typing import Any, Dict, List, Optional, Union from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -31,6 +31,7 @@ class ModuleDataManagementInstance(InstanceResource): :ivar documentation: A JSON object for providing comprehensive information, instructions, and resources related to the module :ivar configuration: A JSON object for providing listing specific configuration. Contains button setup, notification url, among others. :ivar pricing: A JSON object for providing Listing specific pricing information. + :ivar listings: """ def __init__( @@ -47,6 +48,7 @@ def __init__( self.documentation: Optional[Dict[str, object]] = payload.get("documentation") self.configuration: Optional[Dict[str, object]] = payload.get("configuration") self.pricing: Optional[Dict[str, object]] = payload.get("pricing") + self.listings: Optional[List[Dict[str, object]]] = payload.get("listings") self._solution = { "sid": sid or self.sid, diff --git a/twilio/rest/messaging/v1/service/__init__.py b/twilio/rest/messaging/v1/service/__init__.py index 197bdf65f9..2ff3d4e191 100644 --- a/twilio/rest/messaging/v1/service/__init__.py +++ b/twilio/rest/messaging/v1/service/__init__.py @@ -55,7 +55,7 @@ class ScanMessageContent(object): :ivar fallback_to_long_code: [OBSOLETE] Former feature used to fallback to long code sender after certain short code message failures. :ivar area_code_geomatch: Whether to enable [Area Code Geomatch](https://www.twilio.com/docs/messaging/services#area-code-geomatch) on the Service Instance. :ivar synchronous_validation: Reserved. - :ivar validity_period: How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `14,400`. + :ivar validity_period: How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `14,400`. Default value is `14,400`. :ivar url: The absolute URL of the Service resource. :ivar links: The absolute URLs of related resources. :ivar usecase: A string that describes the scenario in which the Messaging Service will be used. Possible values are `notifications`, `marketing`, `verification`, `discussion`, `poll`, `undeclared`. @@ -200,7 +200,7 @@ def update( :param scan_message_content: :param fallback_to_long_code: [OBSOLETE] Former feature used to fallback to long code sender after certain short code message failures. :param area_code_geomatch: Whether to enable [Area Code Geomatch](https://www.twilio.com/docs/messaging/services#area-code-geomatch) on the Service Instance. - :param validity_period: How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `14,400`. + :param validity_period: How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `14,400`. Default value is `14,400`. :param synchronous_validation: Reserved. :param usecase: A string that describes the scenario in which the Messaging Service will be used. Possible values are `notifications`, `marketing`, `verification`, `discussion`, `poll`, `undeclared`. :param use_inbound_webhook_on_number: A boolean value that indicates either the webhook url configured on the phone number will be used or `inbound_request_url`/`fallback_url` url will be called when a message is received from the phone number. If this field is enabled then the webhook url defined on the phone number will override the `inbound_request_url`/`fallback_url` defined for the Messaging Service. @@ -262,7 +262,7 @@ async def update_async( :param scan_message_content: :param fallback_to_long_code: [OBSOLETE] Former feature used to fallback to long code sender after certain short code message failures. :param area_code_geomatch: Whether to enable [Area Code Geomatch](https://www.twilio.com/docs/messaging/services#area-code-geomatch) on the Service Instance. - :param validity_period: How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `14,400`. + :param validity_period: How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `14,400`. Default value is `14,400`. :param synchronous_validation: Reserved. :param usecase: A string that describes the scenario in which the Messaging Service will be used. Possible values are `notifications`, `marketing`, `verification`, `discussion`, `poll`, `undeclared`. :param use_inbound_webhook_on_number: A boolean value that indicates either the webhook url configured on the phone number will be used or `inbound_request_url`/`fallback_url` url will be called when a message is received from the phone number. If this field is enabled then the webhook url defined on the phone number will override the `inbound_request_url`/`fallback_url` defined for the Messaging Service. @@ -468,7 +468,7 @@ def update( :param scan_message_content: :param fallback_to_long_code: [OBSOLETE] Former feature used to fallback to long code sender after certain short code message failures. :param area_code_geomatch: Whether to enable [Area Code Geomatch](https://www.twilio.com/docs/messaging/services#area-code-geomatch) on the Service Instance. - :param validity_period: How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `14,400`. + :param validity_period: How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `14,400`. Default value is `14,400`. :param synchronous_validation: Reserved. :param usecase: A string that describes the scenario in which the Messaging Service will be used. Possible values are `notifications`, `marketing`, `verification`, `discussion`, `poll`, `undeclared`. :param use_inbound_webhook_on_number: A boolean value that indicates either the webhook url configured on the phone number will be used or `inbound_request_url`/`fallback_url` url will be called when a message is received from the phone number. If this field is enabled then the webhook url defined on the phone number will override the `inbound_request_url`/`fallback_url` defined for the Messaging Service. @@ -550,7 +550,7 @@ async def update_async( :param scan_message_content: :param fallback_to_long_code: [OBSOLETE] Former feature used to fallback to long code sender after certain short code message failures. :param area_code_geomatch: Whether to enable [Area Code Geomatch](https://www.twilio.com/docs/messaging/services#area-code-geomatch) on the Service Instance. - :param validity_period: How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `14,400`. + :param validity_period: How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `14,400`. Default value is `14,400`. :param synchronous_validation: Reserved. :param usecase: A string that describes the scenario in which the Messaging Service will be used. Possible values are `notifications`, `marketing`, `verification`, `discussion`, `poll`, `undeclared`. :param use_inbound_webhook_on_number: A boolean value that indicates either the webhook url configured on the phone number will be used or `inbound_request_url`/`fallback_url` url will be called when a message is received from the phone number. If this field is enabled then the webhook url defined on the phone number will override the `inbound_request_url`/`fallback_url` defined for the Messaging Service. @@ -746,7 +746,7 @@ def create( :param scan_message_content: :param fallback_to_long_code: [OBSOLETE] Former feature used to fallback to long code sender after certain short code message failures. :param area_code_geomatch: Whether to enable [Area Code Geomatch](https://www.twilio.com/docs/messaging/services#area-code-geomatch) on the Service Instance. - :param validity_period: How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `14,400`. + :param validity_period: How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `14,400`. Default value is `14,400`. :param synchronous_validation: Reserved. :param usecase: A string that describes the scenario in which the Messaging Service will be used. Possible values are `notifications`, `marketing`, `verification`, `discussion`, `poll`, `undeclared`. :param use_inbound_webhook_on_number: A boolean value that indicates either the webhook url configured on the phone number will be used or `inbound_request_url`/`fallback_url` url will be called when a message is received from the phone number. If this field is enabled then the webhook url defined on the phone number will override the `inbound_request_url`/`fallback_url` defined for the Messaging Service. @@ -828,7 +828,7 @@ async def create_async( :param scan_message_content: :param fallback_to_long_code: [OBSOLETE] Former feature used to fallback to long code sender after certain short code message failures. :param area_code_geomatch: Whether to enable [Area Code Geomatch](https://www.twilio.com/docs/messaging/services#area-code-geomatch) on the Service Instance. - :param validity_period: How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `14,400`. + :param validity_period: How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `14,400`. Default value is `14,400`. :param synchronous_validation: Reserved. :param usecase: A string that describes the scenario in which the Messaging Service will be used. Possible values are `notifications`, `marketing`, `verification`, `discussion`, `poll`, `undeclared`. :param use_inbound_webhook_on_number: A boolean value that indicates either the webhook url configured on the phone number will be used or `inbound_request_url`/`fallback_url` url will be called when a message is received from the phone number. If this field is enabled then the webhook url defined on the phone number will override the `inbound_request_url`/`fallback_url` defined for the Messaging Service. diff --git a/twilio/rest/numbers/v1/__init__.py b/twilio/rest/numbers/v1/__init__.py index 043364c3d5..68f078a88d 100644 --- a/twilio/rest/numbers/v1/__init__.py +++ b/twilio/rest/numbers/v1/__init__.py @@ -28,12 +28,10 @@ from twilio.rest.numbers.v1.porting_webhook_configuration_delete import ( PortingWebhookConfigurationDeleteList, ) -from twilio.rest.numbers.v1.porting_webhook_configuration_fetch import ( - PortingWebhookConfigurationFetchList, -) from twilio.rest.numbers.v1.signing_request_configuration import ( SigningRequestConfigurationList, ) +from twilio.rest.numbers.v1.webhook import WebhookList class V1(Version): @@ -58,12 +56,10 @@ def __init__(self, domain: Domain): self._porting_webhook_configurations_delete: Optional[ PortingWebhookConfigurationDeleteList ] = None - self._porting_webhook_configuration_fetch: Optional[ - PortingWebhookConfigurationFetchList - ] = None self._signing_request_configurations: Optional[ SigningRequestConfigurationList ] = None + self._webhook: Optional[WebhookList] = None @property def bulk_eligibilities(self) -> BulkEligibilityList: @@ -111,22 +107,18 @@ def porting_webhook_configurations_delete( ) return self._porting_webhook_configurations_delete - @property - def porting_webhook_configuration_fetch( - self, - ) -> PortingWebhookConfigurationFetchList: - if self._porting_webhook_configuration_fetch is None: - self._porting_webhook_configuration_fetch = ( - PortingWebhookConfigurationFetchList(self) - ) - return self._porting_webhook_configuration_fetch - @property def signing_request_configurations(self) -> SigningRequestConfigurationList: if self._signing_request_configurations is None: self._signing_request_configurations = SigningRequestConfigurationList(self) return self._signing_request_configurations + @property + def webhook(self) -> WebhookList: + if self._webhook is None: + self._webhook = WebhookList(self) + return self._webhook + def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py b/twilio/rest/numbers/v1/webhook.py similarity index 78% rename from twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py rename to twilio/rest/numbers/v1/webhook.py index 5d381768c7..69bd556326 100644 --- a/twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py +++ b/twilio/rest/numbers/v1/webhook.py @@ -21,7 +21,7 @@ from twilio.base.version import Version -class PortingWebhookConfigurationFetchInstance(InstanceResource): +class WebhookInstance(InstanceResource): """ :ivar url: The URL of the webhook configuration request :ivar port_in_target_url: The complete webhook url that will be called when a notification event for port in request or port in phone number happens @@ -52,14 +52,14 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" -class PortingWebhookConfigurationFetchList(ListResource): +class WebhookList(ListResource): def __init__(self, version: Version): """ - Initialize the PortingWebhookConfigurationFetchList + Initialize the WebhookList :param version: Version that contains the resource @@ -68,12 +68,12 @@ def __init__(self, version: Version): self._uri = "/Porting/Configuration/Webhook" - def fetch(self) -> PortingWebhookConfigurationFetchInstance: + def fetch(self) -> WebhookInstance: """ - Asynchronously fetch the PortingWebhookConfigurationFetchInstance + Asynchronously fetch the WebhookInstance - :returns: The fetched PortingWebhookConfigurationFetchInstance + :returns: The fetched WebhookInstance """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -81,14 +81,14 @@ def fetch(self) -> PortingWebhookConfigurationFetchInstance: payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) - return PortingWebhookConfigurationFetchInstance(self._version, payload) + return WebhookInstance(self._version, payload) - async def fetch_async(self) -> PortingWebhookConfigurationFetchInstance: + async def fetch_async(self) -> WebhookInstance: """ - Asynchronously fetch the PortingWebhookConfigurationFetchInstance + Asynchronously fetch the WebhookInstance - :returns: The fetched PortingWebhookConfigurationFetchInstance + :returns: The fetched WebhookInstance """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -98,7 +98,7 @@ async def fetch_async(self) -> PortingWebhookConfigurationFetchInstance: method="GET", uri=self._uri, headers=headers ) - return PortingWebhookConfigurationFetchInstance(self._version, payload) + return WebhookInstance(self._version, payload) def __repr__(self) -> str: """ @@ -106,4 +106,4 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" From 70d50d2805a13c0e78db049bbb84529d6047fa31 Mon Sep 17 00:00:00 2001 From: Twilio Date: Mon, 13 Jan 2025 11:48:38 +0000 Subject: [PATCH 63/87] Release 9.4.3 --- setup.py | 2 +- twilio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 0ab6bc732a..229d8e1ebe 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name="twilio", - version="9.4.2", + version="9.4.3", description="Twilio API client and TwiML generator", author="Twilio", help_center="https://www.twilio.com/help/contact", diff --git a/twilio/__init__.py b/twilio/__init__.py index 145e35680b..8279b4dbd8 100644 --- a/twilio/__init__.py +++ b/twilio/__init__.py @@ -1,2 +1,2 @@ -__version_info__ = ("9", "4", "2") +__version_info__ = ("9", "4", "3") __version__ = ".".join(__version_info__) From 73a1e2b60b616cb17ed91509a82f867ab8555390 Mon Sep 17 00:00:00 2001 From: sbansla <104902068+sbansla@users.noreply.github.com> Date: Thu, 16 Jan 2025 11:59:05 +0530 Subject: [PATCH 64/87] chore: created bug report issue template (#833) --- .github/ISSUE_TEMPLATE/bug_report.yml | 69 +++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000000..6fb5f5e10e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,69 @@ +name: Bug report +description: Report a bug with the twilio-python helper library. +title: "[BUG] Describe the issue briefly" +labels: "type: bug" +body: + - type: markdown + attributes: + value: | + Thank you for reporting a bug in the twilio-python helper library. Please provide the details below to help us investigate and resolve the issue. + + - type: textarea + attributes: + label: Describe the bug + description: Provide a clear and concise description of the issue. + placeholder: A clear and concise description of the bug. + validations: + required: true + + - type: textarea + attributes: + label: Code snippet + description: Provide the code snippet that reproduces the issue. + placeholder: "```\n// Code snippet here\n```" + validations: + required: true + + - type: textarea + attributes: + label: Actual behavior + description: Describe what actually happened. + placeholder: A description of the actual behavior. + validations: + required: true + + - type: textarea + attributes: + label: Expected behavior + description: Describe what you expected to happen. + placeholder: A description of the expected outcome. + validations: + required: true + + - type: input + attributes: + label: twilio-python version + description: Specify the version of the twilio-python helper library you are using. + placeholder: e.g., 9.4.1 + validations: + required: true + + - type: input + attributes: + label: Python version + description: Specify the version of Python you are using. + placeholder: e.g., 3.9.1 + validations: + required: true + + - type: textarea + attributes: + label: Logs or error messages + description: Provide relevant logs or error messages (if any). + placeholder: "Error: Something went wrong..." + + - type: textarea + attributes: + label: Additional context + description: Add any other context about the problem here. + placeholder: Any additional From 513743f122d5d166790df8e7598522a3758f7ee0 Mon Sep 17 00:00:00 2001 From: Shubham Date: Fri, 24 Jan 2025 15:42:03 +0530 Subject: [PATCH 65/87] chore: enable newer versions of aiohttp-retry (#837) --- requirements.txt | 2 +- setup.py | 2 +- tests/unit/http/test_async_http_client.py | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index 3de95e70c9..a29abc4d1e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,5 +2,5 @@ pygments>=2.7.4 # not directly required, pinned by Snyk to avoid a vulnerability requests>=2.31.0 PyJWT>=2.0.0, <3.0.0 aiohttp>=3.9.4 -aiohttp-retry==2.8.3 +aiohttp-retry>=2.8.3 certifi>=2023.7.22 # not directly required, pinned by Snyk to avoid a vulnerability diff --git a/setup.py b/setup.py index 229d8e1ebe..849a9da87f 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,7 @@ "requests >= 2.0.0", "PyJWT >= 2.0.0, < 3.0.0", "aiohttp>=3.8.4", - "aiohttp-retry==2.8.3", + "aiohttp-retry>=2.8.3", ], packages=find_packages(exclude=["tests", "tests.*"]), include_package_data=True, diff --git a/tests/unit/http/test_async_http_client.py b/tests/unit/http/test_async_http_client.py index df43606843..23df35dc02 100644 --- a/tests/unit/http/test_async_http_client.py +++ b/tests/unit/http/test_async_http_client.py @@ -10,10 +10,11 @@ class MockResponse(object): A mock of the aiohttp.ClientResponse class """ - def __init__(self, text, status): + def __init__(self, text, status, method="GET"): self._text = text self.status = status self.headers = {} + self.method = method async def text(self): return self._text From 8e1fdefd45ead10e8b4bde55faa5fe7efbfef229 Mon Sep 17 00:00:00 2001 From: Manisha Singh Date: Tue, 28 Jan 2025 14:15:01 +0530 Subject: [PATCH 66/87] chore: update httpclient (#834) * chore: update httpclient --- tests/unit/http/test_http_client.py | 1 + twilio/http/http_client.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/unit/http/test_http_client.py b/tests/unit/http/test_http_client.py index 8484e57b17..cbd438251a 100644 --- a/tests/unit/http/test_http_client.py +++ b/tests/unit/http/test_http_client.py @@ -293,6 +293,7 @@ def test_session_not_preserved(self): self.assertEqual(response_2.content, "response_2") + class MyVersion(Version): def __init__(self, domain): super().__init__(domain, "v1") diff --git a/twilio/http/http_client.py b/twilio/http/http_client.py index e15be86354..2f2d363535 100644 --- a/twilio/http/http_client.py +++ b/twilio/http/http_client.py @@ -40,7 +40,7 @@ def __init__( self.session = Session() if pool_connections else None if self.session and max_retries is not None: self.session.mount("https://", HTTPAdapter(max_retries=max_retries)) - if self.session is not None: + elif self.session is not None: self.session.mount( "https://", HTTPAdapter(pool_maxsize=min(32, os.cpu_count() + 4)) ) From ab846b4107ef724cefeac351fc5dbce47bcda342 Mon Sep 17 00:00:00 2001 From: twilio-product-security <67294289+twilio-product-security@users.noreply.github.com> Date: Tue, 28 Jan 2025 08:52:43 +0000 Subject: [PATCH 67/87] fix: requirements.txt to reduce vulnerabilities (#822) The following vulnerabilities are fixed by pinning transitive dependencies: - https://snyk.io/vuln/SNYK-PYTHON-AIOHTTP-6091621 - https://snyk.io/vuln/SNYK-PYTHON-AIOHTTP-6091622 - https://snyk.io/vuln/SNYK-PYTHON-AIOHTTP-6209406 - https://snyk.io/vuln/SNYK-PYTHON-AIOHTTP-6209407 - https://snyk.io/vuln/SNYK-PYTHON-AIOHTTP-6645291 - https://snyk.io/vuln/SNYK-PYTHON-AIOHTTP-6808823 - https://snyk.io/vuln/SNYK-PYTHON-AIOHTTP-7675597 - https://snyk.io/vuln/SNYK-PYTHON-REQUESTS-6928867 - https://snyk.io/vuln/SNYK-PYTHON-URLLIB3-7267250 - https://snyk.io/vuln/SNYK-PYTHON-ZIPP-7430899 Co-authored-by: snyk-bot Co-authored-by: Manisha Singh --- requirements.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index a29abc4d1e..7bc9e41806 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,8 @@ pygments>=2.7.4 # not directly required, pinned by Snyk to avoid a vulnerability -requests>=2.31.0 +requests>=2.32.2 PyJWT>=2.0.0, <3.0.0 -aiohttp>=3.9.4 -aiohttp-retry>=2.8.3 +aiohttp>=3.10.2 +aiohttp-retry==2.8.3 certifi>=2023.7.22 # not directly required, pinned by Snyk to avoid a vulnerability +urllib3>=2.2.2 # not directly required, pinned by Snyk to avoid a vulnerability +zipp>=3.19.1 # not directly required, pinned by Snyk to avoid a vulnerability From 338cbb0e216db7be9faddbca0291db45787447c8 Mon Sep 17 00:00:00 2001 From: Twilio Date: Tue, 28 Jan 2025 11:33:46 +0000 Subject: [PATCH 68/87] [Librarian] Regenerated @ a7caf52aaea6fe6c7b30170a468564bcea4f0362 13ec50967b82ae43900a263102daafb96aa61935 --- CHANGES.md | 23 +++++ tests/unit/http/test_http_client.py | 1 - twilio/rest/content/v1/content/__init__.py | 87 +++++++++++++++++++ .../conversations/v1/address_configuration.py | 1 + .../rest/events/v1/subscription/__init__.py | 40 ++++++++- twilio/rest/iam/v1/__init__.py | 12 +-- twilio/rest/iam/v1/{key.py => new_api_key.py} | 30 +++---- .../rest/insights/v1/conference/__init__.py | 1 + twilio/rest/lookups/v2/phone_number.py | 12 +++ twilio/rest/numbers/v1/__init__.py | 24 +++-- ...=> porting_webhook_configuration_fetch.py} | 26 +++--- 11 files changed, 212 insertions(+), 45 deletions(-) rename twilio/rest/iam/v1/{key.py => new_api_key.py} (88%) rename twilio/rest/numbers/v1/{webhook.py => porting_webhook_configuration_fetch.py} (78%) diff --git a/CHANGES.md b/CHANGES.md index 7c0335ea99..3f7e5575aa 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,29 @@ twilio-python Changelog Here you can see the full list of changes between each twilio-python release. +[2025-01-28] Version 9.4.4 +-------------------------- +**Library - Fix** +- [PR #822](https://github.com/twilio/twilio-python/pull/822): Fix for 10 vulnerabilities. Thanks to [@twilio-product-security](https://github.com/twilio-product-security)! + +**Library - Chore** +- [PR #834](https://github.com/twilio/twilio-python/pull/834): update httpclient. Thanks to [@manisha1997](https://github.com/manisha1997)! +- [PR #837](https://github.com/twilio/twilio-python/pull/837): enable newer versions of aiohttp-retry. Thanks to [@tiwarishubham635](https://github.com/tiwarishubham635)! +- [PR #833](https://github.com/twilio/twilio-python/pull/833): created bug report issue template. Thanks to [@sbansla](https://github.com/sbansla)! + +**Api** +- Add open-api file tag to `conference/call recordings` and `recording_transcriptions`. + +**Events** +- Add support for subaccount subscriptions (beta) + +**Insights** +- add new region to conference APIs + +**Lookups** +- Add new `parnter_sub_id` query parameter to the lookup request + + [2025-01-13] Version 9.4.3 -------------------------- **Messaging** diff --git a/tests/unit/http/test_http_client.py b/tests/unit/http/test_http_client.py index cbd438251a..8484e57b17 100644 --- a/tests/unit/http/test_http_client.py +++ b/tests/unit/http/test_http_client.py @@ -293,7 +293,6 @@ def test_session_not_preserved(self): self.assertEqual(response_2.content, "response_2") - class MyVersion(Version): def __init__(self, domain): super().__init__(domain, "v1") diff --git a/twilio/rest/content/v1/content/__init__.py b/twilio/rest/content/v1/content/__init__.py index 60a5b05016..6223e940b3 100644 --- a/twilio/rest/content/v1/content/__init__.py +++ b/twilio/rest/content/v1/content/__init__.py @@ -525,6 +525,26 @@ def to_dict(self): ), } + class TwilioSchedule(object): + """ + :ivar id: + :ivar title: + :ivar time_slots: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.id: Optional[str] = payload.get("id") + self.title: Optional[str] = payload.get("title") + self.time_slots: Optional[str] = payload.get("time_slots") + + def to_dict(self): + return { + "id": self.id, + "title": self.title, + "time_slots": self.time_slots, + } + class TwilioText(object): """ :ivar body: @@ -551,6 +571,7 @@ class Types(object): :ivar twilio_catalog: :ivar twilio_carousel: :ivar twilio_flows: + :ivar twilio_schedule: :ivar whatsapp_card: :ivar whatsapp_authentication: """ @@ -587,6 +608,9 @@ def __init__(self, payload: Dict[str, Any]): self.twilio_flows: Optional[ContentList.TwilioFlows] = payload.get( "twilio_flows" ) + self.twilio_schedule: Optional[ContentList.TwilioSchedule] = payload.get( + "twilio_schedule" + ) self.whatsapp_card: Optional[ContentList.WhatsappCard] = payload.get( "whatsapp_card" ) @@ -642,6 +666,11 @@ def to_dict(self): if self.twilio_flows is not None else None ), + "twilio_schedule": ( + self.twilio_schedule.to_dict() + if self.twilio_schedule is not None + else None + ), "whatsapp_card": ( self.whatsapp_card.to_dict() if self.whatsapp_card is not None @@ -1355,6 +1384,26 @@ def to_dict(self): ), } + class TwilioSchedule(object): + """ + :ivar id: + :ivar title: + :ivar time_slots: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.id: Optional[str] = payload.get("id") + self.title: Optional[str] = payload.get("title") + self.time_slots: Optional[str] = payload.get("time_slots") + + def to_dict(self): + return { + "id": self.id, + "title": self.title, + "time_slots": self.time_slots, + } + class TwilioText(object): """ :ivar body: @@ -1381,6 +1430,7 @@ class Types(object): :ivar twilio_catalog: :ivar twilio_carousel: :ivar twilio_flows: + :ivar twilio_schedule: :ivar whatsapp_card: :ivar whatsapp_authentication: """ @@ -1417,6 +1467,9 @@ def __init__(self, payload: Dict[str, Any]): self.twilio_flows: Optional[ContentList.TwilioFlows] = payload.get( "twilio_flows" ) + self.twilio_schedule: Optional[ContentList.TwilioSchedule] = payload.get( + "twilio_schedule" + ) self.whatsapp_card: Optional[ContentList.WhatsappCard] = payload.get( "whatsapp_card" ) @@ -1472,6 +1525,11 @@ def to_dict(self): if self.twilio_flows is not None else None ), + "twilio_schedule": ( + self.twilio_schedule.to_dict() + if self.twilio_schedule is not None + else None + ), "whatsapp_card": ( self.whatsapp_card.to_dict() if self.whatsapp_card is not None @@ -2186,6 +2244,26 @@ def to_dict(self): ), } + class TwilioSchedule(object): + """ + :ivar id: + :ivar title: + :ivar time_slots: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.id: Optional[str] = payload.get("id") + self.title: Optional[str] = payload.get("title") + self.time_slots: Optional[str] = payload.get("time_slots") + + def to_dict(self): + return { + "id": self.id, + "title": self.title, + "time_slots": self.time_slots, + } + class TwilioText(object): """ :ivar body: @@ -2212,6 +2290,7 @@ class Types(object): :ivar twilio_catalog: :ivar twilio_carousel: :ivar twilio_flows: + :ivar twilio_schedule: :ivar whatsapp_card: :ivar whatsapp_authentication: """ @@ -2248,6 +2327,9 @@ def __init__(self, payload: Dict[str, Any]): self.twilio_flows: Optional[ContentList.TwilioFlows] = payload.get( "twilio_flows" ) + self.twilio_schedule: Optional[ContentList.TwilioSchedule] = payload.get( + "twilio_schedule" + ) self.whatsapp_card: Optional[ContentList.WhatsappCard] = payload.get( "whatsapp_card" ) @@ -2303,6 +2385,11 @@ def to_dict(self): if self.twilio_flows is not None else None ), + "twilio_schedule": ( + self.twilio_schedule.to_dict() + if self.twilio_schedule is not None + else None + ), "whatsapp_card": ( self.whatsapp_card.to_dict() if self.whatsapp_card is not None diff --git a/twilio/rest/conversations/v1/address_configuration.py b/twilio/rest/conversations/v1/address_configuration.py index 4ebfa47fc2..1609d99576 100644 --- a/twilio/rest/conversations/v1/address_configuration.py +++ b/twilio/rest/conversations/v1/address_configuration.py @@ -40,6 +40,7 @@ class Type(object): GBM = "gbm" EMAIL = "email" RCS = "rcs" + APPLE = "apple" """ :ivar sid: A 34 character string that uniquely identifies this resource. diff --git a/twilio/rest/events/v1/subscription/__init__.py b/twilio/rest/events/v1/subscription/__init__.py index 872c9ed7d0..e77cf10b51 100644 --- a/twilio/rest/events/v1/subscription/__init__.py +++ b/twilio/rest/events/v1/subscription/__init__.py @@ -33,6 +33,7 @@ class SubscriptionInstance(InstanceResource): :ivar sink_sid: The SID of the sink that events selected by this subscription should be sent to. Sink must be active for the subscription to be created. :ivar url: The URL of this resource. :ivar links: Contains a dictionary of URL links to nested resources of this Subscription. + :ivar receive_events_from_subaccounts: Receive events from all children accounts in the parent account subscription. """ def __init__( @@ -52,6 +53,9 @@ def __init__( self.sink_sid: Optional[str] = payload.get("sink_sid") self.url: Optional[str] = payload.get("url") self.links: Optional[Dict[str, object]] = payload.get("links") + self.receive_events_from_subaccounts: Optional[bool] = payload.get( + "receive_events_from_subaccounts" + ) self._solution = { "sid": sid or self.sid, @@ -113,36 +117,42 @@ def update( self, description: Union[str, object] = values.unset, sink_sid: Union[str, object] = values.unset, + receive_events_from_subaccounts: Union[bool, object] = values.unset, ) -> "SubscriptionInstance": """ Update the SubscriptionInstance :param description: A human readable description for the Subscription. :param sink_sid: The SID of the sink that events selected by this subscription should be sent to. Sink must be active for the subscription to be created. + :param receive_events_from_subaccounts: Receive events from all children accounts in the parent account subscription. :returns: The updated SubscriptionInstance """ return self._proxy.update( description=description, sink_sid=sink_sid, + receive_events_from_subaccounts=receive_events_from_subaccounts, ) async def update_async( self, description: Union[str, object] = values.unset, sink_sid: Union[str, object] = values.unset, + receive_events_from_subaccounts: Union[bool, object] = values.unset, ) -> "SubscriptionInstance": """ Asynchronous coroutine to update the SubscriptionInstance :param description: A human readable description for the Subscription. :param sink_sid: The SID of the sink that events selected by this subscription should be sent to. Sink must be active for the subscription to be created. + :param receive_events_from_subaccounts: Receive events from all children accounts in the parent account subscription. :returns: The updated SubscriptionInstance """ return await self._proxy.update_async( description=description, sink_sid=sink_sid, + receive_events_from_subaccounts=receive_events_from_subaccounts, ) @property @@ -253,12 +263,14 @@ def update( self, description: Union[str, object] = values.unset, sink_sid: Union[str, object] = values.unset, + receive_events_from_subaccounts: Union[bool, object] = values.unset, ) -> SubscriptionInstance: """ Update the SubscriptionInstance :param description: A human readable description for the Subscription. :param sink_sid: The SID of the sink that events selected by this subscription should be sent to. Sink must be active for the subscription to be created. + :param receive_events_from_subaccounts: Receive events from all children accounts in the parent account subscription. :returns: The updated SubscriptionInstance """ @@ -267,6 +279,9 @@ def update( { "Description": description, "SinkSid": sink_sid, + "ReceiveEventsFromSubaccounts": serialize.boolean_to_string( + receive_events_from_subaccounts + ), } ) headers = values.of({}) @@ -285,12 +300,14 @@ async def update_async( self, description: Union[str, object] = values.unset, sink_sid: Union[str, object] = values.unset, + receive_events_from_subaccounts: Union[bool, object] = values.unset, ) -> SubscriptionInstance: """ Asynchronous coroutine to update the SubscriptionInstance :param description: A human readable description for the Subscription. :param sink_sid: The SID of the sink that events selected by this subscription should be sent to. Sink must be active for the subscription to be created. + :param receive_events_from_subaccounts: Receive events from all children accounts in the parent account subscription. :returns: The updated SubscriptionInstance """ @@ -299,6 +316,9 @@ async def update_async( { "Description": description, "SinkSid": sink_sid, + "ReceiveEventsFromSubaccounts": serialize.boolean_to_string( + receive_events_from_subaccounts + ), } ) headers = values.of({}) @@ -368,7 +388,11 @@ def __init__(self, version: Version): self._uri = "/Subscriptions" def create( - self, description: str, sink_sid: str, types: List[object] + self, + description: str, + sink_sid: str, + types: List[object], + receive_events_from_subaccounts: Union[bool, object] = values.unset, ) -> SubscriptionInstance: """ Create the SubscriptionInstance @@ -376,6 +400,7 @@ def create( :param description: A human readable description for the Subscription **This value should not contain PII.** :param sink_sid: The SID of the sink that events selected by this subscription should be sent to. Sink must be active for the subscription to be created. :param types: An array of objects containing the subscribed Event Types + :param receive_events_from_subaccounts: Receive events from all children accounts in the parent account subscription. :returns: The created SubscriptionInstance """ @@ -385,6 +410,9 @@ def create( "Description": description, "SinkSid": sink_sid, "Types": serialize.map(types, lambda e: serialize.object(e)), + "ReceiveEventsFromSubaccounts": serialize.boolean_to_string( + receive_events_from_subaccounts + ), } ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -400,7 +428,11 @@ def create( return SubscriptionInstance(self._version, payload) async def create_async( - self, description: str, sink_sid: str, types: List[object] + self, + description: str, + sink_sid: str, + types: List[object], + receive_events_from_subaccounts: Union[bool, object] = values.unset, ) -> SubscriptionInstance: """ Asynchronously create the SubscriptionInstance @@ -408,6 +440,7 @@ async def create_async( :param description: A human readable description for the Subscription **This value should not contain PII.** :param sink_sid: The SID of the sink that events selected by this subscription should be sent to. Sink must be active for the subscription to be created. :param types: An array of objects containing the subscribed Event Types + :param receive_events_from_subaccounts: Receive events from all children accounts in the parent account subscription. :returns: The created SubscriptionInstance """ @@ -417,6 +450,9 @@ async def create_async( "Description": description, "SinkSid": sink_sid, "Types": serialize.map(types, lambda e: serialize.object(e)), + "ReceiveEventsFromSubaccounts": serialize.boolean_to_string( + receive_events_from_subaccounts + ), } ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) diff --git a/twilio/rest/iam/v1/__init__.py b/twilio/rest/iam/v1/__init__.py index 408de11acb..0c46947341 100644 --- a/twilio/rest/iam/v1/__init__.py +++ b/twilio/rest/iam/v1/__init__.py @@ -17,7 +17,7 @@ from twilio.base.domain import Domain from twilio.rest.iam.v1.api_key import ApiKeyList from twilio.rest.iam.v1.get_api_keys import GetApiKeysList -from twilio.rest.iam.v1.key import KeyList +from twilio.rest.iam.v1.new_api_key import NewApiKeyList class V1(Version): @@ -31,7 +31,7 @@ def __init__(self, domain: Domain): super().__init__(domain, "v1") self._api_key: Optional[ApiKeyList] = None self._get_api_keys: Optional[GetApiKeysList] = None - self._keys: Optional[KeyList] = None + self._new_api_key: Optional[NewApiKeyList] = None @property def api_key(self) -> ApiKeyList: @@ -46,10 +46,10 @@ def get_api_keys(self) -> GetApiKeysList: return self._get_api_keys @property - def keys(self) -> KeyList: - if self._keys is None: - self._keys = KeyList(self) - return self._keys + def new_api_key(self) -> NewApiKeyList: + if self._new_api_key is None: + self._new_api_key = NewApiKeyList(self) + return self._new_api_key def __repr__(self) -> str: """ diff --git a/twilio/rest/iam/v1/key.py b/twilio/rest/iam/v1/new_api_key.py similarity index 88% rename from twilio/rest/iam/v1/key.py rename to twilio/rest/iam/v1/new_api_key.py index cd5556df94..760ce79ca3 100644 --- a/twilio/rest/iam/v1/key.py +++ b/twilio/rest/iam/v1/new_api_key.py @@ -21,7 +21,7 @@ from twilio.base.version import Version -class KeyInstance(InstanceResource): +class NewApiKeyInstance(InstanceResource): class Keytype(object): RESTRICTED = "restricted" @@ -56,14 +56,14 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" -class KeyList(ListResource): +class NewApiKeyList(ListResource): def __init__(self, version: Version): """ - Initialize the KeyList + Initialize the NewApiKeyList :param version: Version that contains the resource @@ -76,18 +76,18 @@ def create( self, account_sid: str, friendly_name: Union[str, object] = values.unset, - key_type: Union["KeyInstance.Keytype", object] = values.unset, + key_type: Union["NewApiKeyInstance.Keytype", object] = values.unset, policy: Union[object, object] = values.unset, - ) -> KeyInstance: + ) -> NewApiKeyInstance: """ - Create the KeyInstance + Create the NewApiKeyInstance :param account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Payments resource. :param friendly_name: A descriptive string that you create to describe the resource. It can be up to 64 characters long. :param key_type: :param policy: The \\\\`Policy\\\\` object is a collection that specifies the allowed Twilio permissions for the restricted key. For more information on the permissions available with restricted API keys, refer to the [Twilio documentation](https://www.twilio.com/docs/iam/api-keys/restricted-api-keys#permissions-available-with-restricted-api-keys). - :returns: The created KeyInstance + :returns: The created NewApiKeyInstance """ data = values.of( @@ -108,24 +108,24 @@ def create( method="POST", uri=self._uri, data=data, headers=headers ) - return KeyInstance(self._version, payload) + return NewApiKeyInstance(self._version, payload) async def create_async( self, account_sid: str, friendly_name: Union[str, object] = values.unset, - key_type: Union["KeyInstance.Keytype", object] = values.unset, + key_type: Union["NewApiKeyInstance.Keytype", object] = values.unset, policy: Union[object, object] = values.unset, - ) -> KeyInstance: + ) -> NewApiKeyInstance: """ - Asynchronously create the KeyInstance + Asynchronously create the NewApiKeyInstance :param account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Payments resource. :param friendly_name: A descriptive string that you create to describe the resource. It can be up to 64 characters long. :param key_type: :param policy: The \\\\`Policy\\\\` object is a collection that specifies the allowed Twilio permissions for the restricted key. For more information on the permissions available with restricted API keys, refer to the [Twilio documentation](https://www.twilio.com/docs/iam/api-keys/restricted-api-keys#permissions-available-with-restricted-api-keys). - :returns: The created KeyInstance + :returns: The created NewApiKeyInstance """ data = values.of( @@ -146,7 +146,7 @@ async def create_async( method="POST", uri=self._uri, data=data, headers=headers ) - return KeyInstance(self._version, payload) + return NewApiKeyInstance(self._version, payload) def __repr__(self) -> str: """ @@ -154,4 +154,4 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" diff --git a/twilio/rest/insights/v1/conference/__init__.py b/twilio/rest/insights/v1/conference/__init__.py index 0f9bb118b5..a30de54cd7 100644 --- a/twilio/rest/insights/v1/conference/__init__.py +++ b/twilio/rest/insights/v1/conference/__init__.py @@ -51,6 +51,7 @@ class ProcessingState(object): class Region(object): US1 = "us1" + US2 = "us2" AU1 = "au1" BR1 = "br1" IE1 = "ie1" diff --git a/twilio/rest/lookups/v2/phone_number.py b/twilio/rest/lookups/v2/phone_number.py index ac1b3257ef..fc60eed6d3 100644 --- a/twilio/rest/lookups/v2/phone_number.py +++ b/twilio/rest/lookups/v2/phone_number.py @@ -124,6 +124,7 @@ def fetch( date_of_birth: Union[str, object] = values.unset, last_verified_date: Union[str, object] = values.unset, verification_sid: Union[str, object] = values.unset, + partner_sub_id: Union[str, object] = values.unset, ) -> "PhoneNumberInstance": """ Fetch the PhoneNumberInstance @@ -142,6 +143,7 @@ def fetch( :param date_of_birth: User’s date of birth, in YYYYMMDD format. This query parameter is only used (optionally) for identity_match package requests. :param last_verified_date: The date you obtained consent to call or text the end-user of the phone number or a date on which you are reasonably certain that the end-user could still be reached at that number. This query parameter is only used (optionally) for reassigned_number package requests. :param verification_sid: The unique identifier associated with a verification process through verify API. This query parameter is only used (optionally) for pre_fill package requests. + :param partner_sub_id: The optional partnerSubId parameter to provide context for your sub-accounts, tenantIDs, sender IDs or other segmentation, enhancing the accuracy of the risk analysis. :returns: The fetched PhoneNumberInstance """ @@ -160,6 +162,7 @@ def fetch( date_of_birth=date_of_birth, last_verified_date=last_verified_date, verification_sid=verification_sid, + partner_sub_id=partner_sub_id, ) async def fetch_async( @@ -178,6 +181,7 @@ async def fetch_async( date_of_birth: Union[str, object] = values.unset, last_verified_date: Union[str, object] = values.unset, verification_sid: Union[str, object] = values.unset, + partner_sub_id: Union[str, object] = values.unset, ) -> "PhoneNumberInstance": """ Asynchronous coroutine to fetch the PhoneNumberInstance @@ -196,6 +200,7 @@ async def fetch_async( :param date_of_birth: User’s date of birth, in YYYYMMDD format. This query parameter is only used (optionally) for identity_match package requests. :param last_verified_date: The date you obtained consent to call or text the end-user of the phone number or a date on which you are reasonably certain that the end-user could still be reached at that number. This query parameter is only used (optionally) for reassigned_number package requests. :param verification_sid: The unique identifier associated with a verification process through verify API. This query parameter is only used (optionally) for pre_fill package requests. + :param partner_sub_id: The optional partnerSubId parameter to provide context for your sub-accounts, tenantIDs, sender IDs or other segmentation, enhancing the accuracy of the risk analysis. :returns: The fetched PhoneNumberInstance """ @@ -214,6 +219,7 @@ async def fetch_async( date_of_birth=date_of_birth, last_verified_date=last_verified_date, verification_sid=verification_sid, + partner_sub_id=partner_sub_id, ) def __repr__(self) -> str: @@ -259,6 +265,7 @@ def fetch( date_of_birth: Union[str, object] = values.unset, last_verified_date: Union[str, object] = values.unset, verification_sid: Union[str, object] = values.unset, + partner_sub_id: Union[str, object] = values.unset, ) -> PhoneNumberInstance: """ Fetch the PhoneNumberInstance @@ -277,6 +284,7 @@ def fetch( :param date_of_birth: User’s date of birth, in YYYYMMDD format. This query parameter is only used (optionally) for identity_match package requests. :param last_verified_date: The date you obtained consent to call or text the end-user of the phone number or a date on which you are reasonably certain that the end-user could still be reached at that number. This query parameter is only used (optionally) for reassigned_number package requests. :param verification_sid: The unique identifier associated with a verification process through verify API. This query parameter is only used (optionally) for pre_fill package requests. + :param partner_sub_id: The optional partnerSubId parameter to provide context for your sub-accounts, tenantIDs, sender IDs or other segmentation, enhancing the accuracy of the risk analysis. :returns: The fetched PhoneNumberInstance """ @@ -297,6 +305,7 @@ def fetch( "DateOfBirth": date_of_birth, "LastVerifiedDate": last_verified_date, "VerificationSid": verification_sid, + "PartnerSubId": partner_sub_id, } ) @@ -330,6 +339,7 @@ async def fetch_async( date_of_birth: Union[str, object] = values.unset, last_verified_date: Union[str, object] = values.unset, verification_sid: Union[str, object] = values.unset, + partner_sub_id: Union[str, object] = values.unset, ) -> PhoneNumberInstance: """ Asynchronous coroutine to fetch the PhoneNumberInstance @@ -348,6 +358,7 @@ async def fetch_async( :param date_of_birth: User’s date of birth, in YYYYMMDD format. This query parameter is only used (optionally) for identity_match package requests. :param last_verified_date: The date you obtained consent to call or text the end-user of the phone number or a date on which you are reasonably certain that the end-user could still be reached at that number. This query parameter is only used (optionally) for reassigned_number package requests. :param verification_sid: The unique identifier associated with a verification process through verify API. This query parameter is only used (optionally) for pre_fill package requests. + :param partner_sub_id: The optional partnerSubId parameter to provide context for your sub-accounts, tenantIDs, sender IDs or other segmentation, enhancing the accuracy of the risk analysis. :returns: The fetched PhoneNumberInstance """ @@ -368,6 +379,7 @@ async def fetch_async( "DateOfBirth": date_of_birth, "LastVerifiedDate": last_verified_date, "VerificationSid": verification_sid, + "PartnerSubId": partner_sub_id, } ) diff --git a/twilio/rest/numbers/v1/__init__.py b/twilio/rest/numbers/v1/__init__.py index 68f078a88d..043364c3d5 100644 --- a/twilio/rest/numbers/v1/__init__.py +++ b/twilio/rest/numbers/v1/__init__.py @@ -28,10 +28,12 @@ from twilio.rest.numbers.v1.porting_webhook_configuration_delete import ( PortingWebhookConfigurationDeleteList, ) +from twilio.rest.numbers.v1.porting_webhook_configuration_fetch import ( + PortingWebhookConfigurationFetchList, +) from twilio.rest.numbers.v1.signing_request_configuration import ( SigningRequestConfigurationList, ) -from twilio.rest.numbers.v1.webhook import WebhookList class V1(Version): @@ -56,10 +58,12 @@ def __init__(self, domain: Domain): self._porting_webhook_configurations_delete: Optional[ PortingWebhookConfigurationDeleteList ] = None + self._porting_webhook_configuration_fetch: Optional[ + PortingWebhookConfigurationFetchList + ] = None self._signing_request_configurations: Optional[ SigningRequestConfigurationList ] = None - self._webhook: Optional[WebhookList] = None @property def bulk_eligibilities(self) -> BulkEligibilityList: @@ -107,18 +111,22 @@ def porting_webhook_configurations_delete( ) return self._porting_webhook_configurations_delete + @property + def porting_webhook_configuration_fetch( + self, + ) -> PortingWebhookConfigurationFetchList: + if self._porting_webhook_configuration_fetch is None: + self._porting_webhook_configuration_fetch = ( + PortingWebhookConfigurationFetchList(self) + ) + return self._porting_webhook_configuration_fetch + @property def signing_request_configurations(self) -> SigningRequestConfigurationList: if self._signing_request_configurations is None: self._signing_request_configurations = SigningRequestConfigurationList(self) return self._signing_request_configurations - @property - def webhook(self) -> WebhookList: - if self._webhook is None: - self._webhook = WebhookList(self) - return self._webhook - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/numbers/v1/webhook.py b/twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py similarity index 78% rename from twilio/rest/numbers/v1/webhook.py rename to twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py index 69bd556326..5d381768c7 100644 --- a/twilio/rest/numbers/v1/webhook.py +++ b/twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py @@ -21,7 +21,7 @@ from twilio.base.version import Version -class WebhookInstance(InstanceResource): +class PortingWebhookConfigurationFetchInstance(InstanceResource): """ :ivar url: The URL of the webhook configuration request :ivar port_in_target_url: The complete webhook url that will be called when a notification event for port in request or port in phone number happens @@ -52,14 +52,14 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" -class WebhookList(ListResource): +class PortingWebhookConfigurationFetchList(ListResource): def __init__(self, version: Version): """ - Initialize the WebhookList + Initialize the PortingWebhookConfigurationFetchList :param version: Version that contains the resource @@ -68,12 +68,12 @@ def __init__(self, version: Version): self._uri = "/Porting/Configuration/Webhook" - def fetch(self) -> WebhookInstance: + def fetch(self) -> PortingWebhookConfigurationFetchInstance: """ - Asynchronously fetch the WebhookInstance + Asynchronously fetch the PortingWebhookConfigurationFetchInstance - :returns: The fetched WebhookInstance + :returns: The fetched PortingWebhookConfigurationFetchInstance """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -81,14 +81,14 @@ def fetch(self) -> WebhookInstance: payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) - return WebhookInstance(self._version, payload) + return PortingWebhookConfigurationFetchInstance(self._version, payload) - async def fetch_async(self) -> WebhookInstance: + async def fetch_async(self) -> PortingWebhookConfigurationFetchInstance: """ - Asynchronously fetch the WebhookInstance + Asynchronously fetch the PortingWebhookConfigurationFetchInstance - :returns: The fetched WebhookInstance + :returns: The fetched PortingWebhookConfigurationFetchInstance """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -98,7 +98,7 @@ async def fetch_async(self) -> WebhookInstance: method="GET", uri=self._uri, headers=headers ) - return WebhookInstance(self._version, payload) + return PortingWebhookConfigurationFetchInstance(self._version, payload) def __repr__(self) -> str: """ @@ -106,4 +106,4 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" From ffc0aa1eb38214c913491750577352cc730f10d7 Mon Sep 17 00:00:00 2001 From: Twilio Date: Tue, 28 Jan 2025 11:38:15 +0000 Subject: [PATCH 69/87] Release 9.4.4 --- setup.py | 2 +- twilio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 849a9da87f..f49018cffb 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name="twilio", - version="9.4.3", + version="9.4.4", description="Twilio API client and TwiML generator", author="Twilio", help_center="https://www.twilio.com/help/contact", diff --git a/twilio/__init__.py b/twilio/__init__.py index 8279b4dbd8..766475c133 100644 --- a/twilio/__init__.py +++ b/twilio/__init__.py @@ -1,2 +1,2 @@ -__version_info__ = ("9", "4", "3") +__version_info__ = ("9", "4", "4") __version__ = ".".join(__version_info__) From d120aff177ecd1eb6220041bd314b78a8bad0d34 Mon Sep 17 00:00:00 2001 From: Twilio Date: Tue, 11 Feb 2025 11:12:19 +0000 Subject: [PATCH 70/87] [Librarian] Regenerated @ 6b85410bb6ecf3aa579d1fa442c7bb74c62cf6f0 ae4a12dded508a988aeaca39721be27984e9aeeb --- CHANGES.md | 15 + .../api/v2010/account/address/__init__.py | 8 +- .../v2/transcript/operator_result.py | 4 + twilio/rest/messaging/v1/service/__init__.py | 23 + .../v1/service/destination_alpha_sender.py | 554 ++++++++++++++++++ 5 files changed, 600 insertions(+), 4 deletions(-) create mode 100644 twilio/rest/messaging/v1/service/destination_alpha_sender.py diff --git a/CHANGES.md b/CHANGES.md index 3f7e5575aa..42fb1a3d15 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,21 @@ twilio-python Changelog Here you can see the full list of changes between each twilio-python release. +[2025-02-11] Version 9.4.5 +-------------------------- +**Api** +- Change downstream url and change media type for file `base/api/v2010/validation_request.json`. + +**Intelligence** +- Add json_results for Generative JSON operator results + +**Messaging** +- Add DestinationAlphaSender API to support Country-Specific Alpha Senders + +**Video** +- Change codec type from enum to case-insensitive enum in recording and room_recording apis + + [2025-01-28] Version 9.4.4 -------------------------- **Library - Fix** diff --git a/twilio/rest/api/v2010/account/address/__init__.py b/twilio/rest/api/v2010/account/address/__init__.py index b97628fe87..38a5a231a8 100644 --- a/twilio/rest/api/v2010/account/address/__init__.py +++ b/twilio/rest/api/v2010/account/address/__init__.py @@ -148,7 +148,7 @@ def update( """ Update the AddressInstance - :param friendly_name: A descriptive string that you create to describe the address. It can be up to 64 characters long. + :param friendly_name: A descriptive string that you create to describe the new address. It can be up to 64 characters long for Regulatory Compliance addresses and 32 characters long for Emergency addresses. :param customer_name: The name to associate with the address. :param street: The number and street address of the address. :param city: The city of the address. @@ -187,7 +187,7 @@ async def update_async( """ Asynchronous coroutine to update the AddressInstance - :param friendly_name: A descriptive string that you create to describe the address. It can be up to 64 characters long. + :param friendly_name: A descriptive string that you create to describe the new address. It can be up to 64 characters long for Regulatory Compliance addresses and 32 characters long for Emergency addresses. :param customer_name: The name to associate with the address. :param street: The number and street address of the address. :param city: The city of the address. @@ -336,7 +336,7 @@ def update( """ Update the AddressInstance - :param friendly_name: A descriptive string that you create to describe the address. It can be up to 64 characters long. + :param friendly_name: A descriptive string that you create to describe the new address. It can be up to 64 characters long for Regulatory Compliance addresses and 32 characters long for Emergency addresses. :param customer_name: The name to associate with the address. :param street: The number and street address of the address. :param city: The city of the address. @@ -394,7 +394,7 @@ async def update_async( """ Asynchronous coroutine to update the AddressInstance - :param friendly_name: A descriptive string that you create to describe the address. It can be up to 64 characters long. + :param friendly_name: A descriptive string that you create to describe the new address. It can be up to 64 characters long for Regulatory Compliance addresses and 32 characters long for Emergency addresses. :param customer_name: The name to associate with the address. :param street: The number and street address of the address. :param city: The city of the address. diff --git a/twilio/rest/intelligence/v2/transcript/operator_result.py b/twilio/rest/intelligence/v2/transcript/operator_result.py index 4b607b39e8..9ba2c57f62 100644 --- a/twilio/rest/intelligence/v2/transcript/operator_result.py +++ b/twilio/rest/intelligence/v2/transcript/operator_result.py @@ -29,6 +29,8 @@ class OperatorType(object): EXTRACT = "extract" EXTRACT_NORMALIZE = "extract_normalize" PII_EXTRACT = "pii_extract" + TEXT_GENERATION = "text_generation" + JSON = "json" """ :ivar operator_type: @@ -44,6 +46,7 @@ class OperatorType(object): :ivar label_probabilities: The labels probabilities. This might be available on conversation classify model outputs. :ivar extract_results: List of text extraction results. This might be available on classify-extract model outputs. :ivar text_generation_results: Output of a text generation operator for example Conversation Sumamary. + :ivar json_results: :ivar transcript_sid: A 34 character string that uniquely identifies this Transcript. :ivar url: The URL of this resource. """ @@ -84,6 +87,7 @@ def __init__( self.text_generation_results: Optional[Dict[str, object]] = payload.get( "text_generation_results" ) + self.json_results: Optional[Dict[str, object]] = payload.get("json_results") self.transcript_sid: Optional[str] = payload.get("transcript_sid") self.url: Optional[str] = payload.get("url") diff --git a/twilio/rest/messaging/v1/service/__init__.py b/twilio/rest/messaging/v1/service/__init__.py index 2ff3d4e191..06a53c9a20 100644 --- a/twilio/rest/messaging/v1/service/__init__.py +++ b/twilio/rest/messaging/v1/service/__init__.py @@ -22,6 +22,9 @@ from twilio.base.page import Page from twilio.rest.messaging.v1.service.alpha_sender import AlphaSenderList from twilio.rest.messaging.v1.service.channel_sender import ChannelSenderList +from twilio.rest.messaging.v1.service.destination_alpha_sender import ( + DestinationAlphaSenderList, +) from twilio.rest.messaging.v1.service.phone_number import PhoneNumberList from twilio.rest.messaging.v1.service.short_code import ShortCodeList from twilio.rest.messaging.v1.service.us_app_to_person import UsAppToPersonList @@ -302,6 +305,13 @@ def channel_senders(self) -> ChannelSenderList: """ return self._proxy.channel_senders + @property + def destination_alpha_senders(self) -> DestinationAlphaSenderList: + """ + Access the destination_alpha_senders + """ + return self._proxy.destination_alpha_senders + @property def phone_numbers(self) -> PhoneNumberList: """ @@ -359,6 +369,7 @@ def __init__(self, version: Version, sid: str): self._alpha_senders: Optional[AlphaSenderList] = None self._channel_senders: Optional[ChannelSenderList] = None + self._destination_alpha_senders: Optional[DestinationAlphaSenderList] = None self._phone_numbers: Optional[PhoneNumberList] = None self._short_codes: Optional[ShortCodeList] = None self._us_app_to_person: Optional[UsAppToPersonList] = None @@ -620,6 +631,18 @@ def channel_senders(self) -> ChannelSenderList: ) return self._channel_senders + @property + def destination_alpha_senders(self) -> DestinationAlphaSenderList: + """ + Access the destination_alpha_senders + """ + if self._destination_alpha_senders is None: + self._destination_alpha_senders = DestinationAlphaSenderList( + self._version, + self._solution["sid"], + ) + return self._destination_alpha_senders + @property def phone_numbers(self) -> PhoneNumberList: """ diff --git a/twilio/rest/messaging/v1/service/destination_alpha_sender.py b/twilio/rest/messaging/v1/service/destination_alpha_sender.py new file mode 100644 index 0000000000..ffe1700929 --- /dev/null +++ b/twilio/rest/messaging/v1/service/destination_alpha_sender.py @@ -0,0 +1,554 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Messaging + 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 datetime import datetime +from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator +from twilio.base import deserialize, values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version +from twilio.base.page import Page + + +class DestinationAlphaSenderInstance(InstanceResource): + """ + :ivar sid: The unique string that we created to identify the AlphaSender resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the AlphaSender resource. + :ivar service_sid: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the resource is associated with. + :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar alpha_sender: The Alphanumeric Sender ID string. + :ivar capabilities: An array of values that describe whether the number can receive calls or messages. Can be: `SMS`. + :ivar url: The absolute URL of the AlphaSender resource. + :ivar iso_country_code: The Two Character ISO Country Code the Alphanumeric Sender ID will be used for. For Default Alpha Senders that work across countries, this value will be an empty string + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + sid: Optional[str] = None, + ): + super().__init__(version) + + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.alpha_sender: Optional[str] = payload.get("alpha_sender") + self.capabilities: Optional[List[str]] = payload.get("capabilities") + self.url: Optional[str] = payload.get("url") + self.iso_country_code: Optional[str] = payload.get("iso_country_code") + + self._solution = { + "service_sid": service_sid, + "sid": sid or self.sid, + } + self._context: Optional[DestinationAlphaSenderContext] = None + + @property + def _proxy(self) -> "DestinationAlphaSenderContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: DestinationAlphaSenderContext for this DestinationAlphaSenderInstance + """ + if self._context is None: + self._context = DestinationAlphaSenderContext( + self._version, + service_sid=self._solution["service_sid"], + sid=self._solution["sid"], + ) + return self._context + + def delete(self) -> bool: + """ + Deletes the DestinationAlphaSenderInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the DestinationAlphaSenderInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def fetch(self) -> "DestinationAlphaSenderInstance": + """ + Fetch the DestinationAlphaSenderInstance + + + :returns: The fetched DestinationAlphaSenderInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "DestinationAlphaSenderInstance": + """ + Asynchronous coroutine to fetch the DestinationAlphaSenderInstance + + + :returns: The fetched DestinationAlphaSenderInstance + """ + return await self._proxy.fetch_async() + + 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 DestinationAlphaSenderContext(InstanceContext): + + def __init__(self, version: Version, service_sid: str, sid: str): + """ + Initialize the DestinationAlphaSenderContext + + :param version: Version that contains the resource + :param service_sid: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) to fetch the resource from. + :param sid: The SID of the AlphaSender resource to fetch. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "service_sid": service_sid, + "sid": sid, + } + self._uri = "/Services/{service_sid}/DestinationAlphaSenders/{sid}".format( + **self._solution + ) + + def delete(self) -> bool: + """ + Deletes the DestinationAlphaSenderInstance + + + :returns: True if delete succeeds, False otherwise + """ + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the DestinationAlphaSenderInstance + + + :returns: True if delete succeeds, False otherwise + """ + + headers = values.of({}) + + return await self._version.delete_async( + method="DELETE", uri=self._uri, headers=headers + ) + + def fetch(self) -> DestinationAlphaSenderInstance: + """ + Fetch the DestinationAlphaSenderInstance + + + :returns: The fetched DestinationAlphaSenderInstance + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) + + return DestinationAlphaSenderInstance( + self._version, + payload, + service_sid=self._solution["service_sid"], + sid=self._solution["sid"], + ) + + async def fetch_async(self) -> DestinationAlphaSenderInstance: + """ + Asynchronous coroutine to fetch the DestinationAlphaSenderInstance + + + :returns: The fetched DestinationAlphaSenderInstance + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = await self._version.fetch_async( + method="GET", uri=self._uri, headers=headers + ) + + return DestinationAlphaSenderInstance( + self._version, + payload, + service_sid=self._solution["service_sid"], + sid=self._solution["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 DestinationAlphaSenderPage(Page): + + def get_instance(self, payload: Dict[str, Any]) -> DestinationAlphaSenderInstance: + """ + Build an instance of DestinationAlphaSenderInstance + + :param payload: Payload response from the API + """ + return DestinationAlphaSenderInstance( + self._version, payload, service_sid=self._solution["service_sid"] + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class DestinationAlphaSenderList(ListResource): + + def __init__(self, version: Version, service_sid: str): + """ + Initialize the DestinationAlphaSenderList + + :param version: Version that contains the resource + :param service_sid: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) to read the resources from. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "service_sid": service_sid, + } + self._uri = "/Services/{service_sid}/DestinationAlphaSenders".format( + **self._solution + ) + + def create( + self, alpha_sender: str, iso_country_code: Union[str, object] = values.unset + ) -> DestinationAlphaSenderInstance: + """ + Create the DestinationAlphaSenderInstance + + :param alpha_sender: The Alphanumeric Sender ID string. Can be up to 11 characters long. Valid characters are A-Z, a-z, 0-9, space, hyphen `-`, plus `+`, underscore `_` and ampersand `&`. This value cannot contain only numbers. + :param iso_country_code: The Optional Two Character ISO Country Code the Alphanumeric Sender ID will be used for. If the IsoCountryCode is not provided, a default Alpha Sender will be created that can be used across all countries. + + :returns: The created DestinationAlphaSenderInstance + """ + + data = values.of( + { + "AlphaSender": alpha_sender, + "IsoCountryCode": iso_country_code, + } + ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return DestinationAlphaSenderInstance( + self._version, payload, service_sid=self._solution["service_sid"] + ) + + async def create_async( + self, alpha_sender: str, iso_country_code: Union[str, object] = values.unset + ) -> DestinationAlphaSenderInstance: + """ + Asynchronously create the DestinationAlphaSenderInstance + + :param alpha_sender: The Alphanumeric Sender ID string. Can be up to 11 characters long. Valid characters are A-Z, a-z, 0-9, space, hyphen `-`, plus `+`, underscore `_` and ampersand `&`. This value cannot contain only numbers. + :param iso_country_code: The Optional Two Character ISO Country Code the Alphanumeric Sender ID will be used for. If the IsoCountryCode is not provided, a default Alpha Sender will be created that can be used across all countries. + + :returns: The created DestinationAlphaSenderInstance + """ + + data = values.of( + { + "AlphaSender": alpha_sender, + "IsoCountryCode": iso_country_code, + } + ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return DestinationAlphaSenderInstance( + self._version, payload, service_sid=self._solution["service_sid"] + ) + + def stream( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[DestinationAlphaSenderInstance]: + """ + Streams DestinationAlphaSenderInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = self.page(page_size=limits["page_size"]) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[DestinationAlphaSenderInstance]: + """ + Asynchronously streams DestinationAlphaSenderInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = await self.page_async(page_size=limits["page_size"]) + + return self._version.stream_async(page, limits["limit"]) + + def list( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[DestinationAlphaSenderInstance]: + """ + Lists DestinationAlphaSenderInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return list( + self.stream( + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[DestinationAlphaSenderInstance]: + """ + Asynchronously lists DestinationAlphaSenderInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return [ + record + async for record in await self.stream_async( + limit=limit, + page_size=page_size, + ) + ] + + def page( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> DestinationAlphaSenderPage: + """ + Retrieve a single page of DestinationAlphaSenderInstance records from the API. + Request is executed immediately + + :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 + + :returns: Page of DestinationAlphaSenderInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) + return DestinationAlphaSenderPage(self._version, response, self._solution) + + async def page_async( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> DestinationAlphaSenderPage: + """ + Asynchronously retrieve a single page of DestinationAlphaSenderInstance records from the API. + Request is executed immediately + + :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 + + :returns: Page of DestinationAlphaSenderInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = await self._version.page_async( + method="GET", uri=self._uri, params=data, headers=headers + ) + return DestinationAlphaSenderPage(self._version, response, self._solution) + + def get_page(self, target_url: str) -> DestinationAlphaSenderPage: + """ + Retrieve a specific page of DestinationAlphaSenderInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of DestinationAlphaSenderInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return DestinationAlphaSenderPage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> DestinationAlphaSenderPage: + """ + Asynchronously retrieve a specific page of DestinationAlphaSenderInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of DestinationAlphaSenderInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return DestinationAlphaSenderPage(self._version, response, self._solution) + + def get(self, sid: str) -> DestinationAlphaSenderContext: + """ + Constructs a DestinationAlphaSenderContext + + :param sid: The SID of the AlphaSender resource to fetch. + """ + return DestinationAlphaSenderContext( + self._version, service_sid=self._solution["service_sid"], sid=sid + ) + + def __call__(self, sid: str) -> DestinationAlphaSenderContext: + """ + Constructs a DestinationAlphaSenderContext + + :param sid: The SID of the AlphaSender resource to fetch. + """ + return DestinationAlphaSenderContext( + self._version, service_sid=self._solution["service_sid"], sid=sid + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" From 424a9ba73a34f81bd79f6b50df7742a5c73fd7a8 Mon Sep 17 00:00:00 2001 From: Twilio Date: Tue, 11 Feb 2025 11:17:11 +0000 Subject: [PATCH 71/87] Release 9.4.5 --- setup.py | 2 +- twilio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index f49018cffb..8313a29cfc 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name="twilio", - version="9.4.4", + version="9.4.5", description="Twilio API client and TwiML generator", author="Twilio", help_center="https://www.twilio.com/help/contact", diff --git a/twilio/__init__.py b/twilio/__init__.py index 766475c133..7a2fbba6c7 100644 --- a/twilio/__init__.py +++ b/twilio/__init__.py @@ -1,2 +1,2 @@ -__version_info__ = ("9", "4", "4") +__version_info__ = ("9", "4", "5") __version__ = ".".join(__version_info__) From fb163f4157fff46c6894a10b12e89dfb5c140a37 Mon Sep 17 00:00:00 2001 From: Manisha Singh Date: Wed, 12 Feb 2025 12:46:29 +0530 Subject: [PATCH 72/87] chore: issue 841 (#842) * chore: update README.md * chore: update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bfbd6a14b5..24ece99218 100644 --- a/README.md +++ b/README.md @@ -135,7 +135,9 @@ client = Client() ### Specify Region and/or Edge -To take advantage of Twilio's [Global Infrastructure](https://www.twilio.com/docs/global-infrastructure), specify the target Region and/or Edge for the client: +To take advantage of Twilio's [Global Infrastructure](https://www.twilio.com/docs/global-infrastructure), specify the target Region and Edge for the client: + +> **Note:** When specifying a `region` parameter for a helper library client, be sure to also specify the `edge` parameter. For backward compatibility purposes, specifying a `region` without specifying an `edge` will result in requests being routed to US1. ```python from twilio.rest import Client From 17cbe04fafef7b2a63aa24cd57d1629ca4fa8470 Mon Sep 17 00:00:00 2001 From: Twilio Date: Thu, 20 Feb 2025 14:12:19 +0000 Subject: [PATCH 73/87] [Librarian] Regenerated @ 125dc871b4170bce0faca169f8a588f6ff356a88 0c222649d98edbac6858ea253f9b77fc22386e47 --- CHANGES.md | 15 + .../api/v2010/account/call/transcription.py | 4 +- .../interaction_channel/__init__.py | 24 + .../interaction_transfer.py | 423 ++++++++++++++++++ twilio/rest/iam/v1/__init__.py | 12 +- twilio/rest/iam/v1/{new_api_key.py => key.py} | 30 +- twilio/rest/numbers/v1/__init__.py | 24 +- ...hook_configuration_fetch.py => webhook.py} | 26 +- .../rest/trusthub/v1/supporting_document.py | 12 +- 9 files changed, 512 insertions(+), 58 deletions(-) create mode 100644 twilio/rest/flex_api/v1/interaction/interaction_channel/interaction_transfer.py rename twilio/rest/iam/v1/{new_api_key.py => key.py} (88%) rename twilio/rest/numbers/v1/{porting_webhook_configuration_fetch.py => webhook.py} (78%) diff --git a/CHANGES.md b/CHANGES.md index 42fb1a3d15..c991cee31c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,21 @@ twilio-python Changelog Here you can see the full list of changes between each twilio-python release. +[2025-02-20] Version 9.4.6 +-------------------------- +**Library - Chore** +- [PR #842](https://github.com/twilio/twilio-python/pull/842): issue 841. Thanks to [@manisha1997](https://github.com/manisha1997)! + +**Flex** +- Adding Digital Transfers APIs under v1/Interactions + +**Numbers** +- Convert webhook_type to ienum type in v1/Porting/Configuration/Webhook/{webhook_type} + +**Trusthub** +- Changing TrustHub SupportingDocument status enum from lowercase to uppercase since kyc-orch returns status capitalized and rest proxy requires strict casing + + [2025-02-11] Version 9.4.5 -------------------------- **Api** diff --git a/twilio/rest/api/v2010/account/call/transcription.py b/twilio/rest/api/v2010/account/call/transcription.py index d64a5507b4..50389f3e68 100644 --- a/twilio/rest/api/v2010/account/call/transcription.py +++ b/twilio/rest/api/v2010/account/call/transcription.py @@ -287,7 +287,7 @@ def create( :param speech_model: Recognition model used by the transcription engine, among those supported by the provider :param hints: A Phrase contains words and phrase \\\"hints\\\" so that the speech recognition engine is more likely to recognize them. :param enable_automatic_punctuation: The provider will add punctuation to recognition result - :param intelligence_service: The SID of the [Voice Intelligence Service](https://www.twilio.com/docs/voice/intelligence/api/service-resource) for persisting transcripts and running post-call Language Operators . + :param intelligence_service: The SID or unique name of the [Voice Intelligence Service](https://www.twilio.com/docs/voice/intelligence/api/service-resource) for persisting transcripts and running post-call Language Operators . :returns: The created TranscriptionInstance """ @@ -362,7 +362,7 @@ async def create_async( :param speech_model: Recognition model used by the transcription engine, among those supported by the provider :param hints: A Phrase contains words and phrase \\\"hints\\\" so that the speech recognition engine is more likely to recognize them. :param enable_automatic_punctuation: The provider will add punctuation to recognition result - :param intelligence_service: The SID of the [Voice Intelligence Service](https://www.twilio.com/docs/voice/intelligence/api/service-resource) for persisting transcripts and running post-call Language Operators . + :param intelligence_service: The SID or unique name of the [Voice Intelligence Service](https://www.twilio.com/docs/voice/intelligence/api/service-resource) for persisting transcripts and running post-call Language Operators . :returns: The created TranscriptionInstance """ diff --git a/twilio/rest/flex_api/v1/interaction/interaction_channel/__init__.py b/twilio/rest/flex_api/v1/interaction/interaction_channel/__init__.py index 781adb9797..b029104c8d 100644 --- a/twilio/rest/flex_api/v1/interaction/interaction_channel/__init__.py +++ b/twilio/rest/flex_api/v1/interaction/interaction_channel/__init__.py @@ -25,6 +25,9 @@ from twilio.rest.flex_api.v1.interaction.interaction_channel.interaction_channel_participant import ( InteractionChannelParticipantList, ) +from twilio.rest.flex_api.v1.interaction.interaction_channel.interaction_transfer import ( + InteractionTransferList, +) class InteractionChannelInstance(InstanceResource): @@ -171,6 +174,13 @@ def participants(self) -> InteractionChannelParticipantList: """ return self._proxy.participants + @property + def transfers(self) -> InteractionTransferList: + """ + Access the transfers + """ + return self._proxy.transfers + def __repr__(self) -> str: """ Provide a friendly representation @@ -204,6 +214,7 @@ def __init__(self, version: Version, interaction_sid: str, sid: str): self._invites: Optional[InteractionChannelInviteList] = None self._participants: Optional[InteractionChannelParticipantList] = None + self._transfers: Optional[InteractionTransferList] = None def fetch(self) -> InteractionChannelInstance: """ @@ -349,6 +360,19 @@ def participants(self) -> InteractionChannelParticipantList: ) return self._participants + @property + def transfers(self) -> InteractionTransferList: + """ + Access the transfers + """ + if self._transfers is None: + self._transfers = InteractionTransferList( + self._version, + self._solution["interaction_sid"], + self._solution["sid"], + ) + return self._transfers + def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/flex_api/v1/interaction/interaction_channel/interaction_transfer.py b/twilio/rest/flex_api/v1/interaction/interaction_channel/interaction_transfer.py new file mode 100644 index 0000000000..04a5afacdb --- /dev/null +++ b/twilio/rest/flex_api/v1/interaction/interaction_channel/interaction_transfer.py @@ -0,0 +1,423 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Flex + 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 datetime import datetime +from typing import Any, Dict, Optional, Union +from twilio.base import deserialize, values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class InteractionTransferInstance(InstanceResource): + + class TransferStatus(object): + ACTIVE = "active" + FAILED = "failed" + COMPLETED = "completed" + + class TransferType(object): + WARM = "warm" + COLD = "cold" + EXTERNAL = "external" + + """ + :ivar sid: The unique string created by Twilio to identify an Interaction Transfer resource. + :ivar instance_sid: The SID of the Instance associated with the Transfer. + :ivar account_sid: The SID of the Account that created the Transfer. + :ivar interaction_sid: The Interaction Sid for this channel. + :ivar channel_sid: The Channel Sid for this Transfer. + :ivar execution_sid: The Execution SID associated with the Transfer. + :ivar type: + :ivar status: + :ivar _from: The SID of the Participant initiating the Transfer. + :ivar to: The SID of the Participant receiving the Transfer. + :ivar note_sid: The SID of the Note associated with the Transfer. + :ivar summary_sid: The SID of the Summary associated with the Transfer. + :ivar date_created: The date and time when the Transfer was created. + :ivar date_updated: The date and time when the Transfer was last updated. + :ivar url: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + interaction_sid: str, + channel_sid: str, + sid: Optional[str] = None, + ): + super().__init__(version) + + self.sid: Optional[str] = payload.get("sid") + self.instance_sid: Optional[str] = payload.get("instance_sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.interaction_sid: Optional[str] = payload.get("interaction_sid") + self.channel_sid: Optional[str] = payload.get("channel_sid") + self.execution_sid: Optional[str] = payload.get("execution_sid") + self.type: Optional["InteractionTransferInstance.TransferType"] = payload.get( + "type" + ) + self.status: Optional["InteractionTransferInstance.TransferStatus"] = ( + payload.get("status") + ) + self._from: Optional[str] = payload.get("from") + self.to: Optional[str] = payload.get("to") + self.note_sid: Optional[str] = payload.get("note_sid") + self.summary_sid: Optional[str] = payload.get("summary_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.url: Optional[str] = payload.get("url") + + self._solution = { + "interaction_sid": interaction_sid, + "channel_sid": channel_sid, + "sid": sid or self.sid, + } + self._context: Optional[InteractionTransferContext] = None + + @property + def _proxy(self) -> "InteractionTransferContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: InteractionTransferContext for this InteractionTransferInstance + """ + if self._context is None: + self._context = InteractionTransferContext( + self._version, + interaction_sid=self._solution["interaction_sid"], + channel_sid=self._solution["channel_sid"], + sid=self._solution["sid"], + ) + return self._context + + def fetch(self) -> "InteractionTransferInstance": + """ + Fetch the InteractionTransferInstance + + + :returns: The fetched InteractionTransferInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "InteractionTransferInstance": + """ + Asynchronous coroutine to fetch the InteractionTransferInstance + + + :returns: The fetched InteractionTransferInstance + """ + return await self._proxy.fetch_async() + + def update( + self, body: Union[object, object] = values.unset + ) -> "InteractionTransferInstance": + """ + Update the InteractionTransferInstance + + :param body: + + :returns: The updated InteractionTransferInstance + """ + return self._proxy.update( + body=body, + ) + + async def update_async( + self, body: Union[object, object] = values.unset + ) -> "InteractionTransferInstance": + """ + Asynchronous coroutine to update the InteractionTransferInstance + + :param body: + + :returns: The updated InteractionTransferInstance + """ + return await self._proxy.update_async( + body=body, + ) + + 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 InteractionTransferContext(InstanceContext): + + def __init__( + self, version: Version, interaction_sid: str, channel_sid: str, sid: str + ): + """ + Initialize the InteractionTransferContext + + :param version: Version that contains the resource + :param interaction_sid: The Interaction Sid for this channel. + :param channel_sid: The Channel Sid for this Transfer. + :param sid: The unique string created by Twilio to identify a Transfer resource. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "interaction_sid": interaction_sid, + "channel_sid": channel_sid, + "sid": sid, + } + self._uri = "/Interactions/{interaction_sid}/Channels/{channel_sid}/Transfers/{sid}".format( + **self._solution + ) + + def fetch(self) -> InteractionTransferInstance: + """ + Fetch the InteractionTransferInstance + + + :returns: The fetched InteractionTransferInstance + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) + + return InteractionTransferInstance( + self._version, + payload, + interaction_sid=self._solution["interaction_sid"], + channel_sid=self._solution["channel_sid"], + sid=self._solution["sid"], + ) + + async def fetch_async(self) -> InteractionTransferInstance: + """ + Asynchronous coroutine to fetch the InteractionTransferInstance + + + :returns: The fetched InteractionTransferInstance + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = await self._version.fetch_async( + method="GET", uri=self._uri, headers=headers + ) + + return InteractionTransferInstance( + self._version, + payload, + interaction_sid=self._solution["interaction_sid"], + channel_sid=self._solution["channel_sid"], + sid=self._solution["sid"], + ) + + def update( + self, body: Union[object, object] = values.unset + ) -> InteractionTransferInstance: + """ + Update the InteractionTransferInstance + + :param body: + + :returns: The updated InteractionTransferInstance + """ + data = body.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + payload = self._version.update( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return InteractionTransferInstance( + self._version, + payload, + interaction_sid=self._solution["interaction_sid"], + channel_sid=self._solution["channel_sid"], + sid=self._solution["sid"], + ) + + async def update_async( + self, body: Union[object, object] = values.unset + ) -> InteractionTransferInstance: + """ + Asynchronous coroutine to update the InteractionTransferInstance + + :param body: + + :returns: The updated InteractionTransferInstance + """ + data = body.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + payload = await self._version.update_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return InteractionTransferInstance( + self._version, + payload, + interaction_sid=self._solution["interaction_sid"], + channel_sid=self._solution["channel_sid"], + sid=self._solution["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 InteractionTransferList(ListResource): + + def __init__(self, version: Version, interaction_sid: str, channel_sid: str): + """ + Initialize the InteractionTransferList + + :param version: Version that contains the resource + :param interaction_sid: The Interaction Sid for the Interaction + :param channel_sid: The Channel Sid for the Channel. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "interaction_sid": interaction_sid, + "channel_sid": channel_sid, + } + self._uri = ( + "/Interactions/{interaction_sid}/Channels/{channel_sid}/Transfers".format( + **self._solution + ) + ) + + def create( + self, body: Union[object, object] = values.unset + ) -> InteractionTransferInstance: + """ + Create the InteractionTransferInstance + + :param body: + + :returns: The created InteractionTransferInstance + """ + data = body.to_dict() + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return InteractionTransferInstance( + self._version, + payload, + interaction_sid=self._solution["interaction_sid"], + channel_sid=self._solution["channel_sid"], + ) + + async def create_async( + self, body: Union[object, object] = values.unset + ) -> InteractionTransferInstance: + """ + Asynchronously create the InteractionTransferInstance + + :param body: + + :returns: The created InteractionTransferInstance + """ + data = body.to_dict() + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return InteractionTransferInstance( + self._version, + payload, + interaction_sid=self._solution["interaction_sid"], + channel_sid=self._solution["channel_sid"], + ) + + def get(self, sid: str) -> InteractionTransferContext: + """ + Constructs a InteractionTransferContext + + :param sid: The unique string created by Twilio to identify a Transfer resource. + """ + return InteractionTransferContext( + self._version, + interaction_sid=self._solution["interaction_sid"], + channel_sid=self._solution["channel_sid"], + sid=sid, + ) + + def __call__(self, sid: str) -> InteractionTransferContext: + """ + Constructs a InteractionTransferContext + + :param sid: The unique string created by Twilio to identify a Transfer resource. + """ + return InteractionTransferContext( + self._version, + interaction_sid=self._solution["interaction_sid"], + channel_sid=self._solution["channel_sid"], + sid=sid, + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/iam/v1/__init__.py b/twilio/rest/iam/v1/__init__.py index 0c46947341..408de11acb 100644 --- a/twilio/rest/iam/v1/__init__.py +++ b/twilio/rest/iam/v1/__init__.py @@ -17,7 +17,7 @@ from twilio.base.domain import Domain from twilio.rest.iam.v1.api_key import ApiKeyList from twilio.rest.iam.v1.get_api_keys import GetApiKeysList -from twilio.rest.iam.v1.new_api_key import NewApiKeyList +from twilio.rest.iam.v1.key import KeyList class V1(Version): @@ -31,7 +31,7 @@ def __init__(self, domain: Domain): super().__init__(domain, "v1") self._api_key: Optional[ApiKeyList] = None self._get_api_keys: Optional[GetApiKeysList] = None - self._new_api_key: Optional[NewApiKeyList] = None + self._keys: Optional[KeyList] = None @property def api_key(self) -> ApiKeyList: @@ -46,10 +46,10 @@ def get_api_keys(self) -> GetApiKeysList: return self._get_api_keys @property - def new_api_key(self) -> NewApiKeyList: - if self._new_api_key is None: - self._new_api_key = NewApiKeyList(self) - return self._new_api_key + def keys(self) -> KeyList: + if self._keys is None: + self._keys = KeyList(self) + return self._keys def __repr__(self) -> str: """ diff --git a/twilio/rest/iam/v1/new_api_key.py b/twilio/rest/iam/v1/key.py similarity index 88% rename from twilio/rest/iam/v1/new_api_key.py rename to twilio/rest/iam/v1/key.py index 760ce79ca3..cd5556df94 100644 --- a/twilio/rest/iam/v1/new_api_key.py +++ b/twilio/rest/iam/v1/key.py @@ -21,7 +21,7 @@ from twilio.base.version import Version -class NewApiKeyInstance(InstanceResource): +class KeyInstance(InstanceResource): class Keytype(object): RESTRICTED = "restricted" @@ -56,14 +56,14 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" -class NewApiKeyList(ListResource): +class KeyList(ListResource): def __init__(self, version: Version): """ - Initialize the NewApiKeyList + Initialize the KeyList :param version: Version that contains the resource @@ -76,18 +76,18 @@ def create( self, account_sid: str, friendly_name: Union[str, object] = values.unset, - key_type: Union["NewApiKeyInstance.Keytype", object] = values.unset, + key_type: Union["KeyInstance.Keytype", object] = values.unset, policy: Union[object, object] = values.unset, - ) -> NewApiKeyInstance: + ) -> KeyInstance: """ - Create the NewApiKeyInstance + Create the KeyInstance :param account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Payments resource. :param friendly_name: A descriptive string that you create to describe the resource. It can be up to 64 characters long. :param key_type: :param policy: The \\\\`Policy\\\\` object is a collection that specifies the allowed Twilio permissions for the restricted key. For more information on the permissions available with restricted API keys, refer to the [Twilio documentation](https://www.twilio.com/docs/iam/api-keys/restricted-api-keys#permissions-available-with-restricted-api-keys). - :returns: The created NewApiKeyInstance + :returns: The created KeyInstance """ data = values.of( @@ -108,24 +108,24 @@ def create( method="POST", uri=self._uri, data=data, headers=headers ) - return NewApiKeyInstance(self._version, payload) + return KeyInstance(self._version, payload) async def create_async( self, account_sid: str, friendly_name: Union[str, object] = values.unset, - key_type: Union["NewApiKeyInstance.Keytype", object] = values.unset, + key_type: Union["KeyInstance.Keytype", object] = values.unset, policy: Union[object, object] = values.unset, - ) -> NewApiKeyInstance: + ) -> KeyInstance: """ - Asynchronously create the NewApiKeyInstance + Asynchronously create the KeyInstance :param account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Payments resource. :param friendly_name: A descriptive string that you create to describe the resource. It can be up to 64 characters long. :param key_type: :param policy: The \\\\`Policy\\\\` object is a collection that specifies the allowed Twilio permissions for the restricted key. For more information on the permissions available with restricted API keys, refer to the [Twilio documentation](https://www.twilio.com/docs/iam/api-keys/restricted-api-keys#permissions-available-with-restricted-api-keys). - :returns: The created NewApiKeyInstance + :returns: The created KeyInstance """ data = values.of( @@ -146,7 +146,7 @@ async def create_async( method="POST", uri=self._uri, data=data, headers=headers ) - return NewApiKeyInstance(self._version, payload) + return KeyInstance(self._version, payload) def __repr__(self) -> str: """ @@ -154,4 +154,4 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" diff --git a/twilio/rest/numbers/v1/__init__.py b/twilio/rest/numbers/v1/__init__.py index 043364c3d5..68f078a88d 100644 --- a/twilio/rest/numbers/v1/__init__.py +++ b/twilio/rest/numbers/v1/__init__.py @@ -28,12 +28,10 @@ from twilio.rest.numbers.v1.porting_webhook_configuration_delete import ( PortingWebhookConfigurationDeleteList, ) -from twilio.rest.numbers.v1.porting_webhook_configuration_fetch import ( - PortingWebhookConfigurationFetchList, -) from twilio.rest.numbers.v1.signing_request_configuration import ( SigningRequestConfigurationList, ) +from twilio.rest.numbers.v1.webhook import WebhookList class V1(Version): @@ -58,12 +56,10 @@ def __init__(self, domain: Domain): self._porting_webhook_configurations_delete: Optional[ PortingWebhookConfigurationDeleteList ] = None - self._porting_webhook_configuration_fetch: Optional[ - PortingWebhookConfigurationFetchList - ] = None self._signing_request_configurations: Optional[ SigningRequestConfigurationList ] = None + self._webhook: Optional[WebhookList] = None @property def bulk_eligibilities(self) -> BulkEligibilityList: @@ -111,22 +107,18 @@ def porting_webhook_configurations_delete( ) return self._porting_webhook_configurations_delete - @property - def porting_webhook_configuration_fetch( - self, - ) -> PortingWebhookConfigurationFetchList: - if self._porting_webhook_configuration_fetch is None: - self._porting_webhook_configuration_fetch = ( - PortingWebhookConfigurationFetchList(self) - ) - return self._porting_webhook_configuration_fetch - @property def signing_request_configurations(self) -> SigningRequestConfigurationList: if self._signing_request_configurations is None: self._signing_request_configurations = SigningRequestConfigurationList(self) return self._signing_request_configurations + @property + def webhook(self) -> WebhookList: + if self._webhook is None: + self._webhook = WebhookList(self) + return self._webhook + def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py b/twilio/rest/numbers/v1/webhook.py similarity index 78% rename from twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py rename to twilio/rest/numbers/v1/webhook.py index 5d381768c7..69bd556326 100644 --- a/twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py +++ b/twilio/rest/numbers/v1/webhook.py @@ -21,7 +21,7 @@ from twilio.base.version import Version -class PortingWebhookConfigurationFetchInstance(InstanceResource): +class WebhookInstance(InstanceResource): """ :ivar url: The URL of the webhook configuration request :ivar port_in_target_url: The complete webhook url that will be called when a notification event for port in request or port in phone number happens @@ -52,14 +52,14 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" -class PortingWebhookConfigurationFetchList(ListResource): +class WebhookList(ListResource): def __init__(self, version: Version): """ - Initialize the PortingWebhookConfigurationFetchList + Initialize the WebhookList :param version: Version that contains the resource @@ -68,12 +68,12 @@ def __init__(self, version: Version): self._uri = "/Porting/Configuration/Webhook" - def fetch(self) -> PortingWebhookConfigurationFetchInstance: + def fetch(self) -> WebhookInstance: """ - Asynchronously fetch the PortingWebhookConfigurationFetchInstance + Asynchronously fetch the WebhookInstance - :returns: The fetched PortingWebhookConfigurationFetchInstance + :returns: The fetched WebhookInstance """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -81,14 +81,14 @@ def fetch(self) -> PortingWebhookConfigurationFetchInstance: payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) - return PortingWebhookConfigurationFetchInstance(self._version, payload) + return WebhookInstance(self._version, payload) - async def fetch_async(self) -> PortingWebhookConfigurationFetchInstance: + async def fetch_async(self) -> WebhookInstance: """ - Asynchronously fetch the PortingWebhookConfigurationFetchInstance + Asynchronously fetch the WebhookInstance - :returns: The fetched PortingWebhookConfigurationFetchInstance + :returns: The fetched WebhookInstance """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -98,7 +98,7 @@ async def fetch_async(self) -> PortingWebhookConfigurationFetchInstance: method="GET", uri=self._uri, headers=headers ) - return PortingWebhookConfigurationFetchInstance(self._version, payload) + return WebhookInstance(self._version, payload) def __repr__(self) -> str: """ @@ -106,4 +106,4 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" diff --git a/twilio/rest/trusthub/v1/supporting_document.py b/twilio/rest/trusthub/v1/supporting_document.py index b53d7d319c..f2fd3b7e1c 100644 --- a/twilio/rest/trusthub/v1/supporting_document.py +++ b/twilio/rest/trusthub/v1/supporting_document.py @@ -25,12 +25,12 @@ class SupportingDocumentInstance(InstanceResource): class Status(object): - DRAFT = "draft" - PENDING_REVIEW = "pending-review" - REJECTED = "rejected" - APPROVED = "approved" - EXPIRED = "expired" - PROVISIONALLY_APPROVED = "provisionally-approved" + DRAFT = "DRAFT" + PENDING_REVIEW = "PENDING_REVIEW" + REJECTED = "REJECTED" + APPROVED = "APPROVED" + EXPIRED = "EXPIRED" + PROVISIONALLY_APPROVED = "PROVISIONALLY_APPROVED" """ :ivar sid: The unique string created by Twilio to identify the Supporting Document resource. From 71fb731c9c6356cf08030221d74a900c935109da Mon Sep 17 00:00:00 2001 From: Twilio Date: Thu, 20 Feb 2025 14:17:19 +0000 Subject: [PATCH 74/87] Release 9.4.6 --- setup.py | 2 +- twilio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 8313a29cfc..deb99437bf 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name="twilio", - version="9.4.5", + version="9.4.6", description="Twilio API client and TwiML generator", author="Twilio", help_center="https://www.twilio.com/help/contact", diff --git a/twilio/__init__.py b/twilio/__init__.py index 7a2fbba6c7..ef7ca2a724 100644 --- a/twilio/__init__.py +++ b/twilio/__init__.py @@ -1,2 +1,2 @@ -__version_info__ = ("9", "4", "5") +__version_info__ = ("9", "4", "6") __version__ = ".".join(__version_info__) From 58cb0e63c1bbd3c4c856aeeb278b8fdb3c233774 Mon Sep 17 00:00:00 2001 From: sbansla <104902068+sbansla@users.noreply.github.com> Date: Thu, 27 Feb 2025 13:48:02 +0530 Subject: [PATCH 75/87] fix: AssistantsBase import (#847) * fix AssistantsBase import --- .github/workflows/test-and-deploy.yml | 1 + tests/cluster/test_cluster.py | 6 ++++++ twilio/rest/assistants/__init__.py | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-and-deploy.yml b/.github/workflows/test-and-deploy.yml index 1e1c04d500..db745daca2 100644 --- a/.github/workflows/test-and-deploy.yml +++ b/.github/workflows/test-and-deploy.yml @@ -47,6 +47,7 @@ jobs: TWILIO_FROM_NUMBER: ${{ secrets.TWILIO_FROM_NUMBER }} TWILIO_TO_NUMBER: ${{ secrets.TWILIO_TO_NUMBER }} TWILIO_AUTH_TOKEN: ${{ secrets.TWILIO_AUTH_TOKEN }} + ASSISTANT_ID: ${{ secrets.ASSISTANT_ID }} run: make cluster-test - name: Verify docs generation diff --git a/tests/cluster/test_cluster.py b/tests/cluster/test_cluster.py index 556fa8da75..0c18428d15 100644 --- a/tests/cluster/test_cluster.py +++ b/tests/cluster/test_cluster.py @@ -12,6 +12,7 @@ def setUp(self): self.api_key = os.environ["TWILIO_API_KEY"] self.api_secret = os.environ["TWILIO_API_SECRET"] self.account_sid = os.environ["TWILIO_ACCOUNT_SID"] + self.assistant_id = os.environ["ASSISTANT_ID"] self.client = Client( username=self.api_key, password=self.api_secret, @@ -65,6 +66,11 @@ def test_list_available_numbers(self): self.assertIsNotNone(toll_free_numbers) self.assertEqual(len(toll_free_numbers), 2) + def test_fetch_assistant(self): + assistant = self.client.assistants.v1.assistants(self.assistant_id).fetch() + self.assertIsNotNone(assistant) + self.assertEqual(assistant.account_sid, self.account_sid) + def test_calling_twiml_string(self): call = self.client.calls.create( to=self.to_number, from_=self.from_number, twiml=str(self.voice_twiml) diff --git a/twilio/rest/assistants/__init__.py b/twilio/rest/assistants/__init__.py index 60c812014d..889daf9d29 100644 --- a/twilio/rest/assistants/__init__.py +++ b/twilio/rest/assistants/__init__.py @@ -1,6 +1,6 @@ from warnings import warn -from twilio.rest.assistants import AssistantsBase +from twilio.rest.assistants.AssistantsBase import AssistantsBase from twilio.rest.assistants.v1.assistant import AssistantList from twilio.rest.assistants.v1.knowledge import KnowledgeList from twilio.rest.assistants.v1.policy import PolicyList From 7321899bf7d0d55790ae8e0849ac14e1574f08c6 Mon Sep 17 00:00:00 2001 From: Twilio Date: Tue, 11 Mar 2025 12:44:31 +0000 Subject: [PATCH 76/87] [Librarian] Regenerated @ 1565ca6ea5fc25da35893aea0bc70b60053b86b8 d990df451c3b8033c98bd3ead6be1f25b41b05b9 --- CHANGES.md | 21 +++++++++++++ .../api/v2010/account/address/__init__.py | 18 +++++++++++ .../conversations/v1/address_configuration.py | 1 + twilio/rest/events/v1/sink/__init__.py | 1 + twilio/rest/iam/v1/__init__.py | 12 ++++---- twilio/rest/iam/v1/{key.py => new_api_key.py} | 30 +++++++++---------- .../rest/insights/v1/conference/__init__.py | 1 + .../v1/conference/conference_participant.py | 1 + .../v1/brand_registration/__init__.py | 4 ++- .../v1/brand_registration/brand_vetting.py | 1 + .../messaging/v1/tollfree_verification.py | 1 + twilio/rest/numbers/v2/hosted_number_order.py | 2 ++ 12 files changed, 71 insertions(+), 22 deletions(-) rename twilio/rest/iam/v1/{key.py => new_api_key.py} (88%) diff --git a/CHANGES.md b/CHANGES.md index c991cee31c..e500308927 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,27 @@ twilio-python Changelog Here you can see the full list of changes between each twilio-python release. +[2025-03-11] Version 9.5.0 +-------------------------- +**Library - Feature** +- [PR #850](https://github.com/twilio/twilio-python/pull/850): Update UPGRADE.md. Thanks to [@manisha1997](https://github.com/manisha1997)! + +**Library - Fix** +- [PR #847](https://github.com/twilio/twilio-python/pull/847): AssistantsBase import. Thanks to [@sbansla](https://github.com/sbansla)! + +**Api** +- Add the missing `emergency_enabled` field for `Address Service` endpoints + +**Messaging** +- Add missing enums for A2P and TF + +**Numbers** +- add missing enum values to hosted_number_order_status + +**Twiml** +- Convert Twiml Attribute `speechModel` of type enum to string **(breaking change)** + + [2025-02-20] Version 9.4.6 -------------------------- **Library - Chore** diff --git a/twilio/rest/api/v2010/account/address/__init__.py b/twilio/rest/api/v2010/account/address/__init__.py index 38a5a231a8..77fc702ccc 100644 --- a/twilio/rest/api/v2010/account/address/__init__.py +++ b/twilio/rest/api/v2010/account/address/__init__.py @@ -619,6 +619,7 @@ def stream( self, customer_name: Union[str, object] = values.unset, friendly_name: Union[str, object] = values.unset, + emergency_enabled: Union[bool, object] = values.unset, iso_country: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, @@ -631,6 +632,7 @@ def stream( :param str customer_name: The `customer_name` of the Address resources to read. :param str friendly_name: The string that identifies the Address resources to read. + :param bool emergency_enabled: Whether the address can be associated to a number for emergency calling. :param str iso_country: The ISO country code of the Address resources to read. :param limit: Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit @@ -645,6 +647,7 @@ def stream( page = self.page( customer_name=customer_name, friendly_name=friendly_name, + emergency_enabled=emergency_enabled, iso_country=iso_country, page_size=limits["page_size"], ) @@ -655,6 +658,7 @@ async def stream_async( self, customer_name: Union[str, object] = values.unset, friendly_name: Union[str, object] = values.unset, + emergency_enabled: Union[bool, object] = values.unset, iso_country: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, @@ -667,6 +671,7 @@ async def stream_async( :param str customer_name: The `customer_name` of the Address resources to read. :param str friendly_name: The string that identifies the Address resources to read. + :param bool emergency_enabled: Whether the address can be associated to a number for emergency calling. :param str iso_country: The ISO country code of the Address resources to read. :param limit: Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit @@ -681,6 +686,7 @@ async def stream_async( page = await self.page_async( customer_name=customer_name, friendly_name=friendly_name, + emergency_enabled=emergency_enabled, iso_country=iso_country, page_size=limits["page_size"], ) @@ -691,6 +697,7 @@ def list( self, customer_name: Union[str, object] = values.unset, friendly_name: Union[str, object] = values.unset, + emergency_enabled: Union[bool, object] = values.unset, iso_country: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, @@ -702,6 +709,7 @@ def list( :param str customer_name: The `customer_name` of the Address resources to read. :param str friendly_name: The string that identifies the Address resources to read. + :param bool emergency_enabled: Whether the address can be associated to a number for emergency calling. :param str iso_country: The ISO country code of the Address resources to read. :param limit: Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit @@ -716,6 +724,7 @@ def list( self.stream( customer_name=customer_name, friendly_name=friendly_name, + emergency_enabled=emergency_enabled, iso_country=iso_country, limit=limit, page_size=page_size, @@ -726,6 +735,7 @@ async def list_async( self, customer_name: Union[str, object] = values.unset, friendly_name: Union[str, object] = values.unset, + emergency_enabled: Union[bool, object] = values.unset, iso_country: Union[str, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, @@ -737,6 +747,7 @@ async def list_async( :param str customer_name: The `customer_name` of the Address resources to read. :param str friendly_name: The string that identifies the Address resources to read. + :param bool emergency_enabled: Whether the address can be associated to a number for emergency calling. :param str iso_country: The ISO country code of the Address resources to read. :param limit: Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit @@ -752,6 +763,7 @@ async def list_async( async for record in await self.stream_async( customer_name=customer_name, friendly_name=friendly_name, + emergency_enabled=emergency_enabled, iso_country=iso_country, limit=limit, page_size=page_size, @@ -762,6 +774,7 @@ def page( self, customer_name: Union[str, object] = values.unset, friendly_name: Union[str, object] = values.unset, + emergency_enabled: Union[bool, object] = values.unset, iso_country: Union[str, object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, @@ -773,6 +786,7 @@ def page( :param customer_name: The `customer_name` of the Address resources to read. :param friendly_name: The string that identifies the Address resources to read. + :param emergency_enabled: Whether the address can be associated to a number for emergency calling. :param iso_country: The ISO country code of the Address resources to read. :param page_token: PageToken provided by the API :param page_number: Page Number, this value is simply for client state @@ -784,6 +798,7 @@ def page( { "CustomerName": customer_name, "FriendlyName": friendly_name, + "EmergencyEnabled": serialize.boolean_to_string(emergency_enabled), "IsoCountry": iso_country, "PageToken": page_token, "Page": page_number, @@ -804,6 +819,7 @@ async def page_async( self, customer_name: Union[str, object] = values.unset, friendly_name: Union[str, object] = values.unset, + emergency_enabled: Union[bool, object] = values.unset, iso_country: Union[str, object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, @@ -815,6 +831,7 @@ async def page_async( :param customer_name: The `customer_name` of the Address resources to read. :param friendly_name: The string that identifies the Address resources to read. + :param emergency_enabled: Whether the address can be associated to a number for emergency calling. :param iso_country: The ISO country code of the Address resources to read. :param page_token: PageToken provided by the API :param page_number: Page Number, this value is simply for client state @@ -826,6 +843,7 @@ async def page_async( { "CustomerName": customer_name, "FriendlyName": friendly_name, + "EmergencyEnabled": serialize.boolean_to_string(emergency_enabled), "IsoCountry": iso_country, "PageToken": page_token, "Page": page_number, diff --git a/twilio/rest/conversations/v1/address_configuration.py b/twilio/rest/conversations/v1/address_configuration.py index 1609d99576..c12e3c7170 100644 --- a/twilio/rest/conversations/v1/address_configuration.py +++ b/twilio/rest/conversations/v1/address_configuration.py @@ -41,6 +41,7 @@ class Type(object): EMAIL = "email" RCS = "rcs" APPLE = "apple" + CHAT = "chat" """ :ivar sid: A 34 character string that uniquely identifies this resource. diff --git a/twilio/rest/events/v1/sink/__init__.py b/twilio/rest/events/v1/sink/__init__.py index 886c2947f5..3771f83bbc 100644 --- a/twilio/rest/events/v1/sink/__init__.py +++ b/twilio/rest/events/v1/sink/__init__.py @@ -30,6 +30,7 @@ class SinkType(object): KINESIS = "kinesis" WEBHOOK = "webhook" SEGMENT = "segment" + EMAIL = "email" class Status(object): INITIALIZED = "initialized" diff --git a/twilio/rest/iam/v1/__init__.py b/twilio/rest/iam/v1/__init__.py index 408de11acb..0c46947341 100644 --- a/twilio/rest/iam/v1/__init__.py +++ b/twilio/rest/iam/v1/__init__.py @@ -17,7 +17,7 @@ from twilio.base.domain import Domain from twilio.rest.iam.v1.api_key import ApiKeyList from twilio.rest.iam.v1.get_api_keys import GetApiKeysList -from twilio.rest.iam.v1.key import KeyList +from twilio.rest.iam.v1.new_api_key import NewApiKeyList class V1(Version): @@ -31,7 +31,7 @@ def __init__(self, domain: Domain): super().__init__(domain, "v1") self._api_key: Optional[ApiKeyList] = None self._get_api_keys: Optional[GetApiKeysList] = None - self._keys: Optional[KeyList] = None + self._new_api_key: Optional[NewApiKeyList] = None @property def api_key(self) -> ApiKeyList: @@ -46,10 +46,10 @@ def get_api_keys(self) -> GetApiKeysList: return self._get_api_keys @property - def keys(self) -> KeyList: - if self._keys is None: - self._keys = KeyList(self) - return self._keys + def new_api_key(self) -> NewApiKeyList: + if self._new_api_key is None: + self._new_api_key = NewApiKeyList(self) + return self._new_api_key def __repr__(self) -> str: """ diff --git a/twilio/rest/iam/v1/key.py b/twilio/rest/iam/v1/new_api_key.py similarity index 88% rename from twilio/rest/iam/v1/key.py rename to twilio/rest/iam/v1/new_api_key.py index cd5556df94..760ce79ca3 100644 --- a/twilio/rest/iam/v1/key.py +++ b/twilio/rest/iam/v1/new_api_key.py @@ -21,7 +21,7 @@ from twilio.base.version import Version -class KeyInstance(InstanceResource): +class NewApiKeyInstance(InstanceResource): class Keytype(object): RESTRICTED = "restricted" @@ -56,14 +56,14 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" -class KeyList(ListResource): +class NewApiKeyList(ListResource): def __init__(self, version: Version): """ - Initialize the KeyList + Initialize the NewApiKeyList :param version: Version that contains the resource @@ -76,18 +76,18 @@ def create( self, account_sid: str, friendly_name: Union[str, object] = values.unset, - key_type: Union["KeyInstance.Keytype", object] = values.unset, + key_type: Union["NewApiKeyInstance.Keytype", object] = values.unset, policy: Union[object, object] = values.unset, - ) -> KeyInstance: + ) -> NewApiKeyInstance: """ - Create the KeyInstance + Create the NewApiKeyInstance :param account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Payments resource. :param friendly_name: A descriptive string that you create to describe the resource. It can be up to 64 characters long. :param key_type: :param policy: The \\\\`Policy\\\\` object is a collection that specifies the allowed Twilio permissions for the restricted key. For more information on the permissions available with restricted API keys, refer to the [Twilio documentation](https://www.twilio.com/docs/iam/api-keys/restricted-api-keys#permissions-available-with-restricted-api-keys). - :returns: The created KeyInstance + :returns: The created NewApiKeyInstance """ data = values.of( @@ -108,24 +108,24 @@ def create( method="POST", uri=self._uri, data=data, headers=headers ) - return KeyInstance(self._version, payload) + return NewApiKeyInstance(self._version, payload) async def create_async( self, account_sid: str, friendly_name: Union[str, object] = values.unset, - key_type: Union["KeyInstance.Keytype", object] = values.unset, + key_type: Union["NewApiKeyInstance.Keytype", object] = values.unset, policy: Union[object, object] = values.unset, - ) -> KeyInstance: + ) -> NewApiKeyInstance: """ - Asynchronously create the KeyInstance + Asynchronously create the NewApiKeyInstance :param account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Payments resource. :param friendly_name: A descriptive string that you create to describe the resource. It can be up to 64 characters long. :param key_type: :param policy: The \\\\`Policy\\\\` object is a collection that specifies the allowed Twilio permissions for the restricted key. For more information on the permissions available with restricted API keys, refer to the [Twilio documentation](https://www.twilio.com/docs/iam/api-keys/restricted-api-keys#permissions-available-with-restricted-api-keys). - :returns: The created KeyInstance + :returns: The created NewApiKeyInstance """ data = values.of( @@ -146,7 +146,7 @@ async def create_async( method="POST", uri=self._uri, data=data, headers=headers ) - return KeyInstance(self._version, payload) + return NewApiKeyInstance(self._version, payload) def __repr__(self) -> str: """ @@ -154,4 +154,4 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" diff --git a/twilio/rest/insights/v1/conference/__init__.py b/twilio/rest/insights/v1/conference/__init__.py index a30de54cd7..ef3c51dac3 100644 --- a/twilio/rest/insights/v1/conference/__init__.py +++ b/twilio/rest/insights/v1/conference/__init__.py @@ -58,6 +58,7 @@ class Region(object): JP1 = "jp1" SG1 = "sg1" DE1 = "de1" + IN1 = "in1" class Tag(object): INVALID_REQUESTED_REGION = "invalid_requested_region" diff --git a/twilio/rest/insights/v1/conference/conference_participant.py b/twilio/rest/insights/v1/conference/conference_participant.py index 203f950699..171f4f1f87 100644 --- a/twilio/rest/insights/v1/conference/conference_participant.py +++ b/twilio/rest/insights/v1/conference/conference_participant.py @@ -62,6 +62,7 @@ class Region(object): JP1 = "jp1" SG1 = "sg1" DE1 = "de1" + IN1 = "in1" """ :ivar participant_sid: SID for this participant. diff --git a/twilio/rest/messaging/v1/brand_registration/__init__.py b/twilio/rest/messaging/v1/brand_registration/__init__.py index e8c2ac40d5..939cba604c 100644 --- a/twilio/rest/messaging/v1/brand_registration/__init__.py +++ b/twilio/rest/messaging/v1/brand_registration/__init__.py @@ -46,7 +46,9 @@ class Status(object): APPROVED = "APPROVED" FAILED = "FAILED" IN_REVIEW = "IN_REVIEW" - DELETED = "DELETED" + DELETION_PENDING = "DELETION_PENDING" + DELETION_FAILED = "DELETION_FAILED" + SUSPENDED = "SUSPENDED" """ :ivar sid: The unique string to identify Brand Registration. diff --git a/twilio/rest/messaging/v1/brand_registration/brand_vetting.py b/twilio/rest/messaging/v1/brand_registration/brand_vetting.py index 680be65037..b633144a71 100644 --- a/twilio/rest/messaging/v1/brand_registration/brand_vetting.py +++ b/twilio/rest/messaging/v1/brand_registration/brand_vetting.py @@ -26,6 +26,7 @@ class BrandVettingInstance(InstanceResource): class VettingProvider(object): CAMPAIGN_VERIFY = "campaign-verify" + AEGIS = "aegis" """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the vetting record. diff --git a/twilio/rest/messaging/v1/tollfree_verification.py b/twilio/rest/messaging/v1/tollfree_verification.py index d052bd4cde..00cf9c96e3 100644 --- a/twilio/rest/messaging/v1/tollfree_verification.py +++ b/twilio/rest/messaging/v1/tollfree_verification.py @@ -31,6 +31,7 @@ class OptInType(object): VIA_TEXT = "VIA_TEXT" MOBILE_QR_CODE = "MOBILE_QR_CODE" IMPORT = "IMPORT" + IMPORT_PLEASE_REPLACE = "IMPORT_PLEASE_REPLACE" class Status(object): PENDING_REVIEW = "PENDING_REVIEW" diff --git a/twilio/rest/numbers/v2/hosted_number_order.py b/twilio/rest/numbers/v2/hosted_number_order.py index 5ad2b6d920..6afa755bd3 100644 --- a/twilio/rest/numbers/v2/hosted_number_order.py +++ b/twilio/rest/numbers/v2/hosted_number_order.py @@ -25,11 +25,13 @@ class HostedNumberOrderInstance(InstanceResource): class Status(object): + TWILIO_PROCESSING = "twilio-processing" RECEIVED = "received" PENDING_VERIFICATION = "pending-verification" VERIFIED = "verified" PENDING_LOA = "pending-loa" CARRIER_PROCESSING = "carrier-processing" + TESTING = "testing" COMPLETED = "completed" FAILED = "failed" ACTION_REQUIRED = "action-required" From 317a5bbd59e381a8bd19eb0b871f73c8f55a1a64 Mon Sep 17 00:00:00 2001 From: Twilio Date: Tue, 11 Mar 2025 12:49:50 +0000 Subject: [PATCH 77/87] Release 9.5.0 --- setup.py | 2 +- twilio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index deb99437bf..fc58de0ec1 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name="twilio", - version="9.4.6", + version="9.5.0", description="Twilio API client and TwiML generator", author="Twilio", help_center="https://www.twilio.com/help/contact", diff --git a/twilio/__init__.py b/twilio/__init__.py index ef7ca2a724..b2bf5772dd 100644 --- a/twilio/__init__.py +++ b/twilio/__init__.py @@ -1,2 +1,2 @@ -__version_info__ = ("9", "4", "6") +__version_info__ = ("9", "5", "0") __version__ = ".".join(__version_info__) From 518dc8a347e252e15b98cc3787eb0b481488dd28 Mon Sep 17 00:00:00 2001 From: Twilio Date: Thu, 20 Mar 2025 10:24:18 +0000 Subject: [PATCH 78/87] [Librarian] Regenerated @ 160660ccc2266b2b6f15f8e8291a4b07d233dc21 817197bb9e54bf7b3518030a6183a4c45eb689fa --- CHANGES.md | 12 + twilio/rest/accounts/v1/safelist.py | 14 +- .../api/v2010/account/conference/__init__.py | 2 +- .../v2010/account/conference/participant.py | 4 +- .../api/v2010/account/message/__init__.py | 9 + twilio/rest/flex_api/v2/flex_user.py | 42 - twilio/rest/iam/v1/__init__.py | 8 + twilio/rest/iam/v1/token.py | 170 ++++ twilio/rest/insights/v1/room/__init__.py | 12 + twilio/rest/insights/v1/room/participant.py | 12 + twilio/rest/preview/PreviewBase.py | 11 - twilio/rest/preview/sync/__init__.py | 43 - twilio/rest/preview/sync/service/__init__.py | 741 ----------------- .../preview/sync/service/document/__init__.py | 693 ---------------- .../service/document/document_permission.py | 617 -------------- .../sync/service/sync_list/__init__.py | 595 -------------- .../sync/service/sync_list/sync_list_item.py | 763 ----------------- .../service/sync_list/sync_list_permission.py | 617 -------------- .../preview/sync/service/sync_map/__init__.py | 593 -------------- .../sync/service/sync_map/sync_map_item.py | 767 ------------------ .../service/sync_map/sync_map_permission.py | 615 -------------- .../v1/workspace/task/reservation.py | 8 +- .../v1/workspace/worker/reservation.py | 8 +- .../video/v1/room/participant/__init__.py | 1 + twilio/rest/wireless/v1/rate_plan.py | 15 + 25 files changed, 257 insertions(+), 6115 deletions(-) create mode 100644 twilio/rest/iam/v1/token.py delete mode 100644 twilio/rest/preview/sync/__init__.py delete mode 100644 twilio/rest/preview/sync/service/__init__.py delete mode 100644 twilio/rest/preview/sync/service/document/__init__.py delete mode 100644 twilio/rest/preview/sync/service/document/document_permission.py delete mode 100644 twilio/rest/preview/sync/service/sync_list/__init__.py delete mode 100644 twilio/rest/preview/sync/service/sync_list/sync_list_item.py delete mode 100644 twilio/rest/preview/sync/service/sync_list/sync_list_permission.py delete mode 100644 twilio/rest/preview/sync/service/sync_map/__init__.py delete mode 100644 twilio/rest/preview/sync/service/sync_map/sync_map_item.py delete mode 100644 twilio/rest/preview/sync/service/sync_map/sync_map_permission.py diff --git a/CHANGES.md b/CHANGES.md index e500308927..a985cb3245 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,18 @@ twilio-python Changelog Here you can see the full list of changes between each twilio-python release. +[2025-03-20] Version 9.5.1 +-------------------------- +**Accounts** +- Update Safelist API docs as part of prefix supoort + +**Flex** +- Removing `first_name`, `last_name`, and `friendly_name` from the Flex User API + +**Messaging** +- Add missing tests under transaction/phone_numbers and transaction/short_code + + [2025-03-11] Version 9.5.0 -------------------------- **Library - Feature** diff --git a/twilio/rest/accounts/v1/safelist.py b/twilio/rest/accounts/v1/safelist.py index 0bbbb32420..be8fe416af 100644 --- a/twilio/rest/accounts/v1/safelist.py +++ b/twilio/rest/accounts/v1/safelist.py @@ -23,7 +23,7 @@ class SafelistInstance(InstanceResource): """ :ivar sid: The unique string that we created to identify the SafeList resource. - :ivar phone_number: The phone number in SafeList. + :ivar phone_number: The phone number or phone number 1k prefix in SafeList. """ def __init__(self, version: Version, payload: Dict[str, Any]): @@ -59,7 +59,7 @@ def create(self, phone_number: str) -> SafelistInstance: """ Create the SafelistInstance - :param phone_number: The phone number to be added in SafeList. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). + :param phone_number: The phone number or phone number 1k prefix to be added in SafeList. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). :returns: The created SafelistInstance """ @@ -85,7 +85,7 @@ async def create_async(self, phone_number: str) -> SafelistInstance: """ Asynchronously create the SafelistInstance - :param phone_number: The phone number to be added in SafeList. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). + :param phone_number: The phone number or phone number 1k prefix to be added in SafeList. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). :returns: The created SafelistInstance """ @@ -111,7 +111,7 @@ def delete(self, phone_number: Union[str, object] = values.unset) -> bool: """ Asynchronously delete the SafelistInstance - :param phone_number: The phone number to be removed from SafeList. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). + :param phone_number: The phone number or phone number 1k prefix to be removed from SafeList. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). :returns: True if delete succeeds, False otherwise """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -131,7 +131,7 @@ async def delete_async( """ Asynchronously delete the SafelistInstance - :param phone_number: The phone number to be removed from SafeList. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). + :param phone_number: The phone number or phone number 1k prefix to be removed from SafeList. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). :returns: True if delete succeeds, False otherwise """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -151,7 +151,7 @@ def fetch( """ Asynchronously fetch the SafelistInstance - :param phone_number: The phone number to be fetched from SafeList. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). + :param phone_number: The phone number or phone number 1k prefix to be fetched from SafeList. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). :returns: The fetched SafelistInstance """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -176,7 +176,7 @@ async def fetch_async( """ Asynchronously fetch the SafelistInstance - :param phone_number: The phone number to be fetched from SafeList. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). + :param phone_number: The phone number or phone number 1k prefix to be fetched from SafeList. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). :returns: The fetched SafelistInstance """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) diff --git a/twilio/rest/api/v2010/account/conference/__init__.py b/twilio/rest/api/v2010/account/conference/__init__.py index 1ff3289a6c..672d9d0fea 100644 --- a/twilio/rest/api/v2010/account/conference/__init__.py +++ b/twilio/rest/api/v2010/account/conference/__init__.py @@ -51,7 +51,7 @@ class UpdateStatus(object): :ivar date_updated: The date and time in UTC that this resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. :ivar api_version: The API version used to create this conference. :ivar friendly_name: A string that you assigned to describe this conference room. Maximum length is 128 characters. - :ivar region: A string that represents the Twilio Region where the conference audio was mixed. May be `us1`, `ie1`, `de1`, `sg1`, `br1`, `au1`, and `jp1`. Basic conference audio will always be mixed in `us1`. Global Conference audio will be mixed nearest to the majority of participants. + :ivar region: A string that represents the Twilio Region where the conference audio was mixed. May be `us1`, `us2`, `ie1`, `de1`, `sg1`, `br1`, `au1`, and `jp1`. Basic conference audio will always be mixed in `us1`. Global Conference audio will be mixed nearest to the majority of participants. :ivar sid: The unique, Twilio-provided string used to identify this Conference resource. :ivar status: :ivar uri: The URI of this resource, relative to `https://api.twilio.com`. diff --git a/twilio/rest/api/v2010/account/conference/participant.py b/twilio/rest/api/v2010/account/conference/participant.py index a93f9f9adc..c6511dadf6 100644 --- a/twilio/rest/api/v2010/account/conference/participant.py +++ b/twilio/rest/api/v2010/account/conference/participant.py @@ -625,7 +625,7 @@ def create( :param recording_status_callback_method: The HTTP method we should use when we call `recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. :param sip_auth_username: The SIP username used for authentication. :param sip_auth_password: The SIP password for authentication. - :param region: The [region](https://support.twilio.com/hc/en-us/articles/223132167-How-global-low-latency-routing-and-region-selection-work-for-conferences-and-Client-calls) where we should mix the recorded audio. Can be:`us1`, `ie1`, `de1`, `sg1`, `br1`, `au1`, or `jp1`. + :param region: The [region](https://support.twilio.com/hc/en-us/articles/223132167-How-global-low-latency-routing-and-region-selection-work-for-conferences-and-Client-calls) where we should mix the recorded audio. Can be:`us1`, `us2`, `ie1`, `de1`, `sg1`, `br1`, `au1`, or `jp1`. :param conference_recording_status_callback: The URL we should call using the `conference_recording_status_callback_method` when the conference recording is available. :param conference_recording_status_callback_method: The HTTP method we should use to call `conference_recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. :param recording_status_callback_event: The recording state changes that should generate a call to `recording_status_callback`. Can be: `started`, `in-progress`, `paused`, `resumed`, `stopped`, `completed`, `failed`, and `absent`. Separate multiple values with a space, ex: `'in-progress completed failed'`. @@ -814,7 +814,7 @@ async def create_async( :param recording_status_callback_method: The HTTP method we should use when we call `recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. :param sip_auth_username: The SIP username used for authentication. :param sip_auth_password: The SIP password for authentication. - :param region: The [region](https://support.twilio.com/hc/en-us/articles/223132167-How-global-low-latency-routing-and-region-selection-work-for-conferences-and-Client-calls) where we should mix the recorded audio. Can be:`us1`, `ie1`, `de1`, `sg1`, `br1`, `au1`, or `jp1`. + :param region: The [region](https://support.twilio.com/hc/en-us/articles/223132167-How-global-low-latency-routing-and-region-selection-work-for-conferences-and-Client-calls) where we should mix the recorded audio. Can be:`us1`, `us2`, `ie1`, `de1`, `sg1`, `br1`, `au1`, or `jp1`. :param conference_recording_status_callback: The URL we should call using the `conference_recording_status_callback_method` when the conference recording is available. :param conference_recording_status_callback_method: The HTTP method we should use to call `conference_recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. :param recording_status_callback_event: The recording state changes that should generate a call to `recording_status_callback`. Can be: `started`, `in-progress`, `paused`, `resumed`, `stopped`, `completed`, `failed`, and `absent`. Separate multiple values with a space, ex: `'in-progress completed failed'`. diff --git a/twilio/rest/api/v2010/account/message/__init__.py b/twilio/rest/api/v2010/account/message/__init__.py index f41c1c5ad7..d5369d11ce 100644 --- a/twilio/rest/api/v2010/account/message/__init__.py +++ b/twilio/rest/api/v2010/account/message/__init__.py @@ -62,6 +62,9 @@ class Status(object): PARTIALLY_DELIVERED = "partially_delivered" CANCELED = "canceled" + class TrafficType(object): + FREE = "free" + class UpdateStatus(object): CANCELED = "canceled" @@ -505,6 +508,7 @@ def create( ] = values.unset, smart_encoded: Union[bool, object] = values.unset, persistent_action: Union[List[str], object] = values.unset, + traffic_type: Union["MessageInstance.TrafficType", object] = values.unset, shorten_urls: Union[bool, object] = values.unset, schedule_type: Union["MessageInstance.ScheduleType", object] = values.unset, send_at: Union[datetime, object] = values.unset, @@ -532,6 +536,7 @@ def create( :param address_retention: :param smart_encoded: Whether to detect Unicode characters that have a similar GSM-7 character and replace them. Can be: `true` or `false`. :param persistent_action: Rich actions for non-SMS/MMS channels. Used for [sending location in WhatsApp messages](https://www.twilio.com/docs/whatsapp/message-features#location-messages-with-whatsapp). + :param traffic_type: :param shorten_urls: For Messaging Services with [Link Shortening configured](https://www.twilio.com/docs/messaging/features/link-shortening) only: A Boolean indicating whether or not Twilio should shorten links in the `body` of the Message. Default value is `false`. If `true`, the `messaging_service_sid` parameter must also be provided. :param schedule_type: :param send_at: The time that Twilio will send the message. Must be in ISO 8601 format. @@ -561,6 +566,7 @@ def create( "AddressRetention": address_retention, "SmartEncoded": serialize.boolean_to_string(smart_encoded), "PersistentAction": serialize.map(persistent_action, lambda e: e), + "TrafficType": traffic_type, "ShortenUrls": serialize.boolean_to_string(shorten_urls), "ScheduleType": schedule_type, "SendAt": serialize.iso8601_datetime(send_at), @@ -606,6 +612,7 @@ async def create_async( ] = values.unset, smart_encoded: Union[bool, object] = values.unset, persistent_action: Union[List[str], object] = values.unset, + traffic_type: Union["MessageInstance.TrafficType", object] = values.unset, shorten_urls: Union[bool, object] = values.unset, schedule_type: Union["MessageInstance.ScheduleType", object] = values.unset, send_at: Union[datetime, object] = values.unset, @@ -633,6 +640,7 @@ async def create_async( :param address_retention: :param smart_encoded: Whether to detect Unicode characters that have a similar GSM-7 character and replace them. Can be: `true` or `false`. :param persistent_action: Rich actions for non-SMS/MMS channels. Used for [sending location in WhatsApp messages](https://www.twilio.com/docs/whatsapp/message-features#location-messages-with-whatsapp). + :param traffic_type: :param shorten_urls: For Messaging Services with [Link Shortening configured](https://www.twilio.com/docs/messaging/features/link-shortening) only: A Boolean indicating whether or not Twilio should shorten links in the `body` of the Message. Default value is `false`. If `true`, the `messaging_service_sid` parameter must also be provided. :param schedule_type: :param send_at: The time that Twilio will send the message. Must be in ISO 8601 format. @@ -662,6 +670,7 @@ async def create_async( "AddressRetention": address_retention, "SmartEncoded": serialize.boolean_to_string(smart_encoded), "PersistentAction": serialize.map(persistent_action, lambda e: e), + "TrafficType": traffic_type, "ShortenUrls": serialize.boolean_to_string(shorten_urls), "ScheduleType": schedule_type, "SendAt": serialize.iso8601_datetime(send_at), diff --git a/twilio/rest/flex_api/v2/flex_user.py b/twilio/rest/flex_api/v2/flex_user.py index 480a439b85..eb2228d015 100644 --- a/twilio/rest/flex_api/v2/flex_user.py +++ b/twilio/rest/flex_api/v2/flex_user.py @@ -30,11 +30,8 @@ class FlexUserInstance(InstanceResource): :ivar worker_sid: The unique SID identifier of the worker. :ivar workspace_sid: The unique SID identifier of the workspace. :ivar flex_team_sid: The unique SID identifier of the Flex Team. - :ivar first_name: First name of the User. - :ivar last_name: Last name of the User. :ivar username: Username of the User. :ivar email: Email of the User. - :ivar friendly_name: Friendly name of the User. :ivar locale: The locale preference of the user. :ivar roles: The roles of the user. :ivar created_date: The date that this user was created, given in ISO 8601 format. @@ -59,11 +56,8 @@ def __init__( self.worker_sid: Optional[str] = payload.get("worker_sid") self.workspace_sid: Optional[str] = payload.get("workspace_sid") self.flex_team_sid: Optional[str] = payload.get("flex_team_sid") - self.first_name: Optional[str] = payload.get("first_name") - self.last_name: Optional[str] = payload.get("last_name") self.username: Optional[str] = payload.get("username") self.email: Optional[str] = payload.get("email") - self.friendly_name: Optional[str] = payload.get("friendly_name") self.locale: Optional[str] = payload.get("locale") self.roles: Optional[List[str]] = payload.get("roles") self.created_date: Optional[datetime] = deserialize.iso8601_datetime( @@ -117,60 +111,42 @@ async def fetch_async(self) -> "FlexUserInstance": def update( self, - first_name: Union[str, object] = values.unset, - last_name: Union[str, object] = values.unset, email: Union[str, object] = values.unset, - friendly_name: Union[str, object] = values.unset, user_sid: Union[str, object] = values.unset, locale: Union[str, object] = values.unset, ) -> "FlexUserInstance": """ Update the FlexUserInstance - :param first_name: First name of the User. - :param last_name: Last name of the User. :param email: Email of the User. - :param friendly_name: Friendly name of the User. :param user_sid: The unique SID identifier of the Twilio Unified User. :param locale: The locale preference of the user. :returns: The updated FlexUserInstance """ return self._proxy.update( - first_name=first_name, - last_name=last_name, email=email, - friendly_name=friendly_name, user_sid=user_sid, locale=locale, ) async def update_async( self, - first_name: Union[str, object] = values.unset, - last_name: Union[str, object] = values.unset, email: Union[str, object] = values.unset, - friendly_name: Union[str, object] = values.unset, user_sid: Union[str, object] = values.unset, locale: Union[str, object] = values.unset, ) -> "FlexUserInstance": """ Asynchronous coroutine to update the FlexUserInstance - :param first_name: First name of the User. - :param last_name: Last name of the User. :param email: Email of the User. - :param friendly_name: Friendly name of the User. :param user_sid: The unique SID identifier of the Twilio Unified User. :param locale: The locale preference of the user. :returns: The updated FlexUserInstance """ return await self._proxy.update_async( - first_name=first_name, - last_name=last_name, email=email, - friendly_name=friendly_name, user_sid=user_sid, locale=locale, ) @@ -252,20 +228,14 @@ async def fetch_async(self) -> FlexUserInstance: def update( self, - first_name: Union[str, object] = values.unset, - last_name: Union[str, object] = values.unset, email: Union[str, object] = values.unset, - friendly_name: Union[str, object] = values.unset, user_sid: Union[str, object] = values.unset, locale: Union[str, object] = values.unset, ) -> FlexUserInstance: """ Update the FlexUserInstance - :param first_name: First name of the User. - :param last_name: Last name of the User. :param email: Email of the User. - :param friendly_name: Friendly name of the User. :param user_sid: The unique SID identifier of the Twilio Unified User. :param locale: The locale preference of the user. @@ -274,10 +244,7 @@ def update( data = values.of( { - "FirstName": first_name, - "LastName": last_name, "Email": email, - "FriendlyName": friendly_name, "UserSid": user_sid, "Locale": locale, } @@ -301,20 +268,14 @@ def update( async def update_async( self, - first_name: Union[str, object] = values.unset, - last_name: Union[str, object] = values.unset, email: Union[str, object] = values.unset, - friendly_name: Union[str, object] = values.unset, user_sid: Union[str, object] = values.unset, locale: Union[str, object] = values.unset, ) -> FlexUserInstance: """ Asynchronous coroutine to update the FlexUserInstance - :param first_name: First name of the User. - :param last_name: Last name of the User. :param email: Email of the User. - :param friendly_name: Friendly name of the User. :param user_sid: The unique SID identifier of the Twilio Unified User. :param locale: The locale preference of the user. @@ -323,10 +284,7 @@ async def update_async( data = values.of( { - "FirstName": first_name, - "LastName": last_name, "Email": email, - "FriendlyName": friendly_name, "UserSid": user_sid, "Locale": locale, } diff --git a/twilio/rest/iam/v1/__init__.py b/twilio/rest/iam/v1/__init__.py index 0c46947341..08c45435a6 100644 --- a/twilio/rest/iam/v1/__init__.py +++ b/twilio/rest/iam/v1/__init__.py @@ -18,6 +18,7 @@ from twilio.rest.iam.v1.api_key import ApiKeyList from twilio.rest.iam.v1.get_api_keys import GetApiKeysList from twilio.rest.iam.v1.new_api_key import NewApiKeyList +from twilio.rest.iam.v1.token import TokenList class V1(Version): @@ -32,6 +33,7 @@ def __init__(self, domain: Domain): self._api_key: Optional[ApiKeyList] = None self._get_api_keys: Optional[GetApiKeysList] = None self._new_api_key: Optional[NewApiKeyList] = None + self._token: Optional[TokenList] = None @property def api_key(self) -> ApiKeyList: @@ -51,6 +53,12 @@ def new_api_key(self) -> NewApiKeyList: self._new_api_key = NewApiKeyList(self) return self._new_api_key + @property + def token(self) -> TokenList: + if self._token is None: + self._token = TokenList(self) + return self._token + def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/iam/v1/token.py b/twilio/rest/iam/v1/token.py new file mode 100644 index 0000000000..50d3d11930 --- /dev/null +++ b/twilio/rest/iam/v1/token.py @@ -0,0 +1,170 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Iam + 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, Union +from twilio.base import values + +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class TokenInstance(InstanceResource): + """ + :ivar access_token: Token which carries the necessary information to access a Twilio resource directly. + :ivar refresh_token: Token which carries the information necessary to get a new access token. + :ivar id_token: Token which carries the information necessary of user profile. + :ivar token_type: Token type + :ivar expires_in: + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) + + self.access_token: Optional[str] = payload.get("access_token") + self.refresh_token: Optional[str] = payload.get("refresh_token") + self.id_token: Optional[str] = payload.get("id_token") + self.token_type: Optional[str] = payload.get("token_type") + self.expires_in: Optional[int] = payload.get("expires_in") + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "" + + +class TokenList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the TokenList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/token" + + def create( + self, + grant_type: str, + client_id: str, + client_secret: Union[str, object] = values.unset, + code: Union[str, object] = values.unset, + redirect_uri: Union[str, object] = values.unset, + audience: Union[str, object] = values.unset, + refresh_token: Union[str, object] = values.unset, + scope: Union[str, object] = values.unset, + ) -> TokenInstance: + """ + Create the TokenInstance + + :param grant_type: Grant type is a credential representing resource owner's authorization which can be used by client to obtain access token. + :param client_id: A 34 character string that uniquely identifies this OAuth App. + :param client_secret: The credential for confidential OAuth App. + :param code: JWT token related to the authorization code grant type. + :param redirect_uri: The redirect uri + :param audience: The targeted audience uri + :param refresh_token: JWT token related to refresh access token. + :param scope: The scope of token + + :returns: The created TokenInstance + """ + + data = values.of( + { + "grant_type": grant_type, + "client_id": client_id, + "client_secret": client_secret, + "code": code, + "redirect_uri": redirect_uri, + "audience": audience, + "refresh_token": refresh_token, + "scope": scope, + } + ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return TokenInstance(self._version, payload) + + async def create_async( + self, + grant_type: str, + client_id: str, + client_secret: Union[str, object] = values.unset, + code: Union[str, object] = values.unset, + redirect_uri: Union[str, object] = values.unset, + audience: Union[str, object] = values.unset, + refresh_token: Union[str, object] = values.unset, + scope: Union[str, object] = values.unset, + ) -> TokenInstance: + """ + Asynchronously create the TokenInstance + + :param grant_type: Grant type is a credential representing resource owner's authorization which can be used by client to obtain access token. + :param client_id: A 34 character string that uniquely identifies this OAuth App. + :param client_secret: The credential for confidential OAuth App. + :param code: JWT token related to the authorization code grant type. + :param redirect_uri: The redirect uri + :param audience: The targeted audience uri + :param refresh_token: JWT token related to refresh access token. + :param scope: The scope of token + + :returns: The created TokenInstance + """ + + data = values.of( + { + "grant_type": grant_type, + "client_id": client_id, + "client_secret": client_secret, + "code": code, + "redirect_uri": redirect_uri, + "audience": audience, + "refresh_token": refresh_token, + "scope": scope, + } + ) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return TokenInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/insights/v1/room/__init__.py b/twilio/rest/insights/v1/room/__init__.py index 0b987c020a..6fe0c476b5 100644 --- a/twilio/rest/insights/v1/room/__init__.py +++ b/twilio/rest/insights/v1/room/__init__.py @@ -54,6 +54,8 @@ class EndReason(object): class ProcessingState(object): COMPLETE = "complete" IN_PROGRESS = "in_progress" + TIMEOUT = "timeout" + NOT_STARTED = "not_started" class RoomStatus(object): IN_PROGRESS = "in_progress" @@ -77,7 +79,17 @@ class TwilioRealm(object): DE1 = "de1" GLL = "gll" STAGE_US1 = "stage_us1" + STAGE_US2 = "stage_us2" DEV_US1 = "dev_us1" + DEV_US2 = "dev_us2" + STAGE_DE1 = "stage_de1" + STAGE_IN1 = "stage_in1" + STAGE_IE1 = "stage_ie1" + STAGE_BR1 = "stage_br1" + STAGE_AU1 = "stage_au1" + STAGE_SG1 = "stage_sg1" + STAGE_JP1 = "stage_jp1" + OUTSIDE = "outside" """ :ivar account_sid: Account SID associated with this room. diff --git a/twilio/rest/insights/v1/room/participant.py b/twilio/rest/insights/v1/room/participant.py index 0791ec287c..d0d3e592e0 100644 --- a/twilio/rest/insights/v1/room/participant.py +++ b/twilio/rest/insights/v1/room/participant.py @@ -43,7 +43,9 @@ class EdgeLocation(object): class RoomStatus(object): IN_PROGRESS = "in_progress" + CONNECTED = "connected" COMPLETED = "completed" + DISCONNECTED = "disconnected" class TwilioRealm(object): US1 = "us1" @@ -58,6 +60,16 @@ class TwilioRealm(object): GLL = "gll" STAGE_US1 = "stage_us1" DEV_US1 = "dev_us1" + STAGE_AU1 = "stage_au1" + STAGE_SG1 = "stage_sg1" + STAGE_BR1 = "stage_br1" + STAGE_IN1 = "stage_in1" + STAGE_JP1 = "stage_jp1" + STAGE_DE1 = "stage_de1" + STAGE_IE1 = "stage_ie1" + STAGE_US2 = "stage_us2" + DEV_US2 = "dev_us2" + OUTSIDE = "outside" """ :ivar participant_sid: Unique identifier for the participant. diff --git a/twilio/rest/preview/PreviewBase.py b/twilio/rest/preview/PreviewBase.py index 2b44efaf63..dd8317b4c0 100644 --- a/twilio/rest/preview/PreviewBase.py +++ b/twilio/rest/preview/PreviewBase.py @@ -14,7 +14,6 @@ from twilio.base.domain import Domain from twilio.rest import Client from twilio.rest.preview.hosted_numbers import HostedNumbers -from twilio.rest.preview.sync import Sync from twilio.rest.preview.marketplace import Marketplace from twilio.rest.preview.wireless import Wireless @@ -29,7 +28,6 @@ def __init__(self, twilio: Client): """ super().__init__(twilio, "https://preview.twilio.com") self._hosted_numbers: Optional[HostedNumbers] = None - self._sync: Optional[Sync] = None self._marketplace: Optional[Marketplace] = None self._wireless: Optional[Wireless] = None @@ -42,15 +40,6 @@ def hosted_numbers(self) -> HostedNumbers: self._hosted_numbers = HostedNumbers(self) return self._hosted_numbers - @property - def sync(self) -> Sync: - """ - :returns: Versions sync of Preview - """ - if self._sync is None: - self._sync = Sync(self) - return self._sync - @property def marketplace(self) -> Marketplace: """ diff --git a/twilio/rest/preview/sync/__init__.py b/twilio/rest/preview/sync/__init__.py deleted file mode 100644 index d84c79039b..0000000000 --- a/twilio/rest/preview/sync/__init__.py +++ /dev/null @@ -1,43 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Preview - 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 Optional -from twilio.base.version import Version -from twilio.base.domain import Domain -from twilio.rest.preview.sync.service import ServiceList - - -class Sync(Version): - - def __init__(self, domain: Domain): - """ - Initialize the Sync version of Preview - - :param domain: The Twilio.preview domain - """ - super().__init__(domain, "Sync") - self._services: Optional[ServiceList] = None - - @property - def services(self) -> ServiceList: - if self._services is None: - self._services = ServiceList(self) - return self._services - - def __repr__(self) -> str: - """ - Provide a friendly representation - :returns: Machine friendly representation - """ - return "" diff --git a/twilio/rest/preview/sync/service/__init__.py b/twilio/rest/preview/sync/service/__init__.py deleted file mode 100644 index 7b09429375..0000000000 --- a/twilio/rest/preview/sync/service/__init__.py +++ /dev/null @@ -1,741 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Preview - 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 datetime import datetime -from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, serialize, values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.version import Version -from twilio.base.page import Page -from twilio.rest.preview.sync.service.document import DocumentList -from twilio.rest.preview.sync.service.sync_list import SyncListList -from twilio.rest.preview.sync.service.sync_map import SyncMapList - - -class ServiceInstance(InstanceResource): - """ - :ivar sid: - :ivar account_sid: - :ivar friendly_name: - :ivar date_created: - :ivar date_updated: - :ivar url: - :ivar webhook_url: - :ivar reachability_webhooks_enabled: - :ivar acl_enabled: - :ivar links: - """ - - def __init__( - self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None - ): - super().__init__(version) - - self.sid: Optional[str] = payload.get("sid") - self.account_sid: Optional[str] = payload.get("account_sid") - self.friendly_name: Optional[str] = payload.get("friendly_name") - self.date_created: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("date_created") - ) - self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("date_updated") - ) - self.url: Optional[str] = payload.get("url") - self.webhook_url: Optional[str] = payload.get("webhook_url") - self.reachability_webhooks_enabled: Optional[bool] = payload.get( - "reachability_webhooks_enabled" - ) - self.acl_enabled: Optional[bool] = payload.get("acl_enabled") - self.links: Optional[Dict[str, object]] = payload.get("links") - - self._solution = { - "sid": sid or self.sid, - } - self._context: Optional[ServiceContext] = None - - @property - def _proxy(self) -> "ServiceContext": - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ServiceContext for this ServiceInstance - """ - if self._context is None: - self._context = ServiceContext( - self._version, - sid=self._solution["sid"], - ) - return self._context - - def delete(self) -> bool: - """ - Deletes the ServiceInstance - - - :returns: True if delete succeeds, False otherwise - """ - return self._proxy.delete() - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the ServiceInstance - - - :returns: True if delete succeeds, False otherwise - """ - return await self._proxy.delete_async() - - def fetch(self) -> "ServiceInstance": - """ - Fetch the ServiceInstance - - - :returns: The fetched ServiceInstance - """ - return self._proxy.fetch() - - async def fetch_async(self) -> "ServiceInstance": - """ - Asynchronous coroutine to fetch the ServiceInstance - - - :returns: The fetched ServiceInstance - """ - return await self._proxy.fetch_async() - - def update( - self, - webhook_url: Union[str, object] = values.unset, - friendly_name: Union[str, object] = values.unset, - reachability_webhooks_enabled: Union[bool, object] = values.unset, - acl_enabled: Union[bool, object] = values.unset, - ) -> "ServiceInstance": - """ - Update the ServiceInstance - - :param webhook_url: - :param friendly_name: - :param reachability_webhooks_enabled: - :param acl_enabled: - - :returns: The updated ServiceInstance - """ - return self._proxy.update( - webhook_url=webhook_url, - friendly_name=friendly_name, - reachability_webhooks_enabled=reachability_webhooks_enabled, - acl_enabled=acl_enabled, - ) - - async def update_async( - self, - webhook_url: Union[str, object] = values.unset, - friendly_name: Union[str, object] = values.unset, - reachability_webhooks_enabled: Union[bool, object] = values.unset, - acl_enabled: Union[bool, object] = values.unset, - ) -> "ServiceInstance": - """ - Asynchronous coroutine to update the ServiceInstance - - :param webhook_url: - :param friendly_name: - :param reachability_webhooks_enabled: - :param acl_enabled: - - :returns: The updated ServiceInstance - """ - return await self._proxy.update_async( - webhook_url=webhook_url, - friendly_name=friendly_name, - reachability_webhooks_enabled=reachability_webhooks_enabled, - acl_enabled=acl_enabled, - ) - - @property - def documents(self) -> DocumentList: - """ - Access the documents - """ - return self._proxy.documents - - @property - def sync_lists(self) -> SyncListList: - """ - Access the sync_lists - """ - return self._proxy.sync_lists - - @property - def sync_maps(self) -> SyncMapList: - """ - Access the sync_maps - """ - return self._proxy.sync_maps - - 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 ServiceContext(InstanceContext): - - def __init__(self, version: Version, sid: str): - """ - Initialize the ServiceContext - - :param version: Version that contains the resource - :param sid: - """ - super().__init__(version) - - # Path Solution - self._solution = { - "sid": sid, - } - self._uri = "/Services/{sid}".format(**self._solution) - - self._documents: Optional[DocumentList] = None - self._sync_lists: Optional[SyncListList] = None - self._sync_maps: Optional[SyncMapList] = None - - def delete(self) -> bool: - """ - Deletes the ServiceInstance - - - :returns: True if delete succeeds, False otherwise - """ - - headers = values.of({}) - - return self._version.delete(method="DELETE", uri=self._uri, headers=headers) - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the ServiceInstance - - - :returns: True if delete succeeds, False otherwise - """ - - headers = values.of({}) - - return await self._version.delete_async( - method="DELETE", uri=self._uri, headers=headers - ) - - def fetch(self) -> ServiceInstance: - """ - Fetch the ServiceInstance - - - :returns: The fetched ServiceInstance - """ - - headers = values.of({}) - - headers["Accept"] = "application/json" - - payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) - - return ServiceInstance( - self._version, - payload, - sid=self._solution["sid"], - ) - - async def fetch_async(self) -> ServiceInstance: - """ - Asynchronous coroutine to fetch the ServiceInstance - - - :returns: The fetched ServiceInstance - """ - - headers = values.of({}) - - headers["Accept"] = "application/json" - - payload = await self._version.fetch_async( - method="GET", uri=self._uri, headers=headers - ) - - return ServiceInstance( - self._version, - payload, - sid=self._solution["sid"], - ) - - def update( - self, - webhook_url: Union[str, object] = values.unset, - friendly_name: Union[str, object] = values.unset, - reachability_webhooks_enabled: Union[bool, object] = values.unset, - acl_enabled: Union[bool, object] = values.unset, - ) -> ServiceInstance: - """ - Update the ServiceInstance - - :param webhook_url: - :param friendly_name: - :param reachability_webhooks_enabled: - :param acl_enabled: - - :returns: The updated ServiceInstance - """ - - data = values.of( - { - "WebhookUrl": webhook_url, - "FriendlyName": friendly_name, - "ReachabilityWebhooksEnabled": serialize.boolean_to_string( - reachability_webhooks_enabled - ), - "AclEnabled": serialize.boolean_to_string(acl_enabled), - } - ) - headers = values.of({}) - - headers["Content-Type"] = "application/x-www-form-urlencoded" - - headers["Accept"] = "application/json" - - payload = self._version.update( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return ServiceInstance(self._version, payload, sid=self._solution["sid"]) - - async def update_async( - self, - webhook_url: Union[str, object] = values.unset, - friendly_name: Union[str, object] = values.unset, - reachability_webhooks_enabled: Union[bool, object] = values.unset, - acl_enabled: Union[bool, object] = values.unset, - ) -> ServiceInstance: - """ - Asynchronous coroutine to update the ServiceInstance - - :param webhook_url: - :param friendly_name: - :param reachability_webhooks_enabled: - :param acl_enabled: - - :returns: The updated ServiceInstance - """ - - data = values.of( - { - "WebhookUrl": webhook_url, - "FriendlyName": friendly_name, - "ReachabilityWebhooksEnabled": serialize.boolean_to_string( - reachability_webhooks_enabled - ), - "AclEnabled": serialize.boolean_to_string(acl_enabled), - } - ) - headers = values.of({}) - - headers["Content-Type"] = "application/x-www-form-urlencoded" - - headers["Accept"] = "application/json" - - payload = await self._version.update_async( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return ServiceInstance(self._version, payload, sid=self._solution["sid"]) - - @property - def documents(self) -> DocumentList: - """ - Access the documents - """ - if self._documents is None: - self._documents = DocumentList( - self._version, - self._solution["sid"], - ) - return self._documents - - @property - def sync_lists(self) -> SyncListList: - """ - Access the sync_lists - """ - if self._sync_lists is None: - self._sync_lists = SyncListList( - self._version, - self._solution["sid"], - ) - return self._sync_lists - - @property - def sync_maps(self) -> SyncMapList: - """ - Access the sync_maps - """ - if self._sync_maps is None: - self._sync_maps = SyncMapList( - self._version, - self._solution["sid"], - ) - return self._sync_maps - - 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 ServicePage(Page): - - def get_instance(self, payload: Dict[str, Any]) -> ServiceInstance: - """ - Build an instance of ServiceInstance - - :param payload: Payload response from the API - """ - return ServiceInstance(self._version, payload) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" - - -class ServiceList(ListResource): - - def __init__(self, version: Version): - """ - Initialize the ServiceList - - :param version: Version that contains the resource - - """ - super().__init__(version) - - self._uri = "/Services" - - def create( - self, - friendly_name: Union[str, object] = values.unset, - webhook_url: Union[str, object] = values.unset, - reachability_webhooks_enabled: Union[bool, object] = values.unset, - acl_enabled: Union[bool, object] = values.unset, - ) -> ServiceInstance: - """ - Create the ServiceInstance - - :param friendly_name: - :param webhook_url: - :param reachability_webhooks_enabled: - :param acl_enabled: - - :returns: The created ServiceInstance - """ - - data = values.of( - { - "FriendlyName": friendly_name, - "WebhookUrl": webhook_url, - "ReachabilityWebhooksEnabled": serialize.boolean_to_string( - reachability_webhooks_enabled - ), - "AclEnabled": serialize.boolean_to_string(acl_enabled), - } - ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Content-Type"] = "application/x-www-form-urlencoded" - - headers["Accept"] = "application/json" - - payload = self._version.create( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return ServiceInstance(self._version, payload) - - async def create_async( - self, - friendly_name: Union[str, object] = values.unset, - webhook_url: Union[str, object] = values.unset, - reachability_webhooks_enabled: Union[bool, object] = values.unset, - acl_enabled: Union[bool, object] = values.unset, - ) -> ServiceInstance: - """ - Asynchronously create the ServiceInstance - - :param friendly_name: - :param webhook_url: - :param reachability_webhooks_enabled: - :param acl_enabled: - - :returns: The created ServiceInstance - """ - - data = values.of( - { - "FriendlyName": friendly_name, - "WebhookUrl": webhook_url, - "ReachabilityWebhooksEnabled": serialize.boolean_to_string( - reachability_webhooks_enabled - ), - "AclEnabled": serialize.boolean_to_string(acl_enabled), - } - ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Content-Type"] = "application/x-www-form-urlencoded" - - headers["Accept"] = "application/json" - - payload = await self._version.create_async( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return ServiceInstance(self._version, payload) - - def stream( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> Iterator[ServiceInstance]: - """ - Streams ServiceInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - """ - limits = self._version.read_limits(limit, page_size) - page = self.page(page_size=limits["page_size"]) - - return self._version.stream(page, limits["limit"]) - - async def stream_async( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> AsyncIterator[ServiceInstance]: - """ - Asynchronously streams ServiceInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - """ - limits = self._version.read_limits(limit, page_size) - page = await self.page_async(page_size=limits["page_size"]) - - return self._version.stream_async(page, limits["limit"]) - - def list( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[ServiceInstance]: - """ - Lists ServiceInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: list that will contain up to limit results - """ - return list( - self.stream( - limit=limit, - page_size=page_size, - ) - ) - - async def list_async( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[ServiceInstance]: - """ - Asynchronously lists ServiceInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: list that will contain up to limit results - """ - return [ - record - async for record in await self.stream_async( - limit=limit, - page_size=page_size, - ) - ] - - def page( - self, - page_token: Union[str, object] = values.unset, - page_number: Union[int, object] = values.unset, - page_size: Union[int, object] = values.unset, - ) -> ServicePage: - """ - Retrieve a single page of ServiceInstance records from the API. - Request is executed immediately - - :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 - - :returns: Page of ServiceInstance - """ - data = values.of( - { - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Accept"] = "application/json" - - response = self._version.page( - method="GET", uri=self._uri, params=data, headers=headers - ) - return ServicePage(self._version, response) - - async def page_async( - self, - page_token: Union[str, object] = values.unset, - page_number: Union[int, object] = values.unset, - page_size: Union[int, object] = values.unset, - ) -> ServicePage: - """ - Asynchronously retrieve a single page of ServiceInstance records from the API. - Request is executed immediately - - :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 - - :returns: Page of ServiceInstance - """ - data = values.of( - { - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Accept"] = "application/json" - - response = await self._version.page_async( - method="GET", uri=self._uri, params=data, headers=headers - ) - return ServicePage(self._version, response) - - def get_page(self, target_url: str) -> ServicePage: - """ - Retrieve a specific page of ServiceInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of ServiceInstance - """ - response = self._version.domain.twilio.request("GET", target_url) - return ServicePage(self._version, response) - - async def get_page_async(self, target_url: str) -> ServicePage: - """ - Asynchronously retrieve a specific page of ServiceInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of ServiceInstance - """ - response = await self._version.domain.twilio.request_async("GET", target_url) - return ServicePage(self._version, response) - - def get(self, sid: str) -> ServiceContext: - """ - Constructs a ServiceContext - - :param sid: - """ - return ServiceContext(self._version, sid=sid) - - def __call__(self, sid: str) -> ServiceContext: - """ - Constructs a ServiceContext - - :param sid: - """ - return ServiceContext(self._version, sid=sid) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" diff --git a/twilio/rest/preview/sync/service/document/__init__.py b/twilio/rest/preview/sync/service/document/__init__.py deleted file mode 100644 index ee55186ca4..0000000000 --- a/twilio/rest/preview/sync/service/document/__init__.py +++ /dev/null @@ -1,693 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Preview - 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 datetime import datetime -from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, serialize, values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.version import Version -from twilio.base.page import Page -from twilio.rest.preview.sync.service.document.document_permission import ( - DocumentPermissionList, -) - - -class DocumentInstance(InstanceResource): - """ - :ivar sid: - :ivar unique_name: - :ivar account_sid: - :ivar service_sid: - :ivar url: - :ivar links: - :ivar revision: - :ivar data: - :ivar date_created: - :ivar date_updated: - :ivar created_by: - """ - - def __init__( - self, - version: Version, - payload: Dict[str, Any], - service_sid: str, - sid: Optional[str] = None, - ): - super().__init__(version) - - self.sid: Optional[str] = payload.get("sid") - self.unique_name: Optional[str] = payload.get("unique_name") - self.account_sid: Optional[str] = payload.get("account_sid") - self.service_sid: Optional[str] = payload.get("service_sid") - self.url: Optional[str] = payload.get("url") - self.links: Optional[Dict[str, object]] = payload.get("links") - self.revision: Optional[str] = payload.get("revision") - self.data: Optional[Dict[str, object]] = payload.get("data") - self.date_created: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("date_created") - ) - self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("date_updated") - ) - self.created_by: Optional[str] = payload.get("created_by") - - self._solution = { - "service_sid": service_sid, - "sid": sid or self.sid, - } - self._context: Optional[DocumentContext] = None - - @property - def _proxy(self) -> "DocumentContext": - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: DocumentContext for this DocumentInstance - """ - if self._context is None: - self._context = DocumentContext( - self._version, - service_sid=self._solution["service_sid"], - sid=self._solution["sid"], - ) - return self._context - - def delete(self) -> bool: - """ - Deletes the DocumentInstance - - - :returns: True if delete succeeds, False otherwise - """ - return self._proxy.delete() - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the DocumentInstance - - - :returns: True if delete succeeds, False otherwise - """ - return await self._proxy.delete_async() - - def fetch(self) -> "DocumentInstance": - """ - Fetch the DocumentInstance - - - :returns: The fetched DocumentInstance - """ - return self._proxy.fetch() - - async def fetch_async(self) -> "DocumentInstance": - """ - Asynchronous coroutine to fetch the DocumentInstance - - - :returns: The fetched DocumentInstance - """ - return await self._proxy.fetch_async() - - def update( - self, data: object, if_match: Union[str, object] = values.unset - ) -> "DocumentInstance": - """ - Update the DocumentInstance - - :param data: - :param if_match: The If-Match HTTP request header - - :returns: The updated DocumentInstance - """ - return self._proxy.update( - data=data, - if_match=if_match, - ) - - async def update_async( - self, data: object, if_match: Union[str, object] = values.unset - ) -> "DocumentInstance": - """ - Asynchronous coroutine to update the DocumentInstance - - :param data: - :param if_match: The If-Match HTTP request header - - :returns: The updated DocumentInstance - """ - return await self._proxy.update_async( - data=data, - if_match=if_match, - ) - - @property - def document_permissions(self) -> DocumentPermissionList: - """ - Access the document_permissions - """ - return self._proxy.document_permissions - - 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 DocumentContext(InstanceContext): - - def __init__(self, version: Version, service_sid: str, sid: str): - """ - Initialize the DocumentContext - - :param version: Version that contains the resource - :param service_sid: - :param sid: - """ - super().__init__(version) - - # Path Solution - self._solution = { - "service_sid": service_sid, - "sid": sid, - } - self._uri = "/Services/{service_sid}/Documents/{sid}".format(**self._solution) - - self._document_permissions: Optional[DocumentPermissionList] = None - - def delete(self) -> bool: - """ - Deletes the DocumentInstance - - - :returns: True if delete succeeds, False otherwise - """ - - headers = values.of({}) - - return self._version.delete(method="DELETE", uri=self._uri, headers=headers) - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the DocumentInstance - - - :returns: True if delete succeeds, False otherwise - """ - - headers = values.of({}) - - return await self._version.delete_async( - method="DELETE", uri=self._uri, headers=headers - ) - - def fetch(self) -> DocumentInstance: - """ - Fetch the DocumentInstance - - - :returns: The fetched DocumentInstance - """ - - headers = values.of({}) - - headers["Accept"] = "application/json" - - payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) - - return DocumentInstance( - self._version, - payload, - service_sid=self._solution["service_sid"], - sid=self._solution["sid"], - ) - - async def fetch_async(self) -> DocumentInstance: - """ - Asynchronous coroutine to fetch the DocumentInstance - - - :returns: The fetched DocumentInstance - """ - - headers = values.of({}) - - headers["Accept"] = "application/json" - - payload = await self._version.fetch_async( - method="GET", uri=self._uri, headers=headers - ) - - return DocumentInstance( - self._version, - payload, - service_sid=self._solution["service_sid"], - sid=self._solution["sid"], - ) - - def update( - self, data: object, if_match: Union[str, object] = values.unset - ) -> DocumentInstance: - """ - Update the DocumentInstance - - :param data: - :param if_match: The If-Match HTTP request header - - :returns: The updated DocumentInstance - """ - - data = values.of( - { - "Data": serialize.object(data), - } - ) - headers = values.of({}) - - if not ( - if_match is values.unset or (isinstance(if_match, str) and not if_match) - ): - headers["If-Match"] = if_match - - headers["Content-Type"] = "application/x-www-form-urlencoded" - - headers["Accept"] = "application/json" - - payload = self._version.update( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return DocumentInstance( - self._version, - payload, - service_sid=self._solution["service_sid"], - sid=self._solution["sid"], - ) - - async def update_async( - self, data: object, if_match: Union[str, object] = values.unset - ) -> DocumentInstance: - """ - Asynchronous coroutine to update the DocumentInstance - - :param data: - :param if_match: The If-Match HTTP request header - - :returns: The updated DocumentInstance - """ - - data = values.of( - { - "Data": serialize.object(data), - } - ) - headers = values.of({}) - - if not ( - if_match is values.unset or (isinstance(if_match, str) and not if_match) - ): - headers["If-Match"] = if_match - - headers["Content-Type"] = "application/x-www-form-urlencoded" - - headers["Accept"] = "application/json" - - payload = await self._version.update_async( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return DocumentInstance( - self._version, - payload, - service_sid=self._solution["service_sid"], - sid=self._solution["sid"], - ) - - @property - def document_permissions(self) -> DocumentPermissionList: - """ - Access the document_permissions - """ - if self._document_permissions is None: - self._document_permissions = DocumentPermissionList( - self._version, - self._solution["service_sid"], - self._solution["sid"], - ) - return self._document_permissions - - 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 DocumentPage(Page): - - def get_instance(self, payload: Dict[str, Any]) -> DocumentInstance: - """ - Build an instance of DocumentInstance - - :param payload: Payload response from the API - """ - return DocumentInstance( - self._version, payload, service_sid=self._solution["service_sid"] - ) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" - - -class DocumentList(ListResource): - - def __init__(self, version: Version, service_sid: str): - """ - Initialize the DocumentList - - :param version: Version that contains the resource - :param service_sid: - - """ - super().__init__(version) - - # Path Solution - self._solution = { - "service_sid": service_sid, - } - self._uri = "/Services/{service_sid}/Documents".format(**self._solution) - - def create( - self, - unique_name: Union[str, object] = values.unset, - data: Union[object, object] = values.unset, - ) -> DocumentInstance: - """ - Create the DocumentInstance - - :param unique_name: - :param data: - - :returns: The created DocumentInstance - """ - - data = values.of( - { - "UniqueName": unique_name, - "Data": serialize.object(data), - } - ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Content-Type"] = "application/x-www-form-urlencoded" - - headers["Accept"] = "application/json" - - payload = self._version.create( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return DocumentInstance( - self._version, payload, service_sid=self._solution["service_sid"] - ) - - async def create_async( - self, - unique_name: Union[str, object] = values.unset, - data: Union[object, object] = values.unset, - ) -> DocumentInstance: - """ - Asynchronously create the DocumentInstance - - :param unique_name: - :param data: - - :returns: The created DocumentInstance - """ - - data = values.of( - { - "UniqueName": unique_name, - "Data": serialize.object(data), - } - ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Content-Type"] = "application/x-www-form-urlencoded" - - headers["Accept"] = "application/json" - - payload = await self._version.create_async( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return DocumentInstance( - self._version, payload, service_sid=self._solution["service_sid"] - ) - - def stream( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> Iterator[DocumentInstance]: - """ - Streams DocumentInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - """ - limits = self._version.read_limits(limit, page_size) - page = self.page(page_size=limits["page_size"]) - - return self._version.stream(page, limits["limit"]) - - async def stream_async( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> AsyncIterator[DocumentInstance]: - """ - Asynchronously streams DocumentInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - """ - limits = self._version.read_limits(limit, page_size) - page = await self.page_async(page_size=limits["page_size"]) - - return self._version.stream_async(page, limits["limit"]) - - def list( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[DocumentInstance]: - """ - Lists DocumentInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: list that will contain up to limit results - """ - return list( - self.stream( - limit=limit, - page_size=page_size, - ) - ) - - async def list_async( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[DocumentInstance]: - """ - Asynchronously lists DocumentInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: list that will contain up to limit results - """ - return [ - record - async for record in await self.stream_async( - limit=limit, - page_size=page_size, - ) - ] - - def page( - self, - page_token: Union[str, object] = values.unset, - page_number: Union[int, object] = values.unset, - page_size: Union[int, object] = values.unset, - ) -> DocumentPage: - """ - Retrieve a single page of DocumentInstance records from the API. - Request is executed immediately - - :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 - - :returns: Page of DocumentInstance - """ - data = values.of( - { - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Accept"] = "application/json" - - response = self._version.page( - method="GET", uri=self._uri, params=data, headers=headers - ) - return DocumentPage(self._version, response, self._solution) - - async def page_async( - self, - page_token: Union[str, object] = values.unset, - page_number: Union[int, object] = values.unset, - page_size: Union[int, object] = values.unset, - ) -> DocumentPage: - """ - Asynchronously retrieve a single page of DocumentInstance records from the API. - Request is executed immediately - - :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 - - :returns: Page of DocumentInstance - """ - data = values.of( - { - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Accept"] = "application/json" - - response = await self._version.page_async( - method="GET", uri=self._uri, params=data, headers=headers - ) - return DocumentPage(self._version, response, self._solution) - - def get_page(self, target_url: str) -> DocumentPage: - """ - Retrieve a specific page of DocumentInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of DocumentInstance - """ - response = self._version.domain.twilio.request("GET", target_url) - return DocumentPage(self._version, response, self._solution) - - async def get_page_async(self, target_url: str) -> DocumentPage: - """ - Asynchronously retrieve a specific page of DocumentInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of DocumentInstance - """ - response = await self._version.domain.twilio.request_async("GET", target_url) - return DocumentPage(self._version, response, self._solution) - - def get(self, sid: str) -> DocumentContext: - """ - Constructs a DocumentContext - - :param sid: - """ - return DocumentContext( - self._version, service_sid=self._solution["service_sid"], sid=sid - ) - - def __call__(self, sid: str) -> DocumentContext: - """ - Constructs a DocumentContext - - :param sid: - """ - return DocumentContext( - self._version, service_sid=self._solution["service_sid"], sid=sid - ) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" diff --git a/twilio/rest/preview/sync/service/document/document_permission.py b/twilio/rest/preview/sync/service/document/document_permission.py deleted file mode 100644 index 676efb569f..0000000000 --- a/twilio/rest/preview/sync/service/document/document_permission.py +++ /dev/null @@ -1,617 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Preview - 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, Union, Iterator, AsyncIterator -from twilio.base import serialize, values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.version import Version -from twilio.base.page import Page - - -class DocumentPermissionInstance(InstanceResource): - """ - :ivar account_sid: The unique SID identifier of the Twilio Account. - :ivar service_sid: The unique SID identifier of the Sync Service Instance. - :ivar document_sid: The unique SID identifier of the Sync Document to which the Permission applies. - :ivar identity: Arbitrary string identifier representing a human user associated with an FPA token, assigned by the developer. - :ivar read: Boolean flag specifying whether the identity can read the Sync Document. - :ivar write: Boolean flag specifying whether the identity can update the Sync Document. - :ivar manage: Boolean flag specifying whether the identity can delete the Sync Document. - :ivar url: Contains an absolute URL for this Sync Document Permission. - """ - - def __init__( - self, - version: Version, - payload: Dict[str, Any], - service_sid: str, - document_sid: str, - identity: Optional[str] = None, - ): - super().__init__(version) - - self.account_sid: Optional[str] = payload.get("account_sid") - self.service_sid: Optional[str] = payload.get("service_sid") - self.document_sid: Optional[str] = payload.get("document_sid") - self.identity: Optional[str] = payload.get("identity") - self.read: Optional[bool] = payload.get("read") - self.write: Optional[bool] = payload.get("write") - self.manage: Optional[bool] = payload.get("manage") - self.url: Optional[str] = payload.get("url") - - self._solution = { - "service_sid": service_sid, - "document_sid": document_sid, - "identity": identity or self.identity, - } - self._context: Optional[DocumentPermissionContext] = None - - @property - def _proxy(self) -> "DocumentPermissionContext": - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: DocumentPermissionContext for this DocumentPermissionInstance - """ - if self._context is None: - self._context = DocumentPermissionContext( - self._version, - service_sid=self._solution["service_sid"], - document_sid=self._solution["document_sid"], - identity=self._solution["identity"], - ) - return self._context - - def delete(self) -> bool: - """ - Deletes the DocumentPermissionInstance - - - :returns: True if delete succeeds, False otherwise - """ - return self._proxy.delete() - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the DocumentPermissionInstance - - - :returns: True if delete succeeds, False otherwise - """ - return await self._proxy.delete_async() - - def fetch(self) -> "DocumentPermissionInstance": - """ - Fetch the DocumentPermissionInstance - - - :returns: The fetched DocumentPermissionInstance - """ - return self._proxy.fetch() - - async def fetch_async(self) -> "DocumentPermissionInstance": - """ - Asynchronous coroutine to fetch the DocumentPermissionInstance - - - :returns: The fetched DocumentPermissionInstance - """ - return await self._proxy.fetch_async() - - def update( - self, read: bool, write: bool, manage: bool - ) -> "DocumentPermissionInstance": - """ - Update the DocumentPermissionInstance - - :param read: Boolean flag specifying whether the identity can read the Sync Document. - :param write: Boolean flag specifying whether the identity can update the Sync Document. - :param manage: Boolean flag specifying whether the identity can delete the Sync Document. - - :returns: The updated DocumentPermissionInstance - """ - return self._proxy.update( - read=read, - write=write, - manage=manage, - ) - - async def update_async( - self, read: bool, write: bool, manage: bool - ) -> "DocumentPermissionInstance": - """ - Asynchronous coroutine to update the DocumentPermissionInstance - - :param read: Boolean flag specifying whether the identity can read the Sync Document. - :param write: Boolean flag specifying whether the identity can update the Sync Document. - :param manage: Boolean flag specifying whether the identity can delete the Sync Document. - - :returns: The updated DocumentPermissionInstance - """ - return await self._proxy.update_async( - read=read, - write=write, - manage=manage, - ) - - 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 DocumentPermissionContext(InstanceContext): - - def __init__( - self, version: Version, service_sid: str, document_sid: str, identity: str - ): - """ - Initialize the DocumentPermissionContext - - :param version: Version that contains the resource - :param service_sid: The unique SID identifier of the Sync Service Instance. - :param document_sid: Identifier of the Sync Document. Either a SID or a unique name. - :param identity: Arbitrary string identifier representing a human user associated with an FPA token, assigned by the developer. - """ - super().__init__(version) - - # Path Solution - self._solution = { - "service_sid": service_sid, - "document_sid": document_sid, - "identity": identity, - } - self._uri = "/Services/{service_sid}/Documents/{document_sid}/Permissions/{identity}".format( - **self._solution - ) - - def delete(self) -> bool: - """ - Deletes the DocumentPermissionInstance - - - :returns: True if delete succeeds, False otherwise - """ - - headers = values.of({}) - - return self._version.delete(method="DELETE", uri=self._uri, headers=headers) - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the DocumentPermissionInstance - - - :returns: True if delete succeeds, False otherwise - """ - - headers = values.of({}) - - return await self._version.delete_async( - method="DELETE", uri=self._uri, headers=headers - ) - - def fetch(self) -> DocumentPermissionInstance: - """ - Fetch the DocumentPermissionInstance - - - :returns: The fetched DocumentPermissionInstance - """ - - headers = values.of({}) - - headers["Accept"] = "application/json" - - payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) - - return DocumentPermissionInstance( - self._version, - payload, - service_sid=self._solution["service_sid"], - document_sid=self._solution["document_sid"], - identity=self._solution["identity"], - ) - - async def fetch_async(self) -> DocumentPermissionInstance: - """ - Asynchronous coroutine to fetch the DocumentPermissionInstance - - - :returns: The fetched DocumentPermissionInstance - """ - - headers = values.of({}) - - headers["Accept"] = "application/json" - - payload = await self._version.fetch_async( - method="GET", uri=self._uri, headers=headers - ) - - return DocumentPermissionInstance( - self._version, - payload, - service_sid=self._solution["service_sid"], - document_sid=self._solution["document_sid"], - identity=self._solution["identity"], - ) - - def update( - self, read: bool, write: bool, manage: bool - ) -> DocumentPermissionInstance: - """ - Update the DocumentPermissionInstance - - :param read: Boolean flag specifying whether the identity can read the Sync Document. - :param write: Boolean flag specifying whether the identity can update the Sync Document. - :param manage: Boolean flag specifying whether the identity can delete the Sync Document. - - :returns: The updated DocumentPermissionInstance - """ - - data = values.of( - { - "Read": serialize.boolean_to_string(read), - "Write": serialize.boolean_to_string(write), - "Manage": serialize.boolean_to_string(manage), - } - ) - headers = values.of({}) - - headers["Content-Type"] = "application/x-www-form-urlencoded" - - headers["Accept"] = "application/json" - - payload = self._version.update( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return DocumentPermissionInstance( - self._version, - payload, - service_sid=self._solution["service_sid"], - document_sid=self._solution["document_sid"], - identity=self._solution["identity"], - ) - - async def update_async( - self, read: bool, write: bool, manage: bool - ) -> DocumentPermissionInstance: - """ - Asynchronous coroutine to update the DocumentPermissionInstance - - :param read: Boolean flag specifying whether the identity can read the Sync Document. - :param write: Boolean flag specifying whether the identity can update the Sync Document. - :param manage: Boolean flag specifying whether the identity can delete the Sync Document. - - :returns: The updated DocumentPermissionInstance - """ - - data = values.of( - { - "Read": serialize.boolean_to_string(read), - "Write": serialize.boolean_to_string(write), - "Manage": serialize.boolean_to_string(manage), - } - ) - headers = values.of({}) - - headers["Content-Type"] = "application/x-www-form-urlencoded" - - headers["Accept"] = "application/json" - - payload = await self._version.update_async( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return DocumentPermissionInstance( - self._version, - payload, - service_sid=self._solution["service_sid"], - document_sid=self._solution["document_sid"], - identity=self._solution["identity"], - ) - - 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 DocumentPermissionPage(Page): - - def get_instance(self, payload: Dict[str, Any]) -> DocumentPermissionInstance: - """ - Build an instance of DocumentPermissionInstance - - :param payload: Payload response from the API - """ - return DocumentPermissionInstance( - self._version, - payload, - service_sid=self._solution["service_sid"], - document_sid=self._solution["document_sid"], - ) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" - - -class DocumentPermissionList(ListResource): - - def __init__(self, version: Version, service_sid: str, document_sid: str): - """ - Initialize the DocumentPermissionList - - :param version: Version that contains the resource - :param service_sid: - :param document_sid: Identifier of the Sync Document. Either a SID or a unique name. - - """ - super().__init__(version) - - # Path Solution - self._solution = { - "service_sid": service_sid, - "document_sid": document_sid, - } - self._uri = ( - "/Services/{service_sid}/Documents/{document_sid}/Permissions".format( - **self._solution - ) - ) - - def stream( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> Iterator[DocumentPermissionInstance]: - """ - Streams DocumentPermissionInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - """ - limits = self._version.read_limits(limit, page_size) - page = self.page(page_size=limits["page_size"]) - - return self._version.stream(page, limits["limit"]) - - async def stream_async( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> AsyncIterator[DocumentPermissionInstance]: - """ - Asynchronously streams DocumentPermissionInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - """ - limits = self._version.read_limits(limit, page_size) - page = await self.page_async(page_size=limits["page_size"]) - - return self._version.stream_async(page, limits["limit"]) - - def list( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[DocumentPermissionInstance]: - """ - Lists DocumentPermissionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: list that will contain up to limit results - """ - return list( - self.stream( - limit=limit, - page_size=page_size, - ) - ) - - async def list_async( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[DocumentPermissionInstance]: - """ - Asynchronously lists DocumentPermissionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: list that will contain up to limit results - """ - return [ - record - async for record in await self.stream_async( - limit=limit, - page_size=page_size, - ) - ] - - def page( - self, - page_token: Union[str, object] = values.unset, - page_number: Union[int, object] = values.unset, - page_size: Union[int, object] = values.unset, - ) -> DocumentPermissionPage: - """ - Retrieve a single page of DocumentPermissionInstance records from the API. - Request is executed immediately - - :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 - - :returns: Page of DocumentPermissionInstance - """ - data = values.of( - { - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Accept"] = "application/json" - - response = self._version.page( - method="GET", uri=self._uri, params=data, headers=headers - ) - return DocumentPermissionPage(self._version, response, self._solution) - - async def page_async( - self, - page_token: Union[str, object] = values.unset, - page_number: Union[int, object] = values.unset, - page_size: Union[int, object] = values.unset, - ) -> DocumentPermissionPage: - """ - Asynchronously retrieve a single page of DocumentPermissionInstance records from the API. - Request is executed immediately - - :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 - - :returns: Page of DocumentPermissionInstance - """ - data = values.of( - { - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Accept"] = "application/json" - - response = await self._version.page_async( - method="GET", uri=self._uri, params=data, headers=headers - ) - return DocumentPermissionPage(self._version, response, self._solution) - - def get_page(self, target_url: str) -> DocumentPermissionPage: - """ - Retrieve a specific page of DocumentPermissionInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of DocumentPermissionInstance - """ - response = self._version.domain.twilio.request("GET", target_url) - return DocumentPermissionPage(self._version, response, self._solution) - - async def get_page_async(self, target_url: str) -> DocumentPermissionPage: - """ - Asynchronously retrieve a specific page of DocumentPermissionInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of DocumentPermissionInstance - """ - response = await self._version.domain.twilio.request_async("GET", target_url) - return DocumentPermissionPage(self._version, response, self._solution) - - def get(self, identity: str) -> DocumentPermissionContext: - """ - Constructs a DocumentPermissionContext - - :param identity: Arbitrary string identifier representing a human user associated with an FPA token, assigned by the developer. - """ - return DocumentPermissionContext( - self._version, - service_sid=self._solution["service_sid"], - document_sid=self._solution["document_sid"], - identity=identity, - ) - - def __call__(self, identity: str) -> DocumentPermissionContext: - """ - Constructs a DocumentPermissionContext - - :param identity: Arbitrary string identifier representing a human user associated with an FPA token, assigned by the developer. - """ - return DocumentPermissionContext( - self._version, - service_sid=self._solution["service_sid"], - document_sid=self._solution["document_sid"], - identity=identity, - ) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" diff --git a/twilio/rest/preview/sync/service/sync_list/__init__.py b/twilio/rest/preview/sync/service/sync_list/__init__.py deleted file mode 100644 index 0461f22430..0000000000 --- a/twilio/rest/preview/sync/service/sync_list/__init__.py +++ /dev/null @@ -1,595 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Preview - 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 datetime import datetime -from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.version import Version -from twilio.base.page import Page -from twilio.rest.preview.sync.service.sync_list.sync_list_item import SyncListItemList -from twilio.rest.preview.sync.service.sync_list.sync_list_permission import ( - SyncListPermissionList, -) - - -class SyncListInstance(InstanceResource): - """ - :ivar sid: - :ivar unique_name: - :ivar account_sid: - :ivar service_sid: - :ivar url: - :ivar links: - :ivar revision: - :ivar date_created: - :ivar date_updated: - :ivar created_by: - """ - - def __init__( - self, - version: Version, - payload: Dict[str, Any], - service_sid: str, - sid: Optional[str] = None, - ): - super().__init__(version) - - self.sid: Optional[str] = payload.get("sid") - self.unique_name: Optional[str] = payload.get("unique_name") - self.account_sid: Optional[str] = payload.get("account_sid") - self.service_sid: Optional[str] = payload.get("service_sid") - self.url: Optional[str] = payload.get("url") - self.links: Optional[Dict[str, object]] = payload.get("links") - self.revision: Optional[str] = payload.get("revision") - self.date_created: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("date_created") - ) - self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("date_updated") - ) - self.created_by: Optional[str] = payload.get("created_by") - - self._solution = { - "service_sid": service_sid, - "sid": sid or self.sid, - } - self._context: Optional[SyncListContext] = None - - @property - def _proxy(self) -> "SyncListContext": - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SyncListContext for this SyncListInstance - """ - if self._context is None: - self._context = SyncListContext( - self._version, - service_sid=self._solution["service_sid"], - sid=self._solution["sid"], - ) - return self._context - - def delete(self) -> bool: - """ - Deletes the SyncListInstance - - - :returns: True if delete succeeds, False otherwise - """ - return self._proxy.delete() - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the SyncListInstance - - - :returns: True if delete succeeds, False otherwise - """ - return await self._proxy.delete_async() - - def fetch(self) -> "SyncListInstance": - """ - Fetch the SyncListInstance - - - :returns: The fetched SyncListInstance - """ - return self._proxy.fetch() - - async def fetch_async(self) -> "SyncListInstance": - """ - Asynchronous coroutine to fetch the SyncListInstance - - - :returns: The fetched SyncListInstance - """ - return await self._proxy.fetch_async() - - @property - def sync_list_items(self) -> SyncListItemList: - """ - Access the sync_list_items - """ - return self._proxy.sync_list_items - - @property - def sync_list_permissions(self) -> SyncListPermissionList: - """ - Access the sync_list_permissions - """ - return self._proxy.sync_list_permissions - - 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 SyncListContext(InstanceContext): - - def __init__(self, version: Version, service_sid: str, sid: str): - """ - Initialize the SyncListContext - - :param version: Version that contains the resource - :param service_sid: - :param sid: - """ - super().__init__(version) - - # Path Solution - self._solution = { - "service_sid": service_sid, - "sid": sid, - } - self._uri = "/Services/{service_sid}/Lists/{sid}".format(**self._solution) - - self._sync_list_items: Optional[SyncListItemList] = None - self._sync_list_permissions: Optional[SyncListPermissionList] = None - - def delete(self) -> bool: - """ - Deletes the SyncListInstance - - - :returns: True if delete succeeds, False otherwise - """ - - headers = values.of({}) - - return self._version.delete(method="DELETE", uri=self._uri, headers=headers) - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the SyncListInstance - - - :returns: True if delete succeeds, False otherwise - """ - - headers = values.of({}) - - return await self._version.delete_async( - method="DELETE", uri=self._uri, headers=headers - ) - - def fetch(self) -> SyncListInstance: - """ - Fetch the SyncListInstance - - - :returns: The fetched SyncListInstance - """ - - headers = values.of({}) - - headers["Accept"] = "application/json" - - payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) - - return SyncListInstance( - self._version, - payload, - service_sid=self._solution["service_sid"], - sid=self._solution["sid"], - ) - - async def fetch_async(self) -> SyncListInstance: - """ - Asynchronous coroutine to fetch the SyncListInstance - - - :returns: The fetched SyncListInstance - """ - - headers = values.of({}) - - headers["Accept"] = "application/json" - - payload = await self._version.fetch_async( - method="GET", uri=self._uri, headers=headers - ) - - return SyncListInstance( - self._version, - payload, - service_sid=self._solution["service_sid"], - sid=self._solution["sid"], - ) - - @property - def sync_list_items(self) -> SyncListItemList: - """ - Access the sync_list_items - """ - if self._sync_list_items is None: - self._sync_list_items = SyncListItemList( - self._version, - self._solution["service_sid"], - self._solution["sid"], - ) - return self._sync_list_items - - @property - def sync_list_permissions(self) -> SyncListPermissionList: - """ - Access the sync_list_permissions - """ - if self._sync_list_permissions is None: - self._sync_list_permissions = SyncListPermissionList( - self._version, - self._solution["service_sid"], - self._solution["sid"], - ) - return self._sync_list_permissions - - 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 SyncListPage(Page): - - def get_instance(self, payload: Dict[str, Any]) -> SyncListInstance: - """ - Build an instance of SyncListInstance - - :param payload: Payload response from the API - """ - return SyncListInstance( - self._version, payload, service_sid=self._solution["service_sid"] - ) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" - - -class SyncListList(ListResource): - - def __init__(self, version: Version, service_sid: str): - """ - Initialize the SyncListList - - :param version: Version that contains the resource - :param service_sid: - - """ - super().__init__(version) - - # Path Solution - self._solution = { - "service_sid": service_sid, - } - self._uri = "/Services/{service_sid}/Lists".format(**self._solution) - - def create( - self, unique_name: Union[str, object] = values.unset - ) -> SyncListInstance: - """ - Create the SyncListInstance - - :param unique_name: - - :returns: The created SyncListInstance - """ - - data = values.of( - { - "UniqueName": unique_name, - } - ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Content-Type"] = "application/x-www-form-urlencoded" - - headers["Accept"] = "application/json" - - payload = self._version.create( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return SyncListInstance( - self._version, payload, service_sid=self._solution["service_sid"] - ) - - async def create_async( - self, unique_name: Union[str, object] = values.unset - ) -> SyncListInstance: - """ - Asynchronously create the SyncListInstance - - :param unique_name: - - :returns: The created SyncListInstance - """ - - data = values.of( - { - "UniqueName": unique_name, - } - ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Content-Type"] = "application/x-www-form-urlencoded" - - headers["Accept"] = "application/json" - - payload = await self._version.create_async( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return SyncListInstance( - self._version, payload, service_sid=self._solution["service_sid"] - ) - - def stream( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> Iterator[SyncListInstance]: - """ - Streams SyncListInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - """ - limits = self._version.read_limits(limit, page_size) - page = self.page(page_size=limits["page_size"]) - - return self._version.stream(page, limits["limit"]) - - async def stream_async( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> AsyncIterator[SyncListInstance]: - """ - Asynchronously streams SyncListInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - """ - limits = self._version.read_limits(limit, page_size) - page = await self.page_async(page_size=limits["page_size"]) - - return self._version.stream_async(page, limits["limit"]) - - def list( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[SyncListInstance]: - """ - Lists SyncListInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: list that will contain up to limit results - """ - return list( - self.stream( - limit=limit, - page_size=page_size, - ) - ) - - async def list_async( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[SyncListInstance]: - """ - Asynchronously lists SyncListInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: list that will contain up to limit results - """ - return [ - record - async for record in await self.stream_async( - limit=limit, - page_size=page_size, - ) - ] - - def page( - self, - page_token: Union[str, object] = values.unset, - page_number: Union[int, object] = values.unset, - page_size: Union[int, object] = values.unset, - ) -> SyncListPage: - """ - Retrieve a single page of SyncListInstance records from the API. - Request is executed immediately - - :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 - - :returns: Page of SyncListInstance - """ - data = values.of( - { - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Accept"] = "application/json" - - response = self._version.page( - method="GET", uri=self._uri, params=data, headers=headers - ) - return SyncListPage(self._version, response, self._solution) - - async def page_async( - self, - page_token: Union[str, object] = values.unset, - page_number: Union[int, object] = values.unset, - page_size: Union[int, object] = values.unset, - ) -> SyncListPage: - """ - Asynchronously retrieve a single page of SyncListInstance records from the API. - Request is executed immediately - - :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 - - :returns: Page of SyncListInstance - """ - data = values.of( - { - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Accept"] = "application/json" - - response = await self._version.page_async( - method="GET", uri=self._uri, params=data, headers=headers - ) - return SyncListPage(self._version, response, self._solution) - - def get_page(self, target_url: str) -> SyncListPage: - """ - Retrieve a specific page of SyncListInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of SyncListInstance - """ - response = self._version.domain.twilio.request("GET", target_url) - return SyncListPage(self._version, response, self._solution) - - async def get_page_async(self, target_url: str) -> SyncListPage: - """ - Asynchronously retrieve a specific page of SyncListInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of SyncListInstance - """ - response = await self._version.domain.twilio.request_async("GET", target_url) - return SyncListPage(self._version, response, self._solution) - - def get(self, sid: str) -> SyncListContext: - """ - Constructs a SyncListContext - - :param sid: - """ - return SyncListContext( - self._version, service_sid=self._solution["service_sid"], sid=sid - ) - - def __call__(self, sid: str) -> SyncListContext: - """ - Constructs a SyncListContext - - :param sid: - """ - return SyncListContext( - self._version, service_sid=self._solution["service_sid"], sid=sid - ) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" diff --git a/twilio/rest/preview/sync/service/sync_list/sync_list_item.py b/twilio/rest/preview/sync/service/sync_list/sync_list_item.py deleted file mode 100644 index 5220aec215..0000000000 --- a/twilio/rest/preview/sync/service/sync_list/sync_list_item.py +++ /dev/null @@ -1,763 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Preview - 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 datetime import datetime -from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, serialize, values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.version import Version -from twilio.base.page import Page - - -class SyncListItemInstance(InstanceResource): - - class QueryFromBoundType(object): - INCLUSIVE = "inclusive" - EXCLUSIVE = "exclusive" - - class QueryResultOrder(object): - ASC = "asc" - DESC = "desc" - - """ - :ivar index: - :ivar account_sid: - :ivar service_sid: - :ivar list_sid: - :ivar url: - :ivar revision: - :ivar data: - :ivar date_created: - :ivar date_updated: - :ivar created_by: - """ - - def __init__( - self, - version: Version, - payload: Dict[str, Any], - service_sid: str, - list_sid: str, - index: Optional[int] = None, - ): - super().__init__(version) - - self.index: Optional[int] = deserialize.integer(payload.get("index")) - self.account_sid: Optional[str] = payload.get("account_sid") - self.service_sid: Optional[str] = payload.get("service_sid") - self.list_sid: Optional[str] = payload.get("list_sid") - self.url: Optional[str] = payload.get("url") - self.revision: Optional[str] = payload.get("revision") - self.data: Optional[Dict[str, object]] = payload.get("data") - self.date_created: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("date_created") - ) - self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("date_updated") - ) - self.created_by: Optional[str] = payload.get("created_by") - - self._solution = { - "service_sid": service_sid, - "list_sid": list_sid, - "index": index or self.index, - } - self._context: Optional[SyncListItemContext] = None - - @property - def _proxy(self) -> "SyncListItemContext": - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SyncListItemContext for this SyncListItemInstance - """ - if self._context is None: - self._context = SyncListItemContext( - self._version, - service_sid=self._solution["service_sid"], - list_sid=self._solution["list_sid"], - index=self._solution["index"], - ) - return self._context - - def delete(self, if_match: Union[str, object] = values.unset) -> bool: - """ - Deletes the SyncListItemInstance - - :param if_match: The If-Match HTTP request header - - :returns: True if delete succeeds, False otherwise - """ - return self._proxy.delete( - if_match=if_match, - ) - - async def delete_async(self, if_match: Union[str, object] = values.unset) -> bool: - """ - Asynchronous coroutine that deletes the SyncListItemInstance - - :param if_match: The If-Match HTTP request header - - :returns: True if delete succeeds, False otherwise - """ - return await self._proxy.delete_async( - if_match=if_match, - ) - - def fetch(self) -> "SyncListItemInstance": - """ - Fetch the SyncListItemInstance - - - :returns: The fetched SyncListItemInstance - """ - return self._proxy.fetch() - - async def fetch_async(self) -> "SyncListItemInstance": - """ - Asynchronous coroutine to fetch the SyncListItemInstance - - - :returns: The fetched SyncListItemInstance - """ - return await self._proxy.fetch_async() - - def update( - self, data: object, if_match: Union[str, object] = values.unset - ) -> "SyncListItemInstance": - """ - Update the SyncListItemInstance - - :param data: - :param if_match: The If-Match HTTP request header - - :returns: The updated SyncListItemInstance - """ - return self._proxy.update( - data=data, - if_match=if_match, - ) - - async def update_async( - self, data: object, if_match: Union[str, object] = values.unset - ) -> "SyncListItemInstance": - """ - Asynchronous coroutine to update the SyncListItemInstance - - :param data: - :param if_match: The If-Match HTTP request header - - :returns: The updated SyncListItemInstance - """ - return await self._proxy.update_async( - data=data, - if_match=if_match, - ) - - 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 SyncListItemContext(InstanceContext): - - def __init__(self, version: Version, service_sid: str, list_sid: str, index: int): - """ - Initialize the SyncListItemContext - - :param version: Version that contains the resource - :param service_sid: - :param list_sid: - :param index: - """ - super().__init__(version) - - # Path Solution - self._solution = { - "service_sid": service_sid, - "list_sid": list_sid, - "index": index, - } - self._uri = "/Services/{service_sid}/Lists/{list_sid}/Items/{index}".format( - **self._solution - ) - - def delete(self, if_match: Union[str, object] = values.unset) -> bool: - """ - Deletes the SyncListItemInstance - - :param if_match: The If-Match HTTP request header - - :returns: True if delete succeeds, False otherwise - """ - headers = values.of( - { - "If-Match": if_match, - } - ) - - headers = values.of({}) - - return self._version.delete(method="DELETE", uri=self._uri, headers=headers) - - async def delete_async(self, if_match: Union[str, object] = values.unset) -> bool: - """ - Asynchronous coroutine that deletes the SyncListItemInstance - - :param if_match: The If-Match HTTP request header - - :returns: True if delete succeeds, False otherwise - """ - headers = values.of( - { - "If-Match": if_match, - } - ) - - headers = values.of({}) - - return await self._version.delete_async( - method="DELETE", uri=self._uri, headers=headers - ) - - def fetch(self) -> SyncListItemInstance: - """ - Fetch the SyncListItemInstance - - - :returns: The fetched SyncListItemInstance - """ - - headers = values.of({}) - - headers["Accept"] = "application/json" - - payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) - - return SyncListItemInstance( - self._version, - payload, - service_sid=self._solution["service_sid"], - list_sid=self._solution["list_sid"], - index=self._solution["index"], - ) - - async def fetch_async(self) -> SyncListItemInstance: - """ - Asynchronous coroutine to fetch the SyncListItemInstance - - - :returns: The fetched SyncListItemInstance - """ - - headers = values.of({}) - - headers["Accept"] = "application/json" - - payload = await self._version.fetch_async( - method="GET", uri=self._uri, headers=headers - ) - - return SyncListItemInstance( - self._version, - payload, - service_sid=self._solution["service_sid"], - list_sid=self._solution["list_sid"], - index=self._solution["index"], - ) - - def update( - self, data: object, if_match: Union[str, object] = values.unset - ) -> SyncListItemInstance: - """ - Update the SyncListItemInstance - - :param data: - :param if_match: The If-Match HTTP request header - - :returns: The updated SyncListItemInstance - """ - - data = values.of( - { - "Data": serialize.object(data), - } - ) - headers = values.of({}) - - if not ( - if_match is values.unset or (isinstance(if_match, str) and not if_match) - ): - headers["If-Match"] = if_match - - headers["Content-Type"] = "application/x-www-form-urlencoded" - - headers["Accept"] = "application/json" - - payload = self._version.update( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return SyncListItemInstance( - self._version, - payload, - service_sid=self._solution["service_sid"], - list_sid=self._solution["list_sid"], - index=self._solution["index"], - ) - - async def update_async( - self, data: object, if_match: Union[str, object] = values.unset - ) -> SyncListItemInstance: - """ - Asynchronous coroutine to update the SyncListItemInstance - - :param data: - :param if_match: The If-Match HTTP request header - - :returns: The updated SyncListItemInstance - """ - - data = values.of( - { - "Data": serialize.object(data), - } - ) - headers = values.of({}) - - if not ( - if_match is values.unset or (isinstance(if_match, str) and not if_match) - ): - headers["If-Match"] = if_match - - headers["Content-Type"] = "application/x-www-form-urlencoded" - - headers["Accept"] = "application/json" - - payload = await self._version.update_async( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return SyncListItemInstance( - self._version, - payload, - service_sid=self._solution["service_sid"], - list_sid=self._solution["list_sid"], - index=self._solution["index"], - ) - - 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 SyncListItemPage(Page): - - def get_instance(self, payload: Dict[str, Any]) -> SyncListItemInstance: - """ - Build an instance of SyncListItemInstance - - :param payload: Payload response from the API - """ - return SyncListItemInstance( - self._version, - payload, - service_sid=self._solution["service_sid"], - list_sid=self._solution["list_sid"], - ) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" - - -class SyncListItemList(ListResource): - - def __init__(self, version: Version, service_sid: str, list_sid: str): - """ - Initialize the SyncListItemList - - :param version: Version that contains the resource - :param service_sid: - :param list_sid: - - """ - super().__init__(version) - - # Path Solution - self._solution = { - "service_sid": service_sid, - "list_sid": list_sid, - } - self._uri = "/Services/{service_sid}/Lists/{list_sid}/Items".format( - **self._solution - ) - - def create(self, data: object) -> SyncListItemInstance: - """ - Create the SyncListItemInstance - - :param data: - - :returns: The created SyncListItemInstance - """ - - data = values.of( - { - "Data": serialize.object(data), - } - ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Content-Type"] = "application/x-www-form-urlencoded" - - headers["Accept"] = "application/json" - - payload = self._version.create( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return SyncListItemInstance( - self._version, - payload, - service_sid=self._solution["service_sid"], - list_sid=self._solution["list_sid"], - ) - - async def create_async(self, data: object) -> SyncListItemInstance: - """ - Asynchronously create the SyncListItemInstance - - :param data: - - :returns: The created SyncListItemInstance - """ - - data = values.of( - { - "Data": serialize.object(data), - } - ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Content-Type"] = "application/x-www-form-urlencoded" - - headers["Accept"] = "application/json" - - payload = await self._version.create_async( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return SyncListItemInstance( - self._version, - payload, - service_sid=self._solution["service_sid"], - list_sid=self._solution["list_sid"], - ) - - def stream( - self, - order: Union["SyncListItemInstance.QueryResultOrder", object] = values.unset, - from_: Union[str, object] = values.unset, - bounds: Union["SyncListItemInstance.QueryFromBoundType", object] = values.unset, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> Iterator[SyncListItemInstance]: - """ - Streams SyncListItemInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param "SyncListItemInstance.QueryResultOrder" order: - :param str from_: - :param "SyncListItemInstance.QueryFromBoundType" bounds: - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - """ - limits = self._version.read_limits(limit, page_size) - page = self.page( - order=order, from_=from_, bounds=bounds, page_size=limits["page_size"] - ) - - return self._version.stream(page, limits["limit"]) - - async def stream_async( - self, - order: Union["SyncListItemInstance.QueryResultOrder", object] = values.unset, - from_: Union[str, object] = values.unset, - bounds: Union["SyncListItemInstance.QueryFromBoundType", object] = values.unset, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> AsyncIterator[SyncListItemInstance]: - """ - Asynchronously streams SyncListItemInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param "SyncListItemInstance.QueryResultOrder" order: - :param str from_: - :param "SyncListItemInstance.QueryFromBoundType" bounds: - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - """ - limits = self._version.read_limits(limit, page_size) - page = await self.page_async( - order=order, from_=from_, bounds=bounds, page_size=limits["page_size"] - ) - - return self._version.stream_async(page, limits["limit"]) - - def list( - self, - order: Union["SyncListItemInstance.QueryResultOrder", object] = values.unset, - from_: Union[str, object] = values.unset, - bounds: Union["SyncListItemInstance.QueryFromBoundType", object] = values.unset, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[SyncListItemInstance]: - """ - Lists SyncListItemInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param "SyncListItemInstance.QueryResultOrder" order: - :param str from_: - :param "SyncListItemInstance.QueryFromBoundType" bounds: - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: list that will contain up to limit results - """ - return list( - self.stream( - order=order, - from_=from_, - bounds=bounds, - limit=limit, - page_size=page_size, - ) - ) - - async def list_async( - self, - order: Union["SyncListItemInstance.QueryResultOrder", object] = values.unset, - from_: Union[str, object] = values.unset, - bounds: Union["SyncListItemInstance.QueryFromBoundType", object] = values.unset, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[SyncListItemInstance]: - """ - Asynchronously lists SyncListItemInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param "SyncListItemInstance.QueryResultOrder" order: - :param str from_: - :param "SyncListItemInstance.QueryFromBoundType" bounds: - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: list that will contain up to limit results - """ - return [ - record - async for record in await self.stream_async( - order=order, - from_=from_, - bounds=bounds, - limit=limit, - page_size=page_size, - ) - ] - - def page( - self, - order: Union["SyncListItemInstance.QueryResultOrder", object] = values.unset, - from_: Union[str, object] = values.unset, - bounds: Union["SyncListItemInstance.QueryFromBoundType", object] = values.unset, - page_token: Union[str, object] = values.unset, - page_number: Union[int, object] = values.unset, - page_size: Union[int, object] = values.unset, - ) -> SyncListItemPage: - """ - Retrieve a single page of SyncListItemInstance records from the API. - Request is executed immediately - - :param order: - :param from_: - :param bounds: - :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 - - :returns: Page of SyncListItemInstance - """ - data = values.of( - { - "Order": order, - "From": from_, - "Bounds": bounds, - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Accept"] = "application/json" - - response = self._version.page( - method="GET", uri=self._uri, params=data, headers=headers - ) - return SyncListItemPage(self._version, response, self._solution) - - async def page_async( - self, - order: Union["SyncListItemInstance.QueryResultOrder", object] = values.unset, - from_: Union[str, object] = values.unset, - bounds: Union["SyncListItemInstance.QueryFromBoundType", object] = values.unset, - page_token: Union[str, object] = values.unset, - page_number: Union[int, object] = values.unset, - page_size: Union[int, object] = values.unset, - ) -> SyncListItemPage: - """ - Asynchronously retrieve a single page of SyncListItemInstance records from the API. - Request is executed immediately - - :param order: - :param from_: - :param bounds: - :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 - - :returns: Page of SyncListItemInstance - """ - data = values.of( - { - "Order": order, - "From": from_, - "Bounds": bounds, - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Accept"] = "application/json" - - response = await self._version.page_async( - method="GET", uri=self._uri, params=data, headers=headers - ) - return SyncListItemPage(self._version, response, self._solution) - - def get_page(self, target_url: str) -> SyncListItemPage: - """ - Retrieve a specific page of SyncListItemInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of SyncListItemInstance - """ - response = self._version.domain.twilio.request("GET", target_url) - return SyncListItemPage(self._version, response, self._solution) - - async def get_page_async(self, target_url: str) -> SyncListItemPage: - """ - Asynchronously retrieve a specific page of SyncListItemInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of SyncListItemInstance - """ - response = await self._version.domain.twilio.request_async("GET", target_url) - return SyncListItemPage(self._version, response, self._solution) - - def get(self, index: int) -> SyncListItemContext: - """ - Constructs a SyncListItemContext - - :param index: - """ - return SyncListItemContext( - self._version, - service_sid=self._solution["service_sid"], - list_sid=self._solution["list_sid"], - index=index, - ) - - def __call__(self, index: int) -> SyncListItemContext: - """ - Constructs a SyncListItemContext - - :param index: - """ - return SyncListItemContext( - self._version, - service_sid=self._solution["service_sid"], - list_sid=self._solution["list_sid"], - index=index, - ) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" diff --git a/twilio/rest/preview/sync/service/sync_list/sync_list_permission.py b/twilio/rest/preview/sync/service/sync_list/sync_list_permission.py deleted file mode 100644 index 334b62dd18..0000000000 --- a/twilio/rest/preview/sync/service/sync_list/sync_list_permission.py +++ /dev/null @@ -1,617 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Preview - 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, Union, Iterator, AsyncIterator -from twilio.base import serialize, values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.version import Version -from twilio.base.page import Page - - -class SyncListPermissionInstance(InstanceResource): - """ - :ivar account_sid: The unique SID identifier of the Twilio Account. - :ivar service_sid: The unique SID identifier of the Sync Service Instance. - :ivar list_sid: The unique SID identifier of the Sync List to which the Permission applies. - :ivar identity: Arbitrary string identifier representing a human user associated with an FPA token, assigned by the developer. - :ivar read: Boolean flag specifying whether the identity can read the Sync List and its Items. - :ivar write: Boolean flag specifying whether the identity can create, update and delete Items of the Sync List. - :ivar manage: Boolean flag specifying whether the identity can delete the Sync List. - :ivar url: Contains an absolute URL for this Sync List Permission. - """ - - def __init__( - self, - version: Version, - payload: Dict[str, Any], - service_sid: str, - list_sid: str, - identity: Optional[str] = None, - ): - super().__init__(version) - - self.account_sid: Optional[str] = payload.get("account_sid") - self.service_sid: Optional[str] = payload.get("service_sid") - self.list_sid: Optional[str] = payload.get("list_sid") - self.identity: Optional[str] = payload.get("identity") - self.read: Optional[bool] = payload.get("read") - self.write: Optional[bool] = payload.get("write") - self.manage: Optional[bool] = payload.get("manage") - self.url: Optional[str] = payload.get("url") - - self._solution = { - "service_sid": service_sid, - "list_sid": list_sid, - "identity": identity or self.identity, - } - self._context: Optional[SyncListPermissionContext] = None - - @property - def _proxy(self) -> "SyncListPermissionContext": - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SyncListPermissionContext for this SyncListPermissionInstance - """ - if self._context is None: - self._context = SyncListPermissionContext( - self._version, - service_sid=self._solution["service_sid"], - list_sid=self._solution["list_sid"], - identity=self._solution["identity"], - ) - return self._context - - def delete(self) -> bool: - """ - Deletes the SyncListPermissionInstance - - - :returns: True if delete succeeds, False otherwise - """ - return self._proxy.delete() - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the SyncListPermissionInstance - - - :returns: True if delete succeeds, False otherwise - """ - return await self._proxy.delete_async() - - def fetch(self) -> "SyncListPermissionInstance": - """ - Fetch the SyncListPermissionInstance - - - :returns: The fetched SyncListPermissionInstance - """ - return self._proxy.fetch() - - async def fetch_async(self) -> "SyncListPermissionInstance": - """ - Asynchronous coroutine to fetch the SyncListPermissionInstance - - - :returns: The fetched SyncListPermissionInstance - """ - return await self._proxy.fetch_async() - - def update( - self, read: bool, write: bool, manage: bool - ) -> "SyncListPermissionInstance": - """ - Update the SyncListPermissionInstance - - :param read: Boolean flag specifying whether the identity can read the Sync List. - :param write: Boolean flag specifying whether the identity can create, update and delete Items of the Sync List. - :param manage: Boolean flag specifying whether the identity can delete the Sync List. - - :returns: The updated SyncListPermissionInstance - """ - return self._proxy.update( - read=read, - write=write, - manage=manage, - ) - - async def update_async( - self, read: bool, write: bool, manage: bool - ) -> "SyncListPermissionInstance": - """ - Asynchronous coroutine to update the SyncListPermissionInstance - - :param read: Boolean flag specifying whether the identity can read the Sync List. - :param write: Boolean flag specifying whether the identity can create, update and delete Items of the Sync List. - :param manage: Boolean flag specifying whether the identity can delete the Sync List. - - :returns: The updated SyncListPermissionInstance - """ - return await self._proxy.update_async( - read=read, - write=write, - manage=manage, - ) - - 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 SyncListPermissionContext(InstanceContext): - - def __init__( - self, version: Version, service_sid: str, list_sid: str, identity: str - ): - """ - Initialize the SyncListPermissionContext - - :param version: Version that contains the resource - :param service_sid: The unique SID identifier of the Sync Service Instance. - :param list_sid: Identifier of the Sync List. Either a SID or a unique name. - :param identity: Arbitrary string identifier representing a human user associated with an FPA token, assigned by the developer. - """ - super().__init__(version) - - # Path Solution - self._solution = { - "service_sid": service_sid, - "list_sid": list_sid, - "identity": identity, - } - self._uri = ( - "/Services/{service_sid}/Lists/{list_sid}/Permissions/{identity}".format( - **self._solution - ) - ) - - def delete(self) -> bool: - """ - Deletes the SyncListPermissionInstance - - - :returns: True if delete succeeds, False otherwise - """ - - headers = values.of({}) - - return self._version.delete(method="DELETE", uri=self._uri, headers=headers) - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the SyncListPermissionInstance - - - :returns: True if delete succeeds, False otherwise - """ - - headers = values.of({}) - - return await self._version.delete_async( - method="DELETE", uri=self._uri, headers=headers - ) - - def fetch(self) -> SyncListPermissionInstance: - """ - Fetch the SyncListPermissionInstance - - - :returns: The fetched SyncListPermissionInstance - """ - - headers = values.of({}) - - headers["Accept"] = "application/json" - - payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) - - return SyncListPermissionInstance( - self._version, - payload, - service_sid=self._solution["service_sid"], - list_sid=self._solution["list_sid"], - identity=self._solution["identity"], - ) - - async def fetch_async(self) -> SyncListPermissionInstance: - """ - Asynchronous coroutine to fetch the SyncListPermissionInstance - - - :returns: The fetched SyncListPermissionInstance - """ - - headers = values.of({}) - - headers["Accept"] = "application/json" - - payload = await self._version.fetch_async( - method="GET", uri=self._uri, headers=headers - ) - - return SyncListPermissionInstance( - self._version, - payload, - service_sid=self._solution["service_sid"], - list_sid=self._solution["list_sid"], - identity=self._solution["identity"], - ) - - def update( - self, read: bool, write: bool, manage: bool - ) -> SyncListPermissionInstance: - """ - Update the SyncListPermissionInstance - - :param read: Boolean flag specifying whether the identity can read the Sync List. - :param write: Boolean flag specifying whether the identity can create, update and delete Items of the Sync List. - :param manage: Boolean flag specifying whether the identity can delete the Sync List. - - :returns: The updated SyncListPermissionInstance - """ - - data = values.of( - { - "Read": serialize.boolean_to_string(read), - "Write": serialize.boolean_to_string(write), - "Manage": serialize.boolean_to_string(manage), - } - ) - headers = values.of({}) - - headers["Content-Type"] = "application/x-www-form-urlencoded" - - headers["Accept"] = "application/json" - - payload = self._version.update( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return SyncListPermissionInstance( - self._version, - payload, - service_sid=self._solution["service_sid"], - list_sid=self._solution["list_sid"], - identity=self._solution["identity"], - ) - - async def update_async( - self, read: bool, write: bool, manage: bool - ) -> SyncListPermissionInstance: - """ - Asynchronous coroutine to update the SyncListPermissionInstance - - :param read: Boolean flag specifying whether the identity can read the Sync List. - :param write: Boolean flag specifying whether the identity can create, update and delete Items of the Sync List. - :param manage: Boolean flag specifying whether the identity can delete the Sync List. - - :returns: The updated SyncListPermissionInstance - """ - - data = values.of( - { - "Read": serialize.boolean_to_string(read), - "Write": serialize.boolean_to_string(write), - "Manage": serialize.boolean_to_string(manage), - } - ) - headers = values.of({}) - - headers["Content-Type"] = "application/x-www-form-urlencoded" - - headers["Accept"] = "application/json" - - payload = await self._version.update_async( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return SyncListPermissionInstance( - self._version, - payload, - service_sid=self._solution["service_sid"], - list_sid=self._solution["list_sid"], - identity=self._solution["identity"], - ) - - 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 SyncListPermissionPage(Page): - - def get_instance(self, payload: Dict[str, Any]) -> SyncListPermissionInstance: - """ - Build an instance of SyncListPermissionInstance - - :param payload: Payload response from the API - """ - return SyncListPermissionInstance( - self._version, - payload, - service_sid=self._solution["service_sid"], - list_sid=self._solution["list_sid"], - ) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" - - -class SyncListPermissionList(ListResource): - - def __init__(self, version: Version, service_sid: str, list_sid: str): - """ - Initialize the SyncListPermissionList - - :param version: Version that contains the resource - :param service_sid: - :param list_sid: Identifier of the Sync List. Either a SID or a unique name. - - """ - super().__init__(version) - - # Path Solution - self._solution = { - "service_sid": service_sid, - "list_sid": list_sid, - } - self._uri = "/Services/{service_sid}/Lists/{list_sid}/Permissions".format( - **self._solution - ) - - def stream( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> Iterator[SyncListPermissionInstance]: - """ - Streams SyncListPermissionInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - """ - limits = self._version.read_limits(limit, page_size) - page = self.page(page_size=limits["page_size"]) - - return self._version.stream(page, limits["limit"]) - - async def stream_async( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> AsyncIterator[SyncListPermissionInstance]: - """ - Asynchronously streams SyncListPermissionInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - """ - limits = self._version.read_limits(limit, page_size) - page = await self.page_async(page_size=limits["page_size"]) - - return self._version.stream_async(page, limits["limit"]) - - def list( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[SyncListPermissionInstance]: - """ - Lists SyncListPermissionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: list that will contain up to limit results - """ - return list( - self.stream( - limit=limit, - page_size=page_size, - ) - ) - - async def list_async( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[SyncListPermissionInstance]: - """ - Asynchronously lists SyncListPermissionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: list that will contain up to limit results - """ - return [ - record - async for record in await self.stream_async( - limit=limit, - page_size=page_size, - ) - ] - - def page( - self, - page_token: Union[str, object] = values.unset, - page_number: Union[int, object] = values.unset, - page_size: Union[int, object] = values.unset, - ) -> SyncListPermissionPage: - """ - Retrieve a single page of SyncListPermissionInstance records from the API. - Request is executed immediately - - :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 - - :returns: Page of SyncListPermissionInstance - """ - data = values.of( - { - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Accept"] = "application/json" - - response = self._version.page( - method="GET", uri=self._uri, params=data, headers=headers - ) - return SyncListPermissionPage(self._version, response, self._solution) - - async def page_async( - self, - page_token: Union[str, object] = values.unset, - page_number: Union[int, object] = values.unset, - page_size: Union[int, object] = values.unset, - ) -> SyncListPermissionPage: - """ - Asynchronously retrieve a single page of SyncListPermissionInstance records from the API. - Request is executed immediately - - :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 - - :returns: Page of SyncListPermissionInstance - """ - data = values.of( - { - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Accept"] = "application/json" - - response = await self._version.page_async( - method="GET", uri=self._uri, params=data, headers=headers - ) - return SyncListPermissionPage(self._version, response, self._solution) - - def get_page(self, target_url: str) -> SyncListPermissionPage: - """ - Retrieve a specific page of SyncListPermissionInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of SyncListPermissionInstance - """ - response = self._version.domain.twilio.request("GET", target_url) - return SyncListPermissionPage(self._version, response, self._solution) - - async def get_page_async(self, target_url: str) -> SyncListPermissionPage: - """ - Asynchronously retrieve a specific page of SyncListPermissionInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of SyncListPermissionInstance - """ - response = await self._version.domain.twilio.request_async("GET", target_url) - return SyncListPermissionPage(self._version, response, self._solution) - - def get(self, identity: str) -> SyncListPermissionContext: - """ - Constructs a SyncListPermissionContext - - :param identity: Arbitrary string identifier representing a human user associated with an FPA token, assigned by the developer. - """ - return SyncListPermissionContext( - self._version, - service_sid=self._solution["service_sid"], - list_sid=self._solution["list_sid"], - identity=identity, - ) - - def __call__(self, identity: str) -> SyncListPermissionContext: - """ - Constructs a SyncListPermissionContext - - :param identity: Arbitrary string identifier representing a human user associated with an FPA token, assigned by the developer. - """ - return SyncListPermissionContext( - self._version, - service_sid=self._solution["service_sid"], - list_sid=self._solution["list_sid"], - identity=identity, - ) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" diff --git a/twilio/rest/preview/sync/service/sync_map/__init__.py b/twilio/rest/preview/sync/service/sync_map/__init__.py deleted file mode 100644 index 0ecbb6132f..0000000000 --- a/twilio/rest/preview/sync/service/sync_map/__init__.py +++ /dev/null @@ -1,593 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Preview - 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 datetime import datetime -from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.version import Version -from twilio.base.page import Page -from twilio.rest.preview.sync.service.sync_map.sync_map_item import SyncMapItemList -from twilio.rest.preview.sync.service.sync_map.sync_map_permission import ( - SyncMapPermissionList, -) - - -class SyncMapInstance(InstanceResource): - """ - :ivar sid: - :ivar unique_name: - :ivar account_sid: - :ivar service_sid: - :ivar url: - :ivar links: - :ivar revision: - :ivar date_created: - :ivar date_updated: - :ivar created_by: - """ - - def __init__( - self, - version: Version, - payload: Dict[str, Any], - service_sid: str, - sid: Optional[str] = None, - ): - super().__init__(version) - - self.sid: Optional[str] = payload.get("sid") - self.unique_name: Optional[str] = payload.get("unique_name") - self.account_sid: Optional[str] = payload.get("account_sid") - self.service_sid: Optional[str] = payload.get("service_sid") - self.url: Optional[str] = payload.get("url") - self.links: Optional[Dict[str, object]] = payload.get("links") - self.revision: Optional[str] = payload.get("revision") - self.date_created: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("date_created") - ) - self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("date_updated") - ) - self.created_by: Optional[str] = payload.get("created_by") - - self._solution = { - "service_sid": service_sid, - "sid": sid or self.sid, - } - self._context: Optional[SyncMapContext] = None - - @property - def _proxy(self) -> "SyncMapContext": - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SyncMapContext for this SyncMapInstance - """ - if self._context is None: - self._context = SyncMapContext( - self._version, - service_sid=self._solution["service_sid"], - sid=self._solution["sid"], - ) - return self._context - - def delete(self) -> bool: - """ - Deletes the SyncMapInstance - - - :returns: True if delete succeeds, False otherwise - """ - return self._proxy.delete() - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the SyncMapInstance - - - :returns: True if delete succeeds, False otherwise - """ - return await self._proxy.delete_async() - - def fetch(self) -> "SyncMapInstance": - """ - Fetch the SyncMapInstance - - - :returns: The fetched SyncMapInstance - """ - return self._proxy.fetch() - - async def fetch_async(self) -> "SyncMapInstance": - """ - Asynchronous coroutine to fetch the SyncMapInstance - - - :returns: The fetched SyncMapInstance - """ - return await self._proxy.fetch_async() - - @property - def sync_map_items(self) -> SyncMapItemList: - """ - Access the sync_map_items - """ - return self._proxy.sync_map_items - - @property - def sync_map_permissions(self) -> SyncMapPermissionList: - """ - Access the sync_map_permissions - """ - return self._proxy.sync_map_permissions - - 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 SyncMapContext(InstanceContext): - - def __init__(self, version: Version, service_sid: str, sid: str): - """ - Initialize the SyncMapContext - - :param version: Version that contains the resource - :param service_sid: - :param sid: - """ - super().__init__(version) - - # Path Solution - self._solution = { - "service_sid": service_sid, - "sid": sid, - } - self._uri = "/Services/{service_sid}/Maps/{sid}".format(**self._solution) - - self._sync_map_items: Optional[SyncMapItemList] = None - self._sync_map_permissions: Optional[SyncMapPermissionList] = None - - def delete(self) -> bool: - """ - Deletes the SyncMapInstance - - - :returns: True if delete succeeds, False otherwise - """ - - headers = values.of({}) - - return self._version.delete(method="DELETE", uri=self._uri, headers=headers) - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the SyncMapInstance - - - :returns: True if delete succeeds, False otherwise - """ - - headers = values.of({}) - - return await self._version.delete_async( - method="DELETE", uri=self._uri, headers=headers - ) - - def fetch(self) -> SyncMapInstance: - """ - Fetch the SyncMapInstance - - - :returns: The fetched SyncMapInstance - """ - - headers = values.of({}) - - headers["Accept"] = "application/json" - - payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) - - return SyncMapInstance( - self._version, - payload, - service_sid=self._solution["service_sid"], - sid=self._solution["sid"], - ) - - async def fetch_async(self) -> SyncMapInstance: - """ - Asynchronous coroutine to fetch the SyncMapInstance - - - :returns: The fetched SyncMapInstance - """ - - headers = values.of({}) - - headers["Accept"] = "application/json" - - payload = await self._version.fetch_async( - method="GET", uri=self._uri, headers=headers - ) - - return SyncMapInstance( - self._version, - payload, - service_sid=self._solution["service_sid"], - sid=self._solution["sid"], - ) - - @property - def sync_map_items(self) -> SyncMapItemList: - """ - Access the sync_map_items - """ - if self._sync_map_items is None: - self._sync_map_items = SyncMapItemList( - self._version, - self._solution["service_sid"], - self._solution["sid"], - ) - return self._sync_map_items - - @property - def sync_map_permissions(self) -> SyncMapPermissionList: - """ - Access the sync_map_permissions - """ - if self._sync_map_permissions is None: - self._sync_map_permissions = SyncMapPermissionList( - self._version, - self._solution["service_sid"], - self._solution["sid"], - ) - return self._sync_map_permissions - - 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 SyncMapPage(Page): - - def get_instance(self, payload: Dict[str, Any]) -> SyncMapInstance: - """ - Build an instance of SyncMapInstance - - :param payload: Payload response from the API - """ - return SyncMapInstance( - self._version, payload, service_sid=self._solution["service_sid"] - ) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" - - -class SyncMapList(ListResource): - - def __init__(self, version: Version, service_sid: str): - """ - Initialize the SyncMapList - - :param version: Version that contains the resource - :param service_sid: - - """ - super().__init__(version) - - # Path Solution - self._solution = { - "service_sid": service_sid, - } - self._uri = "/Services/{service_sid}/Maps".format(**self._solution) - - def create(self, unique_name: Union[str, object] = values.unset) -> SyncMapInstance: - """ - Create the SyncMapInstance - - :param unique_name: - - :returns: The created SyncMapInstance - """ - - data = values.of( - { - "UniqueName": unique_name, - } - ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Content-Type"] = "application/x-www-form-urlencoded" - - headers["Accept"] = "application/json" - - payload = self._version.create( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return SyncMapInstance( - self._version, payload, service_sid=self._solution["service_sid"] - ) - - async def create_async( - self, unique_name: Union[str, object] = values.unset - ) -> SyncMapInstance: - """ - Asynchronously create the SyncMapInstance - - :param unique_name: - - :returns: The created SyncMapInstance - """ - - data = values.of( - { - "UniqueName": unique_name, - } - ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Content-Type"] = "application/x-www-form-urlencoded" - - headers["Accept"] = "application/json" - - payload = await self._version.create_async( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return SyncMapInstance( - self._version, payload, service_sid=self._solution["service_sid"] - ) - - def stream( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> Iterator[SyncMapInstance]: - """ - Streams SyncMapInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - """ - limits = self._version.read_limits(limit, page_size) - page = self.page(page_size=limits["page_size"]) - - return self._version.stream(page, limits["limit"]) - - async def stream_async( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> AsyncIterator[SyncMapInstance]: - """ - Asynchronously streams SyncMapInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - """ - limits = self._version.read_limits(limit, page_size) - page = await self.page_async(page_size=limits["page_size"]) - - return self._version.stream_async(page, limits["limit"]) - - def list( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[SyncMapInstance]: - """ - Lists SyncMapInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: list that will contain up to limit results - """ - return list( - self.stream( - limit=limit, - page_size=page_size, - ) - ) - - async def list_async( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[SyncMapInstance]: - """ - Asynchronously lists SyncMapInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: list that will contain up to limit results - """ - return [ - record - async for record in await self.stream_async( - limit=limit, - page_size=page_size, - ) - ] - - def page( - self, - page_token: Union[str, object] = values.unset, - page_number: Union[int, object] = values.unset, - page_size: Union[int, object] = values.unset, - ) -> SyncMapPage: - """ - Retrieve a single page of SyncMapInstance records from the API. - Request is executed immediately - - :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 - - :returns: Page of SyncMapInstance - """ - data = values.of( - { - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Accept"] = "application/json" - - response = self._version.page( - method="GET", uri=self._uri, params=data, headers=headers - ) - return SyncMapPage(self._version, response, self._solution) - - async def page_async( - self, - page_token: Union[str, object] = values.unset, - page_number: Union[int, object] = values.unset, - page_size: Union[int, object] = values.unset, - ) -> SyncMapPage: - """ - Asynchronously retrieve a single page of SyncMapInstance records from the API. - Request is executed immediately - - :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 - - :returns: Page of SyncMapInstance - """ - data = values.of( - { - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Accept"] = "application/json" - - response = await self._version.page_async( - method="GET", uri=self._uri, params=data, headers=headers - ) - return SyncMapPage(self._version, response, self._solution) - - def get_page(self, target_url: str) -> SyncMapPage: - """ - Retrieve a specific page of SyncMapInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of SyncMapInstance - """ - response = self._version.domain.twilio.request("GET", target_url) - return SyncMapPage(self._version, response, self._solution) - - async def get_page_async(self, target_url: str) -> SyncMapPage: - """ - Asynchronously retrieve a specific page of SyncMapInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of SyncMapInstance - """ - response = await self._version.domain.twilio.request_async("GET", target_url) - return SyncMapPage(self._version, response, self._solution) - - def get(self, sid: str) -> SyncMapContext: - """ - Constructs a SyncMapContext - - :param sid: - """ - return SyncMapContext( - self._version, service_sid=self._solution["service_sid"], sid=sid - ) - - def __call__(self, sid: str) -> SyncMapContext: - """ - Constructs a SyncMapContext - - :param sid: - """ - return SyncMapContext( - self._version, service_sid=self._solution["service_sid"], sid=sid - ) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" diff --git a/twilio/rest/preview/sync/service/sync_map/sync_map_item.py b/twilio/rest/preview/sync/service/sync_map/sync_map_item.py deleted file mode 100644 index 9ddd1d5afe..0000000000 --- a/twilio/rest/preview/sync/service/sync_map/sync_map_item.py +++ /dev/null @@ -1,767 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Preview - 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 datetime import datetime -from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, serialize, values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.version import Version -from twilio.base.page import Page - - -class SyncMapItemInstance(InstanceResource): - - class QueryFromBoundType(object): - INCLUSIVE = "inclusive" - EXCLUSIVE = "exclusive" - - class QueryResultOrder(object): - ASC = "asc" - DESC = "desc" - - """ - :ivar key: - :ivar account_sid: - :ivar service_sid: - :ivar map_sid: - :ivar url: - :ivar revision: - :ivar data: - :ivar date_created: - :ivar date_updated: - :ivar created_by: - """ - - def __init__( - self, - version: Version, - payload: Dict[str, Any], - service_sid: str, - map_sid: str, - key: Optional[str] = None, - ): - super().__init__(version) - - self.key: Optional[str] = payload.get("key") - self.account_sid: Optional[str] = payload.get("account_sid") - self.service_sid: Optional[str] = payload.get("service_sid") - self.map_sid: Optional[str] = payload.get("map_sid") - self.url: Optional[str] = payload.get("url") - self.revision: Optional[str] = payload.get("revision") - self.data: Optional[Dict[str, object]] = payload.get("data") - self.date_created: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("date_created") - ) - self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("date_updated") - ) - self.created_by: Optional[str] = payload.get("created_by") - - self._solution = { - "service_sid": service_sid, - "map_sid": map_sid, - "key": key or self.key, - } - self._context: Optional[SyncMapItemContext] = None - - @property - def _proxy(self) -> "SyncMapItemContext": - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SyncMapItemContext for this SyncMapItemInstance - """ - if self._context is None: - self._context = SyncMapItemContext( - self._version, - service_sid=self._solution["service_sid"], - map_sid=self._solution["map_sid"], - key=self._solution["key"], - ) - return self._context - - def delete(self, if_match: Union[str, object] = values.unset) -> bool: - """ - Deletes the SyncMapItemInstance - - :param if_match: The If-Match HTTP request header - - :returns: True if delete succeeds, False otherwise - """ - return self._proxy.delete( - if_match=if_match, - ) - - async def delete_async(self, if_match: Union[str, object] = values.unset) -> bool: - """ - Asynchronous coroutine that deletes the SyncMapItemInstance - - :param if_match: The If-Match HTTP request header - - :returns: True if delete succeeds, False otherwise - """ - return await self._proxy.delete_async( - if_match=if_match, - ) - - def fetch(self) -> "SyncMapItemInstance": - """ - Fetch the SyncMapItemInstance - - - :returns: The fetched SyncMapItemInstance - """ - return self._proxy.fetch() - - async def fetch_async(self) -> "SyncMapItemInstance": - """ - Asynchronous coroutine to fetch the SyncMapItemInstance - - - :returns: The fetched SyncMapItemInstance - """ - return await self._proxy.fetch_async() - - def update( - self, data: object, if_match: Union[str, object] = values.unset - ) -> "SyncMapItemInstance": - """ - Update the SyncMapItemInstance - - :param data: - :param if_match: The If-Match HTTP request header - - :returns: The updated SyncMapItemInstance - """ - return self._proxy.update( - data=data, - if_match=if_match, - ) - - async def update_async( - self, data: object, if_match: Union[str, object] = values.unset - ) -> "SyncMapItemInstance": - """ - Asynchronous coroutine to update the SyncMapItemInstance - - :param data: - :param if_match: The If-Match HTTP request header - - :returns: The updated SyncMapItemInstance - """ - return await self._proxy.update_async( - data=data, - if_match=if_match, - ) - - 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 SyncMapItemContext(InstanceContext): - - def __init__(self, version: Version, service_sid: str, map_sid: str, key: str): - """ - Initialize the SyncMapItemContext - - :param version: Version that contains the resource - :param service_sid: - :param map_sid: - :param key: - """ - super().__init__(version) - - # Path Solution - self._solution = { - "service_sid": service_sid, - "map_sid": map_sid, - "key": key, - } - self._uri = "/Services/{service_sid}/Maps/{map_sid}/Items/{key}".format( - **self._solution - ) - - def delete(self, if_match: Union[str, object] = values.unset) -> bool: - """ - Deletes the SyncMapItemInstance - - :param if_match: The If-Match HTTP request header - - :returns: True if delete succeeds, False otherwise - """ - headers = values.of( - { - "If-Match": if_match, - } - ) - - headers = values.of({}) - - return self._version.delete(method="DELETE", uri=self._uri, headers=headers) - - async def delete_async(self, if_match: Union[str, object] = values.unset) -> bool: - """ - Asynchronous coroutine that deletes the SyncMapItemInstance - - :param if_match: The If-Match HTTP request header - - :returns: True if delete succeeds, False otherwise - """ - headers = values.of( - { - "If-Match": if_match, - } - ) - - headers = values.of({}) - - return await self._version.delete_async( - method="DELETE", uri=self._uri, headers=headers - ) - - def fetch(self) -> SyncMapItemInstance: - """ - Fetch the SyncMapItemInstance - - - :returns: The fetched SyncMapItemInstance - """ - - headers = values.of({}) - - headers["Accept"] = "application/json" - - payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) - - return SyncMapItemInstance( - self._version, - payload, - service_sid=self._solution["service_sid"], - map_sid=self._solution["map_sid"], - key=self._solution["key"], - ) - - async def fetch_async(self) -> SyncMapItemInstance: - """ - Asynchronous coroutine to fetch the SyncMapItemInstance - - - :returns: The fetched SyncMapItemInstance - """ - - headers = values.of({}) - - headers["Accept"] = "application/json" - - payload = await self._version.fetch_async( - method="GET", uri=self._uri, headers=headers - ) - - return SyncMapItemInstance( - self._version, - payload, - service_sid=self._solution["service_sid"], - map_sid=self._solution["map_sid"], - key=self._solution["key"], - ) - - def update( - self, data: object, if_match: Union[str, object] = values.unset - ) -> SyncMapItemInstance: - """ - Update the SyncMapItemInstance - - :param data: - :param if_match: The If-Match HTTP request header - - :returns: The updated SyncMapItemInstance - """ - - data = values.of( - { - "Data": serialize.object(data), - } - ) - headers = values.of({}) - - if not ( - if_match is values.unset or (isinstance(if_match, str) and not if_match) - ): - headers["If-Match"] = if_match - - headers["Content-Type"] = "application/x-www-form-urlencoded" - - headers["Accept"] = "application/json" - - payload = self._version.update( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return SyncMapItemInstance( - self._version, - payload, - service_sid=self._solution["service_sid"], - map_sid=self._solution["map_sid"], - key=self._solution["key"], - ) - - async def update_async( - self, data: object, if_match: Union[str, object] = values.unset - ) -> SyncMapItemInstance: - """ - Asynchronous coroutine to update the SyncMapItemInstance - - :param data: - :param if_match: The If-Match HTTP request header - - :returns: The updated SyncMapItemInstance - """ - - data = values.of( - { - "Data": serialize.object(data), - } - ) - headers = values.of({}) - - if not ( - if_match is values.unset or (isinstance(if_match, str) and not if_match) - ): - headers["If-Match"] = if_match - - headers["Content-Type"] = "application/x-www-form-urlencoded" - - headers["Accept"] = "application/json" - - payload = await self._version.update_async( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return SyncMapItemInstance( - self._version, - payload, - service_sid=self._solution["service_sid"], - map_sid=self._solution["map_sid"], - key=self._solution["key"], - ) - - 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 SyncMapItemPage(Page): - - def get_instance(self, payload: Dict[str, Any]) -> SyncMapItemInstance: - """ - Build an instance of SyncMapItemInstance - - :param payload: Payload response from the API - """ - return SyncMapItemInstance( - self._version, - payload, - service_sid=self._solution["service_sid"], - map_sid=self._solution["map_sid"], - ) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" - - -class SyncMapItemList(ListResource): - - def __init__(self, version: Version, service_sid: str, map_sid: str): - """ - Initialize the SyncMapItemList - - :param version: Version that contains the resource - :param service_sid: - :param map_sid: - - """ - super().__init__(version) - - # Path Solution - self._solution = { - "service_sid": service_sid, - "map_sid": map_sid, - } - self._uri = "/Services/{service_sid}/Maps/{map_sid}/Items".format( - **self._solution - ) - - def create(self, key: str, data: object) -> SyncMapItemInstance: - """ - Create the SyncMapItemInstance - - :param key: - :param data: - - :returns: The created SyncMapItemInstance - """ - - data = values.of( - { - "Key": key, - "Data": serialize.object(data), - } - ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Content-Type"] = "application/x-www-form-urlencoded" - - headers["Accept"] = "application/json" - - payload = self._version.create( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return SyncMapItemInstance( - self._version, - payload, - service_sid=self._solution["service_sid"], - map_sid=self._solution["map_sid"], - ) - - async def create_async(self, key: str, data: object) -> SyncMapItemInstance: - """ - Asynchronously create the SyncMapItemInstance - - :param key: - :param data: - - :returns: The created SyncMapItemInstance - """ - - data = values.of( - { - "Key": key, - "Data": serialize.object(data), - } - ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Content-Type"] = "application/x-www-form-urlencoded" - - headers["Accept"] = "application/json" - - payload = await self._version.create_async( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return SyncMapItemInstance( - self._version, - payload, - service_sid=self._solution["service_sid"], - map_sid=self._solution["map_sid"], - ) - - def stream( - self, - order: Union["SyncMapItemInstance.QueryResultOrder", object] = values.unset, - from_: Union[str, object] = values.unset, - bounds: Union["SyncMapItemInstance.QueryFromBoundType", object] = values.unset, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> Iterator[SyncMapItemInstance]: - """ - Streams SyncMapItemInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param "SyncMapItemInstance.QueryResultOrder" order: - :param str from_: - :param "SyncMapItemInstance.QueryFromBoundType" bounds: - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - """ - limits = self._version.read_limits(limit, page_size) - page = self.page( - order=order, from_=from_, bounds=bounds, page_size=limits["page_size"] - ) - - return self._version.stream(page, limits["limit"]) - - async def stream_async( - self, - order: Union["SyncMapItemInstance.QueryResultOrder", object] = values.unset, - from_: Union[str, object] = values.unset, - bounds: Union["SyncMapItemInstance.QueryFromBoundType", object] = values.unset, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> AsyncIterator[SyncMapItemInstance]: - """ - Asynchronously streams SyncMapItemInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param "SyncMapItemInstance.QueryResultOrder" order: - :param str from_: - :param "SyncMapItemInstance.QueryFromBoundType" bounds: - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - """ - limits = self._version.read_limits(limit, page_size) - page = await self.page_async( - order=order, from_=from_, bounds=bounds, page_size=limits["page_size"] - ) - - return self._version.stream_async(page, limits["limit"]) - - def list( - self, - order: Union["SyncMapItemInstance.QueryResultOrder", object] = values.unset, - from_: Union[str, object] = values.unset, - bounds: Union["SyncMapItemInstance.QueryFromBoundType", object] = values.unset, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[SyncMapItemInstance]: - """ - Lists SyncMapItemInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param "SyncMapItemInstance.QueryResultOrder" order: - :param str from_: - :param "SyncMapItemInstance.QueryFromBoundType" bounds: - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: list that will contain up to limit results - """ - return list( - self.stream( - order=order, - from_=from_, - bounds=bounds, - limit=limit, - page_size=page_size, - ) - ) - - async def list_async( - self, - order: Union["SyncMapItemInstance.QueryResultOrder", object] = values.unset, - from_: Union[str, object] = values.unset, - bounds: Union["SyncMapItemInstance.QueryFromBoundType", object] = values.unset, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[SyncMapItemInstance]: - """ - Asynchronously lists SyncMapItemInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param "SyncMapItemInstance.QueryResultOrder" order: - :param str from_: - :param "SyncMapItemInstance.QueryFromBoundType" bounds: - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: list that will contain up to limit results - """ - return [ - record - async for record in await self.stream_async( - order=order, - from_=from_, - bounds=bounds, - limit=limit, - page_size=page_size, - ) - ] - - def page( - self, - order: Union["SyncMapItemInstance.QueryResultOrder", object] = values.unset, - from_: Union[str, object] = values.unset, - bounds: Union["SyncMapItemInstance.QueryFromBoundType", object] = values.unset, - page_token: Union[str, object] = values.unset, - page_number: Union[int, object] = values.unset, - page_size: Union[int, object] = values.unset, - ) -> SyncMapItemPage: - """ - Retrieve a single page of SyncMapItemInstance records from the API. - Request is executed immediately - - :param order: - :param from_: - :param bounds: - :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 - - :returns: Page of SyncMapItemInstance - """ - data = values.of( - { - "Order": order, - "From": from_, - "Bounds": bounds, - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Accept"] = "application/json" - - response = self._version.page( - method="GET", uri=self._uri, params=data, headers=headers - ) - return SyncMapItemPage(self._version, response, self._solution) - - async def page_async( - self, - order: Union["SyncMapItemInstance.QueryResultOrder", object] = values.unset, - from_: Union[str, object] = values.unset, - bounds: Union["SyncMapItemInstance.QueryFromBoundType", object] = values.unset, - page_token: Union[str, object] = values.unset, - page_number: Union[int, object] = values.unset, - page_size: Union[int, object] = values.unset, - ) -> SyncMapItemPage: - """ - Asynchronously retrieve a single page of SyncMapItemInstance records from the API. - Request is executed immediately - - :param order: - :param from_: - :param bounds: - :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 - - :returns: Page of SyncMapItemInstance - """ - data = values.of( - { - "Order": order, - "From": from_, - "Bounds": bounds, - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Accept"] = "application/json" - - response = await self._version.page_async( - method="GET", uri=self._uri, params=data, headers=headers - ) - return SyncMapItemPage(self._version, response, self._solution) - - def get_page(self, target_url: str) -> SyncMapItemPage: - """ - Retrieve a specific page of SyncMapItemInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of SyncMapItemInstance - """ - response = self._version.domain.twilio.request("GET", target_url) - return SyncMapItemPage(self._version, response, self._solution) - - async def get_page_async(self, target_url: str) -> SyncMapItemPage: - """ - Asynchronously retrieve a specific page of SyncMapItemInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of SyncMapItemInstance - """ - response = await self._version.domain.twilio.request_async("GET", target_url) - return SyncMapItemPage(self._version, response, self._solution) - - def get(self, key: str) -> SyncMapItemContext: - """ - Constructs a SyncMapItemContext - - :param key: - """ - return SyncMapItemContext( - self._version, - service_sid=self._solution["service_sid"], - map_sid=self._solution["map_sid"], - key=key, - ) - - def __call__(self, key: str) -> SyncMapItemContext: - """ - Constructs a SyncMapItemContext - - :param key: - """ - return SyncMapItemContext( - self._version, - service_sid=self._solution["service_sid"], - map_sid=self._solution["map_sid"], - key=key, - ) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" diff --git a/twilio/rest/preview/sync/service/sync_map/sync_map_permission.py b/twilio/rest/preview/sync/service/sync_map/sync_map_permission.py deleted file mode 100644 index 9e19d56a91..0000000000 --- a/twilio/rest/preview/sync/service/sync_map/sync_map_permission.py +++ /dev/null @@ -1,615 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Preview - 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, Union, Iterator, AsyncIterator -from twilio.base import serialize, values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.version import Version -from twilio.base.page import Page - - -class SyncMapPermissionInstance(InstanceResource): - """ - :ivar account_sid: The unique SID identifier of the Twilio Account. - :ivar service_sid: The unique SID identifier of the Sync Service Instance. - :ivar map_sid: The unique SID identifier of the Sync Map to which the Permission applies. - :ivar identity: Arbitrary string identifier representing a human user associated with an FPA token, assigned by the developer. - :ivar read: Boolean flag specifying whether the identity can read the Sync Map and its Items. - :ivar write: Boolean flag specifying whether the identity can create, update and delete Items of the Sync Map. - :ivar manage: Boolean flag specifying whether the identity can delete the Sync Map. - :ivar url: Contains an absolute URL for this Sync Map Permission. - """ - - def __init__( - self, - version: Version, - payload: Dict[str, Any], - service_sid: str, - map_sid: str, - identity: Optional[str] = None, - ): - super().__init__(version) - - self.account_sid: Optional[str] = payload.get("account_sid") - self.service_sid: Optional[str] = payload.get("service_sid") - self.map_sid: Optional[str] = payload.get("map_sid") - self.identity: Optional[str] = payload.get("identity") - self.read: Optional[bool] = payload.get("read") - self.write: Optional[bool] = payload.get("write") - self.manage: Optional[bool] = payload.get("manage") - self.url: Optional[str] = payload.get("url") - - self._solution = { - "service_sid": service_sid, - "map_sid": map_sid, - "identity": identity or self.identity, - } - self._context: Optional[SyncMapPermissionContext] = None - - @property - def _proxy(self) -> "SyncMapPermissionContext": - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SyncMapPermissionContext for this SyncMapPermissionInstance - """ - if self._context is None: - self._context = SyncMapPermissionContext( - self._version, - service_sid=self._solution["service_sid"], - map_sid=self._solution["map_sid"], - identity=self._solution["identity"], - ) - return self._context - - def delete(self) -> bool: - """ - Deletes the SyncMapPermissionInstance - - - :returns: True if delete succeeds, False otherwise - """ - return self._proxy.delete() - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the SyncMapPermissionInstance - - - :returns: True if delete succeeds, False otherwise - """ - return await self._proxy.delete_async() - - def fetch(self) -> "SyncMapPermissionInstance": - """ - Fetch the SyncMapPermissionInstance - - - :returns: The fetched SyncMapPermissionInstance - """ - return self._proxy.fetch() - - async def fetch_async(self) -> "SyncMapPermissionInstance": - """ - Asynchronous coroutine to fetch the SyncMapPermissionInstance - - - :returns: The fetched SyncMapPermissionInstance - """ - return await self._proxy.fetch_async() - - def update( - self, read: bool, write: bool, manage: bool - ) -> "SyncMapPermissionInstance": - """ - Update the SyncMapPermissionInstance - - :param read: Boolean flag specifying whether the identity can read the Sync Map. - :param write: Boolean flag specifying whether the identity can create, update and delete Items of the Sync Map. - :param manage: Boolean flag specifying whether the identity can delete the Sync Map. - - :returns: The updated SyncMapPermissionInstance - """ - return self._proxy.update( - read=read, - write=write, - manage=manage, - ) - - async def update_async( - self, read: bool, write: bool, manage: bool - ) -> "SyncMapPermissionInstance": - """ - Asynchronous coroutine to update the SyncMapPermissionInstance - - :param read: Boolean flag specifying whether the identity can read the Sync Map. - :param write: Boolean flag specifying whether the identity can create, update and delete Items of the Sync Map. - :param manage: Boolean flag specifying whether the identity can delete the Sync Map. - - :returns: The updated SyncMapPermissionInstance - """ - return await self._proxy.update_async( - read=read, - write=write, - manage=manage, - ) - - 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 SyncMapPermissionContext(InstanceContext): - - def __init__(self, version: Version, service_sid: str, map_sid: str, identity: str): - """ - Initialize the SyncMapPermissionContext - - :param version: Version that contains the resource - :param service_sid: The unique SID identifier of the Sync Service Instance. - :param map_sid: Identifier of the Sync Map. Either a SID or a unique name. - :param identity: Arbitrary string identifier representing a human user associated with an FPA token, assigned by the developer. - """ - super().__init__(version) - - # Path Solution - self._solution = { - "service_sid": service_sid, - "map_sid": map_sid, - "identity": identity, - } - self._uri = ( - "/Services/{service_sid}/Maps/{map_sid}/Permissions/{identity}".format( - **self._solution - ) - ) - - def delete(self) -> bool: - """ - Deletes the SyncMapPermissionInstance - - - :returns: True if delete succeeds, False otherwise - """ - - headers = values.of({}) - - return self._version.delete(method="DELETE", uri=self._uri, headers=headers) - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the SyncMapPermissionInstance - - - :returns: True if delete succeeds, False otherwise - """ - - headers = values.of({}) - - return await self._version.delete_async( - method="DELETE", uri=self._uri, headers=headers - ) - - def fetch(self) -> SyncMapPermissionInstance: - """ - Fetch the SyncMapPermissionInstance - - - :returns: The fetched SyncMapPermissionInstance - """ - - headers = values.of({}) - - headers["Accept"] = "application/json" - - payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) - - return SyncMapPermissionInstance( - self._version, - payload, - service_sid=self._solution["service_sid"], - map_sid=self._solution["map_sid"], - identity=self._solution["identity"], - ) - - async def fetch_async(self) -> SyncMapPermissionInstance: - """ - Asynchronous coroutine to fetch the SyncMapPermissionInstance - - - :returns: The fetched SyncMapPermissionInstance - """ - - headers = values.of({}) - - headers["Accept"] = "application/json" - - payload = await self._version.fetch_async( - method="GET", uri=self._uri, headers=headers - ) - - return SyncMapPermissionInstance( - self._version, - payload, - service_sid=self._solution["service_sid"], - map_sid=self._solution["map_sid"], - identity=self._solution["identity"], - ) - - def update( - self, read: bool, write: bool, manage: bool - ) -> SyncMapPermissionInstance: - """ - Update the SyncMapPermissionInstance - - :param read: Boolean flag specifying whether the identity can read the Sync Map. - :param write: Boolean flag specifying whether the identity can create, update and delete Items of the Sync Map. - :param manage: Boolean flag specifying whether the identity can delete the Sync Map. - - :returns: The updated SyncMapPermissionInstance - """ - - data = values.of( - { - "Read": serialize.boolean_to_string(read), - "Write": serialize.boolean_to_string(write), - "Manage": serialize.boolean_to_string(manage), - } - ) - headers = values.of({}) - - headers["Content-Type"] = "application/x-www-form-urlencoded" - - headers["Accept"] = "application/json" - - payload = self._version.update( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return SyncMapPermissionInstance( - self._version, - payload, - service_sid=self._solution["service_sid"], - map_sid=self._solution["map_sid"], - identity=self._solution["identity"], - ) - - async def update_async( - self, read: bool, write: bool, manage: bool - ) -> SyncMapPermissionInstance: - """ - Asynchronous coroutine to update the SyncMapPermissionInstance - - :param read: Boolean flag specifying whether the identity can read the Sync Map. - :param write: Boolean flag specifying whether the identity can create, update and delete Items of the Sync Map. - :param manage: Boolean flag specifying whether the identity can delete the Sync Map. - - :returns: The updated SyncMapPermissionInstance - """ - - data = values.of( - { - "Read": serialize.boolean_to_string(read), - "Write": serialize.boolean_to_string(write), - "Manage": serialize.boolean_to_string(manage), - } - ) - headers = values.of({}) - - headers["Content-Type"] = "application/x-www-form-urlencoded" - - headers["Accept"] = "application/json" - - payload = await self._version.update_async( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return SyncMapPermissionInstance( - self._version, - payload, - service_sid=self._solution["service_sid"], - map_sid=self._solution["map_sid"], - identity=self._solution["identity"], - ) - - 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 SyncMapPermissionPage(Page): - - def get_instance(self, payload: Dict[str, Any]) -> SyncMapPermissionInstance: - """ - Build an instance of SyncMapPermissionInstance - - :param payload: Payload response from the API - """ - return SyncMapPermissionInstance( - self._version, - payload, - service_sid=self._solution["service_sid"], - map_sid=self._solution["map_sid"], - ) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" - - -class SyncMapPermissionList(ListResource): - - def __init__(self, version: Version, service_sid: str, map_sid: str): - """ - Initialize the SyncMapPermissionList - - :param version: Version that contains the resource - :param service_sid: - :param map_sid: Identifier of the Sync Map. Either a SID or a unique name. - - """ - super().__init__(version) - - # Path Solution - self._solution = { - "service_sid": service_sid, - "map_sid": map_sid, - } - self._uri = "/Services/{service_sid}/Maps/{map_sid}/Permissions".format( - **self._solution - ) - - def stream( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> Iterator[SyncMapPermissionInstance]: - """ - Streams SyncMapPermissionInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - """ - limits = self._version.read_limits(limit, page_size) - page = self.page(page_size=limits["page_size"]) - - return self._version.stream(page, limits["limit"]) - - async def stream_async( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> AsyncIterator[SyncMapPermissionInstance]: - """ - Asynchronously streams SyncMapPermissionInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, stream() will attempt to read the - limit with the most efficient page size, i.e. min(limit, 1000) - - :returns: Generator that will yield up to limit results - """ - limits = self._version.read_limits(limit, page_size) - page = await self.page_async(page_size=limits["page_size"]) - - return self._version.stream_async(page, limits["limit"]) - - def list( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[SyncMapPermissionInstance]: - """ - Lists SyncMapPermissionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: list that will contain up to limit results - """ - return list( - self.stream( - limit=limit, - page_size=page_size, - ) - ) - - async def list_async( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[SyncMapPermissionInstance]: - """ - Asynchronously lists SyncMapPermissionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :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 - the default value of 50 records. If no page_size is defined - but a limit is defined, list() will attempt to read the limit - with the most efficient page size, i.e. min(limit, 1000) - - :returns: list that will contain up to limit results - """ - return [ - record - async for record in await self.stream_async( - limit=limit, - page_size=page_size, - ) - ] - - def page( - self, - page_token: Union[str, object] = values.unset, - page_number: Union[int, object] = values.unset, - page_size: Union[int, object] = values.unset, - ) -> SyncMapPermissionPage: - """ - Retrieve a single page of SyncMapPermissionInstance records from the API. - Request is executed immediately - - :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 - - :returns: Page of SyncMapPermissionInstance - """ - data = values.of( - { - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Accept"] = "application/json" - - response = self._version.page( - method="GET", uri=self._uri, params=data, headers=headers - ) - return SyncMapPermissionPage(self._version, response, self._solution) - - async def page_async( - self, - page_token: Union[str, object] = values.unset, - page_number: Union[int, object] = values.unset, - page_size: Union[int, object] = values.unset, - ) -> SyncMapPermissionPage: - """ - Asynchronously retrieve a single page of SyncMapPermissionInstance records from the API. - Request is executed immediately - - :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 - - :returns: Page of SyncMapPermissionInstance - """ - data = values.of( - { - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Accept"] = "application/json" - - response = await self._version.page_async( - method="GET", uri=self._uri, params=data, headers=headers - ) - return SyncMapPermissionPage(self._version, response, self._solution) - - def get_page(self, target_url: str) -> SyncMapPermissionPage: - """ - Retrieve a specific page of SyncMapPermissionInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of SyncMapPermissionInstance - """ - response = self._version.domain.twilio.request("GET", target_url) - return SyncMapPermissionPage(self._version, response, self._solution) - - async def get_page_async(self, target_url: str) -> SyncMapPermissionPage: - """ - Asynchronously retrieve a specific page of SyncMapPermissionInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of SyncMapPermissionInstance - """ - response = await self._version.domain.twilio.request_async("GET", target_url) - return SyncMapPermissionPage(self._version, response, self._solution) - - def get(self, identity: str) -> SyncMapPermissionContext: - """ - Constructs a SyncMapPermissionContext - - :param identity: Arbitrary string identifier representing a human user associated with an FPA token, assigned by the developer. - """ - return SyncMapPermissionContext( - self._version, - service_sid=self._solution["service_sid"], - map_sid=self._solution["map_sid"], - identity=identity, - ) - - def __call__(self, identity: str) -> SyncMapPermissionContext: - """ - Constructs a SyncMapPermissionContext - - :param identity: Arbitrary string identifier representing a human user associated with an FPA token, assigned by the developer. - """ - return SyncMapPermissionContext( - self._version, - service_sid=self._solution["service_sid"], - map_sid=self._solution["map_sid"], - identity=identity, - ) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" diff --git a/twilio/rest/taskrouter/v1/workspace/task/reservation.py b/twilio/rest/taskrouter/v1/workspace/task/reservation.py index 5318543ea2..28cb03339a 100644 --- a/twilio/rest/taskrouter/v1/workspace/task/reservation.py +++ b/twilio/rest/taskrouter/v1/workspace/task/reservation.py @@ -250,7 +250,7 @@ def update( :param recording_status_callback_method: The HTTP method we should use when we call `recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. :param conference_recording_status_callback: The URL we should call using the `conference_recording_status_callback_method` when the conference recording is available. :param conference_recording_status_callback_method: The HTTP method we should use to call `conference_recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. - :param region: The [region](https://support.twilio.com/hc/en-us/articles/223132167-How-global-low-latency-routing-and-region-selection-work-for-conferences-and-Client-calls) where we should mix the recorded audio. Can be:`us1`, `ie1`, `de1`, `sg1`, `br1`, `au1`, or `jp1`. + :param region: The [region](https://support.twilio.com/hc/en-us/articles/223132167-How-global-low-latency-routing-and-region-selection-work-for-conferences-and-Client-calls) where we should mix the recorded audio. Can be:`us1`, `us2`, `ie1`, `de1`, `sg1`, `br1`, `au1`, or `jp1`. :param sip_auth_username: The SIP username used for authentication. :param sip_auth_password: The SIP password for authentication. :param dequeue_status_callback_event: The Call progress events sent via webhooks as a result of a Dequeue instruction. @@ -433,7 +433,7 @@ async def update_async( :param recording_status_callback_method: The HTTP method we should use when we call `recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. :param conference_recording_status_callback: The URL we should call using the `conference_recording_status_callback_method` when the conference recording is available. :param conference_recording_status_callback_method: The HTTP method we should use to call `conference_recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. - :param region: The [region](https://support.twilio.com/hc/en-us/articles/223132167-How-global-low-latency-routing-and-region-selection-work-for-conferences-and-Client-calls) where we should mix the recorded audio. Can be:`us1`, `ie1`, `de1`, `sg1`, `br1`, `au1`, or `jp1`. + :param region: The [region](https://support.twilio.com/hc/en-us/articles/223132167-How-global-low-latency-routing-and-region-selection-work-for-conferences-and-Client-calls) where we should mix the recorded audio. Can be:`us1`, `us2`, `ie1`, `de1`, `sg1`, `br1`, `au1`, or `jp1`. :param sip_auth_username: The SIP username used for authentication. :param sip_auth_password: The SIP password for authentication. :param dequeue_status_callback_event: The Call progress events sent via webhooks as a result of a Dequeue instruction. @@ -697,7 +697,7 @@ def update( :param recording_status_callback_method: The HTTP method we should use when we call `recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. :param conference_recording_status_callback: The URL we should call using the `conference_recording_status_callback_method` when the conference recording is available. :param conference_recording_status_callback_method: The HTTP method we should use to call `conference_recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. - :param region: The [region](https://support.twilio.com/hc/en-us/articles/223132167-How-global-low-latency-routing-and-region-selection-work-for-conferences-and-Client-calls) where we should mix the recorded audio. Can be:`us1`, `ie1`, `de1`, `sg1`, `br1`, `au1`, or `jp1`. + :param region: The [region](https://support.twilio.com/hc/en-us/articles/223132167-How-global-low-latency-routing-and-region-selection-work-for-conferences-and-Client-calls) where we should mix the recorded audio. Can be:`us1`, `us2`, `ie1`, `de1`, `sg1`, `br1`, `au1`, or `jp1`. :param sip_auth_username: The SIP username used for authentication. :param sip_auth_password: The SIP password for authentication. :param dequeue_status_callback_event: The Call progress events sent via webhooks as a result of a Dequeue instruction. @@ -918,7 +918,7 @@ async def update_async( :param recording_status_callback_method: The HTTP method we should use when we call `recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. :param conference_recording_status_callback: The URL we should call using the `conference_recording_status_callback_method` when the conference recording is available. :param conference_recording_status_callback_method: The HTTP method we should use to call `conference_recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. - :param region: The [region](https://support.twilio.com/hc/en-us/articles/223132167-How-global-low-latency-routing-and-region-selection-work-for-conferences-and-Client-calls) where we should mix the recorded audio. Can be:`us1`, `ie1`, `de1`, `sg1`, `br1`, `au1`, or `jp1`. + :param region: The [region](https://support.twilio.com/hc/en-us/articles/223132167-How-global-low-latency-routing-and-region-selection-work-for-conferences-and-Client-calls) where we should mix the recorded audio. Can be:`us1`, `us2`, `ie1`, `de1`, `sg1`, `br1`, `au1`, or `jp1`. :param sip_auth_username: The SIP username used for authentication. :param sip_auth_password: The SIP password for authentication. :param dequeue_status_callback_event: The Call progress events sent via webhooks as a result of a Dequeue instruction. diff --git a/twilio/rest/taskrouter/v1/workspace/worker/reservation.py b/twilio/rest/taskrouter/v1/workspace/worker/reservation.py index 11d1ea610d..7f24057806 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/reservation.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/reservation.py @@ -241,7 +241,7 @@ def update( :param recording_status_callback_method: The HTTP method we should use when we call `recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. :param conference_recording_status_callback: The URL we should call using the `conference_recording_status_callback_method` when the conference recording is available. :param conference_recording_status_callback_method: The HTTP method we should use to call `conference_recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. - :param region: The [region](https://support.twilio.com/hc/en-us/articles/223132167-How-global-low-latency-routing-and-region-selection-work-for-conferences-and-Client-calls) where we should mix the recorded audio. Can be:`us1`, `ie1`, `de1`, `sg1`, `br1`, `au1`, or `jp1`. + :param region: The [region](https://support.twilio.com/hc/en-us/articles/223132167-How-global-low-latency-routing-and-region-selection-work-for-conferences-and-Client-calls) where we should mix the recorded audio. Can be:`us1`, `us2`, `ie1`, `de1`, `sg1`, `br1`, `au1`, or `jp1`. :param sip_auth_username: The SIP username used for authentication. :param sip_auth_password: The SIP password for authentication. :param dequeue_status_callback_event: The call progress events sent via webhooks as a result of a Dequeue instruction. @@ -416,7 +416,7 @@ async def update_async( :param recording_status_callback_method: The HTTP method we should use when we call `recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. :param conference_recording_status_callback: The URL we should call using the `conference_recording_status_callback_method` when the conference recording is available. :param conference_recording_status_callback_method: The HTTP method we should use to call `conference_recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. - :param region: The [region](https://support.twilio.com/hc/en-us/articles/223132167-How-global-low-latency-routing-and-region-selection-work-for-conferences-and-Client-calls) where we should mix the recorded audio. Can be:`us1`, `ie1`, `de1`, `sg1`, `br1`, `au1`, or `jp1`. + :param region: The [region](https://support.twilio.com/hc/en-us/articles/223132167-How-global-low-latency-routing-and-region-selection-work-for-conferences-and-Client-calls) where we should mix the recorded audio. Can be:`us1`, `us2`, `ie1`, `de1`, `sg1`, `br1`, `au1`, or `jp1`. :param sip_auth_username: The SIP username used for authentication. :param sip_auth_password: The SIP password for authentication. :param dequeue_status_callback_event: The call progress events sent via webhooks as a result of a Dequeue instruction. @@ -670,7 +670,7 @@ def update( :param recording_status_callback_method: The HTTP method we should use when we call `recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. :param conference_recording_status_callback: The URL we should call using the `conference_recording_status_callback_method` when the conference recording is available. :param conference_recording_status_callback_method: The HTTP method we should use to call `conference_recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. - :param region: The [region](https://support.twilio.com/hc/en-us/articles/223132167-How-global-low-latency-routing-and-region-selection-work-for-conferences-and-Client-calls) where we should mix the recorded audio. Can be:`us1`, `ie1`, `de1`, `sg1`, `br1`, `au1`, or `jp1`. + :param region: The [region](https://support.twilio.com/hc/en-us/articles/223132167-How-global-low-latency-routing-and-region-selection-work-for-conferences-and-Client-calls) where we should mix the recorded audio. Can be:`us1`, `us2`, `ie1`, `de1`, `sg1`, `br1`, `au1`, or `jp1`. :param sip_auth_username: The SIP username used for authentication. :param sip_auth_password: The SIP password for authentication. :param dequeue_status_callback_event: The call progress events sent via webhooks as a result of a Dequeue instruction. @@ -883,7 +883,7 @@ async def update_async( :param recording_status_callback_method: The HTTP method we should use when we call `recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. :param conference_recording_status_callback: The URL we should call using the `conference_recording_status_callback_method` when the conference recording is available. :param conference_recording_status_callback_method: The HTTP method we should use to call `conference_recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. - :param region: The [region](https://support.twilio.com/hc/en-us/articles/223132167-How-global-low-latency-routing-and-region-selection-work-for-conferences-and-Client-calls) where we should mix the recorded audio. Can be:`us1`, `ie1`, `de1`, `sg1`, `br1`, `au1`, or `jp1`. + :param region: The [region](https://support.twilio.com/hc/en-us/articles/223132167-How-global-low-latency-routing-and-region-selection-work-for-conferences-and-Client-calls) where we should mix the recorded audio. Can be:`us1`, `us2`, `ie1`, `de1`, `sg1`, `br1`, `au1`, or `jp1`. :param sip_auth_username: The SIP username used for authentication. :param sip_auth_password: The SIP password for authentication. :param dequeue_status_callback_event: The call progress events sent via webhooks as a result of a Dequeue instruction. diff --git a/twilio/rest/video/v1/room/participant/__init__.py b/twilio/rest/video/v1/room/participant/__init__.py index 756a166eae..7e012e8d37 100644 --- a/twilio/rest/video/v1/room/participant/__init__.py +++ b/twilio/rest/video/v1/room/participant/__init__.py @@ -31,6 +31,7 @@ class ParticipantInstance(InstanceResource): class Status(object): CONNECTED = "connected" DISCONNECTED = "disconnected" + RECONNECTING = "reconnecting" """ :ivar sid: The unique string that we created to identify the RoomParticipant resource. diff --git a/twilio/rest/wireless/v1/rate_plan.py b/twilio/rest/wireless/v1/rate_plan.py index 458ade0ad5..23efabe9b0 100644 --- a/twilio/rest/wireless/v1/rate_plan.py +++ b/twilio/rest/wireless/v1/rate_plan.py @@ -23,6 +23,11 @@ class RatePlanInstance(InstanceResource): + + class DataLimitStrategy(object): + BLOCK = "block" + THROTTLE = "throttle" + """ :ivar sid: The unique string that we created to identify the RatePlan resource. :ivar unique_name: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. @@ -382,6 +387,9 @@ def create( international_roaming: Union[List[str], object] = values.unset, national_roaming_data_limit: Union[int, object] = values.unset, international_roaming_data_limit: Union[int, object] = values.unset, + data_limit_strategy: Union[ + "RatePlanInstance.DataLimitStrategy", object + ] = values.unset, ) -> RatePlanInstance: """ Create the RatePlanInstance @@ -397,6 +405,7 @@ def create( :param international_roaming: The list of services that SIMs capable of using GPRS/3G/4G/LTE data connectivity can use outside of the United States. Can contain: `data` and `messaging`. :param national_roaming_data_limit: The total data usage (download and upload combined) in Megabytes that the Network allows during one month on non-home networks in the United States. The metering period begins the day of activation and ends on the same day in the following month. Can be up to 2TB. See [national roaming](https://www.twilio.com/docs/iot/wireless/api/rateplan-resource#national-roaming) for more info. :param international_roaming_data_limit: The total data usage (download and upload combined) in Megabytes that the Network allows during one month when roaming outside the United States. Can be up to 2TB. + :param data_limit_strategy: :returns: The created RatePlanInstance """ @@ -418,6 +427,7 @@ def create( ), "NationalRoamingDataLimit": national_roaming_data_limit, "InternationalRoamingDataLimit": international_roaming_data_limit, + "DataLimitStrategy": data_limit_strategy, } ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -445,6 +455,9 @@ async def create_async( international_roaming: Union[List[str], object] = values.unset, national_roaming_data_limit: Union[int, object] = values.unset, international_roaming_data_limit: Union[int, object] = values.unset, + data_limit_strategy: Union[ + "RatePlanInstance.DataLimitStrategy", object + ] = values.unset, ) -> RatePlanInstance: """ Asynchronously create the RatePlanInstance @@ -460,6 +473,7 @@ async def create_async( :param international_roaming: The list of services that SIMs capable of using GPRS/3G/4G/LTE data connectivity can use outside of the United States. Can contain: `data` and `messaging`. :param national_roaming_data_limit: The total data usage (download and upload combined) in Megabytes that the Network allows during one month on non-home networks in the United States. The metering period begins the day of activation and ends on the same day in the following month. Can be up to 2TB. See [national roaming](https://www.twilio.com/docs/iot/wireless/api/rateplan-resource#national-roaming) for more info. :param international_roaming_data_limit: The total data usage (download and upload combined) in Megabytes that the Network allows during one month when roaming outside the United States. Can be up to 2TB. + :param data_limit_strategy: :returns: The created RatePlanInstance """ @@ -481,6 +495,7 @@ async def create_async( ), "NationalRoamingDataLimit": national_roaming_data_limit, "InternationalRoamingDataLimit": international_roaming_data_limit, + "DataLimitStrategy": data_limit_strategy, } ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) From bf3e6da59d767eb752131c2298fb173673ca7c6a Mon Sep 17 00:00:00 2001 From: Twilio Date: Thu, 20 Mar 2025 10:29:14 +0000 Subject: [PATCH 79/87] Release 9.5.1 --- setup.py | 2 +- twilio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index fc58de0ec1..6784744561 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name="twilio", - version="9.5.0", + version="9.5.1", description="Twilio API client and TwiML generator", author="Twilio", help_center="https://www.twilio.com/help/contact", diff --git a/twilio/__init__.py b/twilio/__init__.py index b2bf5772dd..13ccdd0b0d 100644 --- a/twilio/__init__.py +++ b/twilio/__init__.py @@ -1,2 +1,2 @@ -__version_info__ = ("9", "5", "0") +__version_info__ = ("9", "5", "1") __version__ = ".".join(__version_info__) From e57d156b9ea07f8342fe4adbb6da12d4cdcb1ee2 Mon Sep 17 00:00:00 2001 From: Twilio Date: Mon, 7 Apr 2025 12:38:16 +0000 Subject: [PATCH 80/87] [Librarian] Regenerated @ e229c81d086276743ccce5ac8e1e19c4ad654adb 190899e14f985d8b58f0b5a70c5f7156b7333d28 --- CHANGES.md | 6 + twilio/rest/__init__.py | 15 + twilio/rest/knowledge/KnowledgeBase.py | 44 + twilio/rest/knowledge/v1/__init__.py | 43 + .../rest/knowledge/v1/knowledge/__init__.py | 935 ++++++++++++++++++ twilio/rest/knowledge/v1/knowledge/chunk.py | 297 ++++++ .../v1/knowledge/knowledge_status.py | 196 ++++ twilio/rest/lookups/v1/phone_number.py | 8 +- twilio/rest/monitor/v1/event.py | 2 +- .../v1/flow/engagement/step/__init__.py | 2 + .../flow/execution/execution_step/__init__.py | 2 + .../flow/execution/execution_step/__init__.py | 2 + 12 files changed, 1547 insertions(+), 5 deletions(-) create mode 100644 twilio/rest/knowledge/KnowledgeBase.py create mode 100644 twilio/rest/knowledge/v1/__init__.py create mode 100644 twilio/rest/knowledge/v1/knowledge/__init__.py create mode 100644 twilio/rest/knowledge/v1/knowledge/chunk.py create mode 100644 twilio/rest/knowledge/v1/knowledge/knowledge_status.py diff --git a/CHANGES.md b/CHANGES.md index a985cb3245..c3e678a6a0 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,12 @@ twilio-python Changelog Here you can see the full list of changes between each twilio-python release. +[2025-04-07] Version 9.5.2 +-------------------------- +**Studio** +- Add documentation for parent_step_sid field in Step resource + + [2025-03-20] Version 9.5.1 -------------------------- **Accounts** diff --git a/twilio/rest/__init__.py b/twilio/rest/__init__.py index 5838363c52..dc7741180b 100644 --- a/twilio/rest/__init__.py +++ b/twilio/rest/__init__.py @@ -29,6 +29,7 @@ from twilio.rest.insights import Insights from twilio.rest.intelligence import Intelligence from twilio.rest.ip_messaging import IpMessaging + from twilio.rest.knowledge import Knowledge from twilio.rest.lookups import Lookups from twilio.rest.marketplace import Marketplace from twilio.rest.messaging import Messaging @@ -142,6 +143,7 @@ def __init__( self._insights: Optional["Insights"] = None self._intelligence: Optional["Intelligence"] = None self._ip_messaging: Optional["IpMessaging"] = None + self._knowledge: Optional["Knowledge"] = None self._lookups: Optional["Lookups"] = None self._marketplace: Optional["Marketplace"] = None self._messaging: Optional["Messaging"] = None @@ -361,6 +363,19 @@ def ip_messaging(self) -> "IpMessaging": self._ip_messaging = IpMessaging(self) return self._ip_messaging + @property + def knowledge(self) -> "Knowledge": + """ + Access the Knowledge Twilio Domain + + :returns: Knowledge Twilio Domain + """ + if self._knowledge is None: + from twilio.rest.knowledge import Knowledge + + self._knowledge = Knowledge(self) + return self._knowledge + @property def lookups(self) -> "Lookups": """ diff --git a/twilio/rest/knowledge/KnowledgeBase.py b/twilio/rest/knowledge/KnowledgeBase.py new file mode 100644 index 0000000000..902f0e8b96 --- /dev/null +++ b/twilio/rest/knowledge/KnowledgeBase.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.knowledge.v1 import V1 + + +class KnowledgeBase(Domain): + + def __init__(self, twilio: Client): + """ + Initialize the Knowledge Domain + + :returns: Domain for Knowledge + """ + super().__init__(twilio, "https://knowledge.twilio.com") + self._v1: Optional[V1] = None + + @property + def v1(self) -> V1: + """ + :returns: Versions v1 of Knowledge + """ + 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/knowledge/v1/__init__.py b/twilio/rest/knowledge/v1/__init__.py new file mode 100644 index 0000000000..9609bff951 --- /dev/null +++ b/twilio/rest/knowledge/v1/__init__.py @@ -0,0 +1,43 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Knowledge + 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 Optional +from twilio.base.version import Version +from twilio.base.domain import Domain +from twilio.rest.knowledge.v1.knowledge import KnowledgeList + + +class V1(Version): + + def __init__(self, domain: Domain): + """ + Initialize the V1 version of Knowledge + + :param domain: The Twilio.knowledge domain + """ + super().__init__(domain, "v1") + self._knowledge: Optional[KnowledgeList] = None + + @property + def knowledge(self) -> KnowledgeList: + if self._knowledge is None: + self._knowledge = KnowledgeList(self) + return self._knowledge + + def __repr__(self) -> str: + """ + Provide a friendly representation + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/knowledge/v1/knowledge/__init__.py b/twilio/rest/knowledge/v1/knowledge/__init__.py new file mode 100644 index 0000000000..8ba6b2c481 --- /dev/null +++ b/twilio/rest/knowledge/v1/knowledge/__init__.py @@ -0,0 +1,935 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Knowledge + 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 datetime import datetime +from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator +from twilio.base import deserialize, values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version +from twilio.base.page import Page +from twilio.rest.knowledge.v1.knowledge.chunk import ChunkList +from twilio.rest.knowledge.v1.knowledge.knowledge_status import KnowledgeStatusList + + +class KnowledgeInstance(InstanceResource): + + class KnowledgeV1ServiceCreateKnowledgeRequest(object): + """ + :ivar description: The description of the knowledge source. + :ivar knowledge_source_details: The details of the knowledge source based on the type. + :ivar name: The name of the tool. + :ivar policy: + :ivar type: The type of the knowledge source. + :ivar embedding_model: The embedding model to be used for the knowledge source. It's required for 'Database' type but disallowed for other types. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.description: Optional[str] = payload.get("description") + self.knowledge_source_details: Optional[Dict[str, object]] = payload.get( + "knowledge_source_details" + ) + self.name: Optional[str] = payload.get("name") + self.policy: Optional[ + KnowledgeList.KnowledgeV1ServiceCreatePolicyRequest + ] = payload.get("policy") + self.type: Optional[str] = payload.get("type") + self.embedding_model: Optional[str] = payload.get("embedding_model") + + def to_dict(self): + return { + "description": self.description, + "knowledge_source_details": self.knowledge_source_details, + "name": self.name, + "policy": self.policy.to_dict() if self.policy is not None else None, + "type": self.type, + "embedding_model": self.embedding_model, + } + + class KnowledgeV1ServiceCreatePolicyRequest(object): + """ + :ivar description: The description of the policy. + :ivar id: The Policy ID. + :ivar name: The name of the policy. + :ivar policy_details: + :ivar type: The description of the policy. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.description: Optional[str] = payload.get("description") + self.id: Optional[str] = payload.get("id") + self.name: Optional[str] = payload.get("name") + self.policy_details: Optional[Dict[str, object]] = payload.get( + "policy_details" + ) + self.type: Optional[str] = payload.get("type") + + def to_dict(self): + return { + "description": self.description, + "id": self.id, + "name": self.name, + "policy_details": self.policy_details, + "type": self.type, + } + + class KnowledgeV1ServiceUpdateKnowledgeRequest(object): + """ + :ivar description: The description of the knowledge source. + :ivar knowledge_source_details: The details of the knowledge source based on the type. + :ivar name: The name of the knowledge source. + :ivar policy: + :ivar type: The description of the knowledge source. + :ivar embedding_model: The embedding model to be used for the knowledge source. It's only applicable to 'Database' type. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.description: Optional[str] = payload.get("description") + self.knowledge_source_details: Optional[Dict[str, object]] = payload.get( + "knowledge_source_details" + ) + self.name: Optional[str] = payload.get("name") + self.policy: Optional[ + KnowledgeList.KnowledgeV1ServiceCreatePolicyRequest + ] = payload.get("policy") + self.type: Optional[str] = payload.get("type") + self.embedding_model: Optional[str] = payload.get("embedding_model") + + def to_dict(self): + return { + "description": self.description, + "knowledge_source_details": self.knowledge_source_details, + "name": self.name, + "policy": self.policy.to_dict() if self.policy is not None else None, + "type": self.type, + "embedding_model": self.embedding_model, + } + + """ + :ivar description: The type of knowledge source. + :ivar id: The description of knowledge. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Knowledge resource. + :ivar knowledge_source_details: The details of the knowledge source based on the type. + :ivar name: The name of the knowledge source. + :ivar status: The status of processing the knowledge source ('QUEUED', 'PROCESSING', 'COMPLETED', 'FAILED') + :ivar type: The type of knowledge source ('Web', 'Database', 'Text', 'File') + :ivar url: The url of the knowledge resource. + :ivar embedding_model: The embedding model to be used for the knowledge source. + :ivar date_created: The date and time in GMT when the Knowledge was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date and time in GMT when the Knowledge was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], id: Optional[str] = None + ): + super().__init__(version) + + self.description: Optional[str] = payload.get("description") + self.id: Optional[str] = payload.get("id") + self.account_sid: Optional[str] = payload.get("account_sid") + self.knowledge_source_details: Optional[Dict[str, object]] = payload.get( + "knowledge_source_details" + ) + self.name: Optional[str] = payload.get("name") + self.status: Optional[str] = payload.get("status") + self.type: Optional[str] = payload.get("type") + self.url: Optional[str] = payload.get("url") + self.embedding_model: Optional[str] = payload.get("embedding_model") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + + self._solution = { + "id": id or self.id, + } + self._context: Optional[KnowledgeContext] = None + + @property + def _proxy(self) -> "KnowledgeContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: KnowledgeContext for this KnowledgeInstance + """ + if self._context is None: + self._context = KnowledgeContext( + self._version, + id=self._solution["id"], + ) + return self._context + + def delete(self) -> bool: + """ + Deletes the KnowledgeInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the KnowledgeInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def fetch(self) -> "KnowledgeInstance": + """ + Fetch the KnowledgeInstance + + + :returns: The fetched KnowledgeInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "KnowledgeInstance": + """ + Asynchronous coroutine to fetch the KnowledgeInstance + + + :returns: The fetched KnowledgeInstance + """ + return await self._proxy.fetch_async() + + def update( + self, + knowledge_v1_service_update_knowledge_request: Union[ + KnowledgeV1ServiceUpdateKnowledgeRequest, object + ] = values.unset, + ) -> "KnowledgeInstance": + """ + Update the KnowledgeInstance + + :param knowledge_v1_service_update_knowledge_request: + + :returns: The updated KnowledgeInstance + """ + return self._proxy.update( + knowledge_v1_service_update_knowledge_request=knowledge_v1_service_update_knowledge_request, + ) + + async def update_async( + self, + knowledge_v1_service_update_knowledge_request: Union[ + KnowledgeV1ServiceUpdateKnowledgeRequest, object + ] = values.unset, + ) -> "KnowledgeInstance": + """ + Asynchronous coroutine to update the KnowledgeInstance + + :param knowledge_v1_service_update_knowledge_request: + + :returns: The updated KnowledgeInstance + """ + return await self._proxy.update_async( + knowledge_v1_service_update_knowledge_request=knowledge_v1_service_update_knowledge_request, + ) + + @property + def chunks(self) -> ChunkList: + """ + Access the chunks + """ + return self._proxy.chunks + + @property + def knowledge_status(self) -> KnowledgeStatusList: + """ + Access the knowledge_status + """ + return self._proxy.knowledge_status + + 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 KnowledgeContext(InstanceContext): + + class KnowledgeV1ServiceCreateKnowledgeRequest(object): + """ + :ivar description: The description of the knowledge source. + :ivar knowledge_source_details: The details of the knowledge source based on the type. + :ivar name: The name of the tool. + :ivar policy: + :ivar type: The type of the knowledge source. + :ivar embedding_model: The embedding model to be used for the knowledge source. It's required for 'Database' type but disallowed for other types. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.description: Optional[str] = payload.get("description") + self.knowledge_source_details: Optional[Dict[str, object]] = payload.get( + "knowledge_source_details" + ) + self.name: Optional[str] = payload.get("name") + self.policy: Optional[ + KnowledgeList.KnowledgeV1ServiceCreatePolicyRequest + ] = payload.get("policy") + self.type: Optional[str] = payload.get("type") + self.embedding_model: Optional[str] = payload.get("embedding_model") + + def to_dict(self): + return { + "description": self.description, + "knowledge_source_details": self.knowledge_source_details, + "name": self.name, + "policy": self.policy.to_dict() if self.policy is not None else None, + "type": self.type, + "embedding_model": self.embedding_model, + } + + class KnowledgeV1ServiceCreatePolicyRequest(object): + """ + :ivar description: The description of the policy. + :ivar id: The Policy ID. + :ivar name: The name of the policy. + :ivar policy_details: + :ivar type: The description of the policy. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.description: Optional[str] = payload.get("description") + self.id: Optional[str] = payload.get("id") + self.name: Optional[str] = payload.get("name") + self.policy_details: Optional[Dict[str, object]] = payload.get( + "policy_details" + ) + self.type: Optional[str] = payload.get("type") + + def to_dict(self): + return { + "description": self.description, + "id": self.id, + "name": self.name, + "policy_details": self.policy_details, + "type": self.type, + } + + class KnowledgeV1ServiceUpdateKnowledgeRequest(object): + """ + :ivar description: The description of the knowledge source. + :ivar knowledge_source_details: The details of the knowledge source based on the type. + :ivar name: The name of the knowledge source. + :ivar policy: + :ivar type: The description of the knowledge source. + :ivar embedding_model: The embedding model to be used for the knowledge source. It's only applicable to 'Database' type. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.description: Optional[str] = payload.get("description") + self.knowledge_source_details: Optional[Dict[str, object]] = payload.get( + "knowledge_source_details" + ) + self.name: Optional[str] = payload.get("name") + self.policy: Optional[ + KnowledgeList.KnowledgeV1ServiceCreatePolicyRequest + ] = payload.get("policy") + self.type: Optional[str] = payload.get("type") + self.embedding_model: Optional[str] = payload.get("embedding_model") + + def to_dict(self): + return { + "description": self.description, + "knowledge_source_details": self.knowledge_source_details, + "name": self.name, + "policy": self.policy.to_dict() if self.policy is not None else None, + "type": self.type, + "embedding_model": self.embedding_model, + } + + def __init__(self, version: Version, id: str): + """ + Initialize the KnowledgeContext + + :param version: Version that contains the resource + :param id: + """ + super().__init__(version) + + # Path Solution + self._solution = { + "id": id, + } + self._uri = "/Knowledge/{id}".format(**self._solution) + + self._chunks: Optional[ChunkList] = None + self._knowledge_status: Optional[KnowledgeStatusList] = None + + def delete(self) -> bool: + """ + Deletes the KnowledgeInstance + + + :returns: True if delete succeeds, False otherwise + """ + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the KnowledgeInstance + + + :returns: True if delete succeeds, False otherwise + """ + + headers = values.of({}) + + return await self._version.delete_async( + method="DELETE", uri=self._uri, headers=headers + ) + + def fetch(self) -> KnowledgeInstance: + """ + Fetch the KnowledgeInstance + + + :returns: The fetched KnowledgeInstance + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) + + return KnowledgeInstance( + self._version, + payload, + id=self._solution["id"], + ) + + async def fetch_async(self) -> KnowledgeInstance: + """ + Asynchronous coroutine to fetch the KnowledgeInstance + + + :returns: The fetched KnowledgeInstance + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = await self._version.fetch_async( + method="GET", uri=self._uri, headers=headers + ) + + return KnowledgeInstance( + self._version, + payload, + id=self._solution["id"], + ) + + def update( + self, + knowledge_v1_service_update_knowledge_request: Union[ + KnowledgeV1ServiceUpdateKnowledgeRequest, object + ] = values.unset, + ) -> KnowledgeInstance: + """ + Update the KnowledgeInstance + + :param knowledge_v1_service_update_knowledge_request: + + :returns: The updated KnowledgeInstance + """ + data = knowledge_v1_service_update_knowledge_request.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + payload = self._version.update( + method="PUT", uri=self._uri, data=data, headers=headers + ) + + return KnowledgeInstance(self._version, payload, id=self._solution["id"]) + + async def update_async( + self, + knowledge_v1_service_update_knowledge_request: Union[ + KnowledgeV1ServiceUpdateKnowledgeRequest, object + ] = values.unset, + ) -> KnowledgeInstance: + """ + Asynchronous coroutine to update the KnowledgeInstance + + :param knowledge_v1_service_update_knowledge_request: + + :returns: The updated KnowledgeInstance + """ + data = knowledge_v1_service_update_knowledge_request.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + payload = await self._version.update_async( + method="PUT", uri=self._uri, data=data, headers=headers + ) + + return KnowledgeInstance(self._version, payload, id=self._solution["id"]) + + @property + def chunks(self) -> ChunkList: + """ + Access the chunks + """ + if self._chunks is None: + self._chunks = ChunkList( + self._version, + self._solution["id"], + ) + return self._chunks + + @property + def knowledge_status(self) -> KnowledgeStatusList: + """ + Access the knowledge_status + """ + if self._knowledge_status is None: + self._knowledge_status = KnowledgeStatusList( + self._version, + self._solution["id"], + ) + return self._knowledge_status + + 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 KnowledgePage(Page): + + def get_instance(self, payload: Dict[str, Any]) -> KnowledgeInstance: + """ + Build an instance of KnowledgeInstance + + :param payload: Payload response from the API + """ + return KnowledgeInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class KnowledgeList(ListResource): + + class KnowledgeV1ServiceCreateKnowledgeRequest(object): + """ + :ivar description: The description of the knowledge source. + :ivar knowledge_source_details: The details of the knowledge source based on the type. + :ivar name: The name of the tool. + :ivar policy: + :ivar type: The type of the knowledge source. + :ivar embedding_model: The embedding model to be used for the knowledge source. It's required for 'Database' type but disallowed for other types. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.description: Optional[str] = payload.get("description") + self.knowledge_source_details: Optional[Dict[str, object]] = payload.get( + "knowledge_source_details" + ) + self.name: Optional[str] = payload.get("name") + self.policy: Optional[ + KnowledgeList.KnowledgeV1ServiceCreatePolicyRequest + ] = payload.get("policy") + self.type: Optional[str] = payload.get("type") + self.embedding_model: Optional[str] = payload.get("embedding_model") + + def to_dict(self): + return { + "description": self.description, + "knowledge_source_details": self.knowledge_source_details, + "name": self.name, + "policy": self.policy.to_dict() if self.policy is not None else None, + "type": self.type, + "embedding_model": self.embedding_model, + } + + class KnowledgeV1ServiceCreatePolicyRequest(object): + """ + :ivar description: The description of the policy. + :ivar id: The Policy ID. + :ivar name: The name of the policy. + :ivar policy_details: + :ivar type: The description of the policy. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.description: Optional[str] = payload.get("description") + self.id: Optional[str] = payload.get("id") + self.name: Optional[str] = payload.get("name") + self.policy_details: Optional[Dict[str, object]] = payload.get( + "policy_details" + ) + self.type: Optional[str] = payload.get("type") + + def to_dict(self): + return { + "description": self.description, + "id": self.id, + "name": self.name, + "policy_details": self.policy_details, + "type": self.type, + } + + class KnowledgeV1ServiceUpdateKnowledgeRequest(object): + """ + :ivar description: The description of the knowledge source. + :ivar knowledge_source_details: The details of the knowledge source based on the type. + :ivar name: The name of the knowledge source. + :ivar policy: + :ivar type: The description of the knowledge source. + :ivar embedding_model: The embedding model to be used for the knowledge source. It's only applicable to 'Database' type. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.description: Optional[str] = payload.get("description") + self.knowledge_source_details: Optional[Dict[str, object]] = payload.get( + "knowledge_source_details" + ) + self.name: Optional[str] = payload.get("name") + self.policy: Optional[ + KnowledgeList.KnowledgeV1ServiceCreatePolicyRequest + ] = payload.get("policy") + self.type: Optional[str] = payload.get("type") + self.embedding_model: Optional[str] = payload.get("embedding_model") + + def to_dict(self): + return { + "description": self.description, + "knowledge_source_details": self.knowledge_source_details, + "name": self.name, + "policy": self.policy.to_dict() if self.policy is not None else None, + "type": self.type, + "embedding_model": self.embedding_model, + } + + def __init__(self, version: Version): + """ + Initialize the KnowledgeList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/Knowledge" + + def create( + self, + knowledge_v1_service_create_knowledge_request: KnowledgeV1ServiceCreateKnowledgeRequest, + ) -> KnowledgeInstance: + """ + Create the KnowledgeInstance + + :param knowledge_v1_service_create_knowledge_request: + + :returns: The created KnowledgeInstance + """ + data = knowledge_v1_service_create_knowledge_request.to_dict() + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return KnowledgeInstance(self._version, payload) + + async def create_async( + self, + knowledge_v1_service_create_knowledge_request: KnowledgeV1ServiceCreateKnowledgeRequest, + ) -> KnowledgeInstance: + """ + Asynchronously create the KnowledgeInstance + + :param knowledge_v1_service_create_knowledge_request: + + :returns: The created KnowledgeInstance + """ + data = knowledge_v1_service_create_knowledge_request.to_dict() + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return KnowledgeInstance(self._version, payload) + + def stream( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[KnowledgeInstance]: + """ + Streams KnowledgeInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = self.page(page_size=limits["page_size"]) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[KnowledgeInstance]: + """ + Asynchronously streams KnowledgeInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = await self.page_async(page_size=limits["page_size"]) + + return self._version.stream_async(page, limits["limit"]) + + def list( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[KnowledgeInstance]: + """ + Lists KnowledgeInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return list( + self.stream( + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[KnowledgeInstance]: + """ + Asynchronously lists KnowledgeInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return [ + record + async for record in await self.stream_async( + limit=limit, + page_size=page_size, + ) + ] + + def page( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> KnowledgePage: + """ + Retrieve a single page of KnowledgeInstance records from the API. + Request is executed immediately + + :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 + + :returns: Page of KnowledgeInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) + return KnowledgePage(self._version, response) + + async def page_async( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> KnowledgePage: + """ + Asynchronously retrieve a single page of KnowledgeInstance records from the API. + Request is executed immediately + + :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 + + :returns: Page of KnowledgeInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = await self._version.page_async( + method="GET", uri=self._uri, params=data, headers=headers + ) + return KnowledgePage(self._version, response) + + def get_page(self, target_url: str) -> KnowledgePage: + """ + Retrieve a specific page of KnowledgeInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of KnowledgeInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return KnowledgePage(self._version, response) + + async def get_page_async(self, target_url: str) -> KnowledgePage: + """ + Asynchronously retrieve a specific page of KnowledgeInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of KnowledgeInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return KnowledgePage(self._version, response) + + def get(self, id: str) -> KnowledgeContext: + """ + Constructs a KnowledgeContext + + :param id: + """ + return KnowledgeContext(self._version, id=id) + + def __call__(self, id: str) -> KnowledgeContext: + """ + Constructs a KnowledgeContext + + :param id: + """ + return KnowledgeContext(self._version, id=id) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/knowledge/v1/knowledge/chunk.py b/twilio/rest/knowledge/v1/knowledge/chunk.py new file mode 100644 index 0000000000..55c0b1be1a --- /dev/null +++ b/twilio/rest/knowledge/v1/knowledge/chunk.py @@ -0,0 +1,297 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Knowledge + 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 datetime import datetime +from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator +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 +from twilio.base.page import Page + + +class ChunkInstance(InstanceResource): + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Knowledge resource. + :ivar content: The chunk content. + :ivar metadata: The metadata of the chunk. + :ivar date_created: The date and time in GMT when the Chunk was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date and time in GMT when the Chunk was updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], id: str): + super().__init__(version) + + self.account_sid: Optional[str] = payload.get("account_sid") + self.content: Optional[str] = payload.get("content") + self.metadata: Optional[Dict[str, object]] = payload.get("metadata") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + + self._solution = { + "id": id, + } + + 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 ChunkPage(Page): + + def get_instance(self, payload: Dict[str, Any]) -> ChunkInstance: + """ + Build an instance of ChunkInstance + + :param payload: Payload response from the API + """ + return ChunkInstance(self._version, payload, id=self._solution["id"]) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class ChunkList(ListResource): + + def __init__(self, version: Version, id: str): + """ + Initialize the ChunkList + + :param version: Version that contains the resource + :param id: The knowledge ID. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "id": id, + } + self._uri = "/Knowledge/{id}/Chunks".format(**self._solution) + + def stream( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[ChunkInstance]: + """ + Streams ChunkInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = self.page(page_size=limits["page_size"]) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[ChunkInstance]: + """ + Asynchronously streams ChunkInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = await self.page_async(page_size=limits["page_size"]) + + return self._version.stream_async(page, limits["limit"]) + + def list( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[ChunkInstance]: + """ + Lists ChunkInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return list( + self.stream( + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[ChunkInstance]: + """ + Asynchronously lists ChunkInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return [ + record + async for record in await self.stream_async( + limit=limit, + page_size=page_size, + ) + ] + + def page( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ChunkPage: + """ + Retrieve a single page of ChunkInstance records from the API. + Request is executed immediately + + :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 + + :returns: Page of ChunkInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) + return ChunkPage(self._version, response, self._solution) + + async def page_async( + self, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ChunkPage: + """ + Asynchronously retrieve a single page of ChunkInstance records from the API. + Request is executed immediately + + :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 + + :returns: Page of ChunkInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = await self._version.page_async( + method="GET", uri=self._uri, params=data, headers=headers + ) + return ChunkPage(self._version, response, self._solution) + + def get_page(self, target_url: str) -> ChunkPage: + """ + Retrieve a specific page of ChunkInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of ChunkInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return ChunkPage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> ChunkPage: + """ + Asynchronously retrieve a specific page of ChunkInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of ChunkInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return ChunkPage(self._version, response, self._solution) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/knowledge/v1/knowledge/knowledge_status.py b/twilio/rest/knowledge/v1/knowledge/knowledge_status.py new file mode 100644 index 0000000000..984c577aac --- /dev/null +++ b/twilio/rest/knowledge/v1/knowledge/knowledge_status.py @@ -0,0 +1,196 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Knowledge + 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 datetime import datetime +from typing import Any, Dict, Optional +from twilio.base import deserialize, values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class KnowledgeStatusInstance(InstanceResource): + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Knowledge resource. + :ivar status: The status of processing the knowledge source ('QUEUED', 'PROCESSING', 'COMPLETED', 'FAILED') + :ivar last_status: The last status of processing the knowledge source ('QUEUED', 'PROCESSING', 'COMPLETED', 'FAILED') + :ivar date_updated: The date and time in GMT when the Knowledge was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], id: str): + super().__init__(version) + + self.account_sid: Optional[str] = payload.get("account_sid") + self.status: Optional[str] = payload.get("status") + self.last_status: Optional[str] = payload.get("last_status") + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + + self._solution = { + "id": id, + } + self._context: Optional[KnowledgeStatusContext] = None + + @property + def _proxy(self) -> "KnowledgeStatusContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: KnowledgeStatusContext for this KnowledgeStatusInstance + """ + if self._context is None: + self._context = KnowledgeStatusContext( + self._version, + id=self._solution["id"], + ) + return self._context + + def fetch(self) -> "KnowledgeStatusInstance": + """ + Fetch the KnowledgeStatusInstance + + + :returns: The fetched KnowledgeStatusInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "KnowledgeStatusInstance": + """ + Asynchronous coroutine to fetch the KnowledgeStatusInstance + + + :returns: The fetched KnowledgeStatusInstance + """ + return await self._proxy.fetch_async() + + 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 KnowledgeStatusContext(InstanceContext): + + def __init__(self, version: Version, id: str): + """ + Initialize the KnowledgeStatusContext + + :param version: Version that contains the resource + :param id: the Knowledge ID. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "id": id, + } + self._uri = "/Knowledge/{id}/Status".format(**self._solution) + + def fetch(self) -> KnowledgeStatusInstance: + """ + Fetch the KnowledgeStatusInstance + + + :returns: The fetched KnowledgeStatusInstance + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) + + return KnowledgeStatusInstance( + self._version, + payload, + id=self._solution["id"], + ) + + async def fetch_async(self) -> KnowledgeStatusInstance: + """ + Asynchronous coroutine to fetch the KnowledgeStatusInstance + + + :returns: The fetched KnowledgeStatusInstance + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = await self._version.fetch_async( + method="GET", uri=self._uri, headers=headers + ) + + return KnowledgeStatusInstance( + self._version, + payload, + id=self._solution["id"], + ) + + 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 KnowledgeStatusList(ListResource): + + def __init__(self, version: Version, id: str): + """ + Initialize the KnowledgeStatusList + + :param version: Version that contains the resource + :param id: the Knowledge ID. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "id": id, + } + + def get(self) -> KnowledgeStatusContext: + """ + Constructs a KnowledgeStatusContext + + """ + return KnowledgeStatusContext(self._version, id=self._solution["id"]) + + def __call__(self) -> KnowledgeStatusContext: + """ + Constructs a KnowledgeStatusContext + + """ + return KnowledgeStatusContext(self._version, id=self._solution["id"]) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/lookups/v1/phone_number.py b/twilio/rest/lookups/v1/phone_number.py index ace46b67bd..304b89ab15 100644 --- a/twilio/rest/lookups/v1/phone_number.py +++ b/twilio/rest/lookups/v1/phone_number.py @@ -78,7 +78,7 @@ def fetch( Fetch the PhoneNumberInstance :param country_code: The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the phone number to fetch. This is used to specify the country when the phone number is provided in a national format. - :param type: The type of information to return. Can be: `carrier` or `caller-name`. The default is null. Carrier information costs $0.005 per phone number looked up. Caller Name information is currently available only in the US and costs $0.01 per phone number looked up. To retrieve both types on information, specify this parameter twice; once with `carrier` and once with `caller-name` as the value. + :param type: The type of information to return. Can be: `carrier` or `caller-name`. The default is null. To retrieve both types of information, specify this parameter twice; once with `carrier` and once with `caller-name` as the value. :param add_ons: The `unique_name` of an Add-on you would like to invoke. Can be the `unique_name` of an Add-on that is installed on your account. You can specify multiple instances of this parameter to invoke multiple Add-ons. For more information about Add-ons, see the [Add-ons documentation](https://www.twilio.com/docs/add-ons). :param add_ons_data: Data specific to the add-on you would like to invoke. The content and format of this value depends on the add-on. @@ -102,7 +102,7 @@ async def fetch_async( Asynchronous coroutine to fetch the PhoneNumberInstance :param country_code: The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the phone number to fetch. This is used to specify the country when the phone number is provided in a national format. - :param type: The type of information to return. Can be: `carrier` or `caller-name`. The default is null. Carrier information costs $0.005 per phone number looked up. Caller Name information is currently available only in the US and costs $0.01 per phone number looked up. To retrieve both types on information, specify this parameter twice; once with `carrier` and once with `caller-name` as the value. + :param type: The type of information to return. Can be: `carrier` or `caller-name`. The default is null. To retrieve both types of information, specify this parameter twice; once with `carrier` and once with `caller-name` as the value. :param add_ons: The `unique_name` of an Add-on you would like to invoke. Can be the `unique_name` of an Add-on that is installed on your account. You can specify multiple instances of this parameter to invoke multiple Add-ons. For more information about Add-ons, see the [Add-ons documentation](https://www.twilio.com/docs/add-ons). :param add_ons_data: Data specific to the add-on you would like to invoke. The content and format of this value depends on the add-on. @@ -153,7 +153,7 @@ def fetch( Fetch the PhoneNumberInstance :param country_code: The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the phone number to fetch. This is used to specify the country when the phone number is provided in a national format. - :param type: The type of information to return. Can be: `carrier` or `caller-name`. The default is null. Carrier information costs $0.005 per phone number looked up. Caller Name information is currently available only in the US and costs $0.01 per phone number looked up. To retrieve both types on information, specify this parameter twice; once with `carrier` and once with `caller-name` as the value. + :param type: The type of information to return. Can be: `carrier` or `caller-name`. The default is null. To retrieve both types of information, specify this parameter twice; once with `carrier` and once with `caller-name` as the value. :param add_ons: The `unique_name` of an Add-on you would like to invoke. Can be the `unique_name` of an Add-on that is installed on your account. You can specify multiple instances of this parameter to invoke multiple Add-ons. For more information about Add-ons, see the [Add-ons documentation](https://www.twilio.com/docs/add-ons). :param add_ons_data: Data specific to the add-on you would like to invoke. The content and format of this value depends on the add-on. @@ -195,7 +195,7 @@ async def fetch_async( Asynchronous coroutine to fetch the PhoneNumberInstance :param country_code: The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the phone number to fetch. This is used to specify the country when the phone number is provided in a national format. - :param type: The type of information to return. Can be: `carrier` or `caller-name`. The default is null. Carrier information costs $0.005 per phone number looked up. Caller Name information is currently available only in the US and costs $0.01 per phone number looked up. To retrieve both types on information, specify this parameter twice; once with `carrier` and once with `caller-name` as the value. + :param type: The type of information to return. Can be: `carrier` or `caller-name`. The default is null. To retrieve both types of information, specify this parameter twice; once with `carrier` and once with `caller-name` as the value. :param add_ons: The `unique_name` of an Add-on you would like to invoke. Can be the `unique_name` of an Add-on that is installed on your account. You can specify multiple instances of this parameter to invoke multiple Add-ons. For more information about Add-ons, see the [Add-ons documentation](https://www.twilio.com/docs/add-ons). :param add_ons_data: Data specific to the add-on you would like to invoke. The content and format of this value depends on the add-on. diff --git a/twilio/rest/monitor/v1/event.py b/twilio/rest/monitor/v1/event.py index 31716b8813..61450c872c 100644 --- a/twilio/rest/monitor/v1/event.py +++ b/twilio/rest/monitor/v1/event.py @@ -25,7 +25,7 @@ class EventInstance(InstanceResource): """ :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Event resource. - :ivar actor_sid: The SID of the actor that caused the event, if available. Can be `null`. + :ivar actor_sid: The SID of the actor that caused the event, if available. This can be either a User ID (matching the pattern `^US[0-9a-fA-F]{32}$`) or an Account SID (matching the pattern `^AC[0-9a-fA-F]{32}$`). If the actor's SID isn't available, this field will be `null`. :ivar actor_type: The type of actor that caused the event. Can be: `user` for a change made by a logged-in user in the Twilio Console, `account` for an event caused by an API request by an authenticating Account, `twilio-admin` for an event caused by a Twilio employee, and so on. :ivar description: A description of the event. Can be `null`. :ivar event_data: An object with additional data about the event. The contents depend on `event_type`. For example, event-types of the form `RESOURCE.updated`, this value contains a `resource_properties` dictionary that describes the previous and updated properties of the resource. diff --git a/twilio/rest/studio/v1/flow/engagement/step/__init__.py b/twilio/rest/studio/v1/flow/engagement/step/__init__.py index d88d0ad0f6..a5017c3313 100644 --- a/twilio/rest/studio/v1/flow/engagement/step/__init__.py +++ b/twilio/rest/studio/v1/flow/engagement/step/__init__.py @@ -31,6 +31,7 @@ class StepInstance(InstanceResource): :ivar engagement_sid: The SID of the Engagement. :ivar name: The event that caused the Flow to transition to the Step. :ivar context: The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. + :ivar parent_step_sid: The SID of the parent Step. :ivar transitioned_from: The Widget that preceded the Widget for the Step. :ivar transitioned_to: The Widget that will follow the Widget for the Step. :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. @@ -55,6 +56,7 @@ def __init__( self.engagement_sid: Optional[str] = payload.get("engagement_sid") self.name: Optional[str] = payload.get("name") self.context: Optional[Dict[str, object]] = payload.get("context") + self.parent_step_sid: Optional[str] = payload.get("parent_step_sid") self.transitioned_from: Optional[str] = payload.get("transitioned_from") self.transitioned_to: Optional[str] = payload.get("transitioned_to") self.date_created: Optional[datetime] = deserialize.iso8601_datetime( diff --git a/twilio/rest/studio/v1/flow/execution/execution_step/__init__.py b/twilio/rest/studio/v1/flow/execution/execution_step/__init__.py index 888506e965..50a1e2371d 100644 --- a/twilio/rest/studio/v1/flow/execution/execution_step/__init__.py +++ b/twilio/rest/studio/v1/flow/execution/execution_step/__init__.py @@ -31,6 +31,7 @@ class ExecutionStepInstance(InstanceResource): :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ExecutionStep resource. :ivar flow_sid: The SID of the Flow. :ivar execution_sid: The SID of the Step's Execution resource. + :ivar parent_step_sid: This field shows the Step SID of the Widget in the parent Flow that started the Subflow. If this Step is not part of a Subflow execution, the value is null. :ivar name: The event that caused the Flow to transition to the Step. :ivar context: The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. :ivar transitioned_from: The Widget that preceded the Widget for the Step. @@ -55,6 +56,7 @@ def __init__( self.account_sid: Optional[str] = payload.get("account_sid") self.flow_sid: Optional[str] = payload.get("flow_sid") self.execution_sid: Optional[str] = payload.get("execution_sid") + self.parent_step_sid: Optional[str] = payload.get("parent_step_sid") self.name: Optional[str] = payload.get("name") self.context: Optional[Dict[str, object]] = payload.get("context") self.transitioned_from: Optional[str] = payload.get("transitioned_from") diff --git a/twilio/rest/studio/v2/flow/execution/execution_step/__init__.py b/twilio/rest/studio/v2/flow/execution/execution_step/__init__.py index b088aeab0e..9ffb2502e6 100644 --- a/twilio/rest/studio/v2/flow/execution/execution_step/__init__.py +++ b/twilio/rest/studio/v2/flow/execution/execution_step/__init__.py @@ -31,6 +31,7 @@ class ExecutionStepInstance(InstanceResource): :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ExecutionStep resource. :ivar flow_sid: The SID of the Flow. :ivar execution_sid: The SID of the Step's Execution resource. + :ivar parent_step_sid: The SID of the parent Step. :ivar name: The event that caused the Flow to transition to the Step. :ivar context: The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. :ivar transitioned_from: The Widget that preceded the Widget for the Step. @@ -55,6 +56,7 @@ def __init__( self.account_sid: Optional[str] = payload.get("account_sid") self.flow_sid: Optional[str] = payload.get("flow_sid") self.execution_sid: Optional[str] = payload.get("execution_sid") + self.parent_step_sid: Optional[str] = payload.get("parent_step_sid") self.name: Optional[str] = payload.get("name") self.context: Optional[Dict[str, object]] = payload.get("context") self.transitioned_from: Optional[str] = payload.get("transitioned_from") From a2b5324692ded839205bb317fb55023515fbca8f Mon Sep 17 00:00:00 2001 From: Twilio Date: Mon, 7 Apr 2025 12:43:10 +0000 Subject: [PATCH 81/87] Release 9.5.2 --- setup.py | 2 +- twilio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 6784744561..d03f823242 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name="twilio", - version="9.5.1", + version="9.5.2", description="Twilio API client and TwiML generator", author="Twilio", help_center="https://www.twilio.com/help/contact", diff --git a/twilio/__init__.py b/twilio/__init__.py index 13ccdd0b0d..15e4058354 100644 --- a/twilio/__init__.py +++ b/twilio/__init__.py @@ -1,2 +1,2 @@ -__version_info__ = ("9", "5", "1") +__version_info__ = ("9", "5", "2") __version__ = ".".join(__version_info__) From e44db6bd285b0556bfd17f5a8b84862cf9521df9 Mon Sep 17 00:00:00 2001 From: Manisha Singh Date: Thu, 10 Apr 2025 14:14:34 +0530 Subject: [PATCH 82/87] docs: update pagination usage in README.md (#855) * chore: update README.md * chore: fix page_size snakecase --------- Co-authored-by: Shubham --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index 24ece99218..e6382a5242 100644 --- a/README.md +++ b/README.md @@ -193,6 +193,8 @@ The library automatically handles paging for you. Collections, such as `calls` a `list` eagerly fetches all records and returns them as a list, whereas `stream` returns an iterator and lazily retrieves pages of records as you iterate over the collection. You can also page manually using the `page` method. +`page_size` as a parameter is used to tell how many records should we get in every page and `limit` parameter is used to limit the max number of records we want to fetch. + #### Use the `list` method ```python @@ -206,6 +208,21 @@ for sms in client.messages.list(): print(sms.to) ``` +```python +client.messages.list(limit=20, page_size=20) +``` +This will make 1 call that will fetch 20 records from backend service. + +```python +client.messages.list(limit=20, page_size=10) +``` +This will make 2 calls that will fetch 10 records each from backend service. + +```python +client.messages.list(limit=20, page_size=100) +``` +This will make 1 call which will fetch 100 records but user will get only 20 records. + ### Asynchronous API Requests By default, the Twilio Client will make synchronous requests to the Twilio API. To allow for asynchronous, non-blocking requests, we've included an optional asynchronous HTTP client. When used with the Client and the accompanying `*_async` methods, requests made to the Twilio API will be performed asynchronously. From 69796205d6b3bf31c056f0e67ffdea029685455f Mon Sep 17 00:00:00 2001 From: Shubham Date: Mon, 5 May 2025 13:54:27 +0530 Subject: [PATCH 83/87] chore: fix oauth examples (#858) --- examples/organization_api.py | 4 ++-- examples/public_oauth.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/organization_api.py b/examples/organization_api.py index 180f18c20b..0d653c12a4 100644 --- a/examples/organization_api.py +++ b/examples/organization_api.py @@ -16,12 +16,12 @@ def example(): """ Some example usage of using organization resources """ - self.client = Client( + client = Client( account_sid=ACCOUNT_SID, credential_provider=OrgsCredentialProvider(CLIENT_ID, CLIENT_SECRET), ) - accounts = self.client.preview_iam.organization( + accounts = client.preview_iam.organization( organization_sid=ORGS_SID ).accounts.stream() for record in accounts: diff --git a/examples/public_oauth.py b/examples/public_oauth.py index 527961f4e3..41eb589c37 100644 --- a/examples/public_oauth.py +++ b/examples/public_oauth.py @@ -17,12 +17,12 @@ def example(): """ Some example usage of message resources. """ - self.client = Client( + client = Client( account_sid=ACCOUNT_SID, credential_provider=ClientCredentialProvider(CLIENT_ID, CLIENT_SECRET), ) - msg = self.client.messages.create( + msg = client.messages.create( to=self.to_number, from_=self.from_number, body="hello world" ) From 807f380346df196cdb02e3d059d64e8b8bfe5fee Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Mon, 5 May 2025 09:33:57 +0100 Subject: [PATCH 84/87] fix: Fix deprecated/invalid config in `setup.cfg` (#853) --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 0df04dde4d..4c18756789 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,7 +2,7 @@ universal = 1 [metadata] -description-file = README.md +long_description = file: README.md license = MIT [flake8] From cdd985793a025246ddd2b15f5f75374667dbecc8 Mon Sep 17 00:00:00 2001 From: Pablo2113 <147159042+Pablo2113@users.noreply.github.com> Date: Mon, 5 May 2025 10:57:47 +0200 Subject: [PATCH 85/87] fix: Timezone changes in toke_auth_strategy.py (#848) Co-authored-by: Shubham --- twilio/auth_strategy/token_auth_strategy.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/twilio/auth_strategy/token_auth_strategy.py b/twilio/auth_strategy/token_auth_strategy.py index ee51f05a43..40ee4c80ec 100644 --- a/twilio/auth_strategy/token_auth_strategy.py +++ b/twilio/auth_strategy/token_auth_strategy.py @@ -1,7 +1,7 @@ import jwt import threading import logging -from datetime import datetime +from datetime import datetime, timezone from twilio.auth_strategy.auth_type import AuthType from twilio.auth_strategy.auth_strategy import AuthStrategy @@ -43,8 +43,8 @@ def is_token_expired(self, token): if exp is None: return True # No expiration time present, consider it expired - # Check if the expiration time has passed - return datetime.fromtimestamp(exp) < datetime.utcnow() + # Check if the expiration time has passed by using time-zone + return datetime.fromtimestamp(exp, tz = timezone.utc) < datetime.now(timezone.utc) except jwt.DecodeError: return True # Token is invalid From e6b56157ebefd86561add59cbbfbd9a0215d6729 Mon Sep 17 00:00:00 2001 From: Twilio Date: Mon, 5 May 2025 10:36:46 +0000 Subject: [PATCH 86/87] [Librarian] Regenerated @ 73b691d4309bbf652c00c8e81516e936534d2117 e39c0f89ecf837b35a77b0ecc773832297b7d7e3 --- CHANGES.md | 28 + twilio/auth_strategy/token_auth_strategy.py | 4 +- .../rest/api/v2010/account/call/__init__.py | 4 +- .../v2010/account/conference/participant.py | 12 +- .../rest/flex_api/v1/interaction/__init__.py | 92 ++ twilio/rest/messaging/MessagingBase.py | 11 + twilio/rest/messaging/v2/__init__.py | 43 + twilio/rest/messaging/v2/channels_sender.py | 1242 +++++++++++++++++ twilio/rest/numbers/v1/__init__.py | 24 +- ...=> porting_webhook_configuration_fetch.py} | 26 +- .../serverless/v1/service/build/__init__.py | 2 + twilio/rest/video/v1/room/__init__.py | 20 + 12 files changed, 1478 insertions(+), 30 deletions(-) create mode 100644 twilio/rest/messaging/v2/__init__.py create mode 100644 twilio/rest/messaging/v2/channels_sender.py rename twilio/rest/numbers/v1/{webhook.py => porting_webhook_configuration_fetch.py} (78%) diff --git a/CHANGES.md b/CHANGES.md index c3e678a6a0..a9321f3330 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,34 @@ twilio-python Changelog Here you can see the full list of changes between each twilio-python release. +[2025-05-05] Version 9.6.0 +-------------------------- +**Library - Fix** +- [PR #848](https://github.com/twilio/twilio-python/pull/848): Timezone changes in token_auth_strategy.py. Thanks to [@Pablo2113](https://github.com/Pablo2113)! +- [PR #853](https://github.com/twilio/twilio-python/pull/853): Fix deprecated/invalid config in `setup.cfg`. Thanks to [@abravalheri](https://github.com/abravalheri)! + +**Library - Chore** +- [PR #858](https://github.com/twilio/twilio-python/pull/858): fix oauth examples. Thanks to [@tiwarishubham635](https://github.com/tiwarishubham635)! + +**Library - Docs** +- [PR #855](https://github.com/twilio/twilio-python/pull/855): update pagination usage in README.md. Thanks to [@manisha1997](https://github.com/manisha1997)! + +**Api** +- Add `response_key` for `Usage Triggers` fetch endpoint. + +**Flex** +- Add Update Interaction API +- Adding `webhook_ttid` as optional parameter in Interactions API + +**Serverless** +- Add node22 as a valid Build runtime +- Add node20 as a valid Build runtime + +**Video** +- removed `transcribe_participants_on_connect` and `transcriptions_configuration` from the room resource **(breaking change)** +- Added `transcribe_participants_on_connect` and `transcriptions_configuration` to the room resource + + [2025-04-07] Version 9.5.2 -------------------------- **Studio** diff --git a/twilio/auth_strategy/token_auth_strategy.py b/twilio/auth_strategy/token_auth_strategy.py index 40ee4c80ec..33a8d385cb 100644 --- a/twilio/auth_strategy/token_auth_strategy.py +++ b/twilio/auth_strategy/token_auth_strategy.py @@ -44,7 +44,9 @@ def is_token_expired(self, token): return True # No expiration time present, consider it expired # Check if the expiration time has passed by using time-zone - return datetime.fromtimestamp(exp, tz = timezone.utc) < datetime.now(timezone.utc) + return datetime.fromtimestamp(exp, tz=timezone.utc) < datetime.now( + timezone.utc + ) except jwt.DecodeError: return True # Token is invalid diff --git a/twilio/rest/api/v2010/account/call/__init__.py b/twilio/rest/api/v2010/account/call/__init__.py index b09550c326..f7756c40ec 100644 --- a/twilio/rest/api/v2010/account/call/__init__.py +++ b/twilio/rest/api/v2010/account/call/__init__.py @@ -769,7 +769,7 @@ def create( :param status_callback: The URL we should call using the `status_callback_method` to send status information to your application. If no `status_callback_event` is specified, we will send the `completed` status. If an `application_sid` parameter is present, this parameter is ignored. URLs must contain a valid hostname (underscores are not permitted). :param status_callback_event: The call progress events that we will send to the `status_callback` URL. Can be: `initiated`, `ringing`, `answered`, and `completed`. If no event is specified, we send the `completed` status. If you want to receive multiple events, specify each one in a separate `status_callback_event` parameter. See the code sample for [monitoring call progress](https://www.twilio.com/docs/voice/api/call-resource?code-sample=code-create-a-call-resource-and-specify-a-statuscallbackevent&code-sdk-version=json). If an `application_sid` is present, this parameter is ignored. :param status_callback_method: The HTTP method we should use when calling the `status_callback` URL. Can be: `GET` or `POST` and the default is `POST`. If an `application_sid` parameter is present, this parameter is ignored. - :param send_digits: A string of keys to dial after connecting to the number, maximum of 32 digits. Valid digits in the string include: any digit (`0`-`9`), '`#`', '`*`' and '`w`', to insert a half second pause. For example, if you connected to a company phone number and wanted to pause for one second, and then dial extension 1234 followed by the pound key, the value of this parameter would be `ww1234#`. Remember to URL-encode this string, since the '`#`' character has special meaning in a URL. If both `SendDigits` and `MachineDetection` parameters are provided, then `MachineDetection` will be ignored. + :param send_digits: The string of keys to dial after connecting to the number, with a maximum length of 32 digits. Valid digits in the string include any digit (`0`-`9`), '`A`', '`B`', '`C`', '`D`', '`#`', and '`*`'. You can also use '`w`' to insert a half-second pause and '`W`' to insert a one-second pause. For example, to pause for one second after connecting and then dial extension 1234 followed by the # key, set this parameter to `W1234#`. Be sure to URL-encode this string because the '`#`' character has special meaning in a URL. If both `SendDigits` and `MachineDetection` parameters are provided, then `MachineDetection` will be ignored. :param timeout: The integer number of seconds that we should allow the phone to ring before assuming there is no answer. The default is `60` seconds and the maximum is `600` seconds. For some call flows, we will add a 5-second buffer to the timeout value you provide. For this reason, a timeout value of 10 seconds could result in an actual timeout closer to 15 seconds. You can set this to a short time, such as `15` seconds, to hang up before reaching an answering machine or voicemail. :param record: Whether to record the call. Can be `true` to record the phone call, or `false` to not. The default is `false`. The `recording_url` is sent to the `status_callback` URL. :param recording_channels: The number of channels in the final recording. Can be: `mono` or `dual`. The default is `mono`. `mono` records both legs of the call in a single channel of the recording file. `dual` records each leg to a separate channel of the recording file. The first channel of a dual-channel recording contains the parent call and the second channel contains the child call. @@ -906,7 +906,7 @@ async def create_async( :param status_callback: The URL we should call using the `status_callback_method` to send status information to your application. If no `status_callback_event` is specified, we will send the `completed` status. If an `application_sid` parameter is present, this parameter is ignored. URLs must contain a valid hostname (underscores are not permitted). :param status_callback_event: The call progress events that we will send to the `status_callback` URL. Can be: `initiated`, `ringing`, `answered`, and `completed`. If no event is specified, we send the `completed` status. If you want to receive multiple events, specify each one in a separate `status_callback_event` parameter. See the code sample for [monitoring call progress](https://www.twilio.com/docs/voice/api/call-resource?code-sample=code-create-a-call-resource-and-specify-a-statuscallbackevent&code-sdk-version=json). If an `application_sid` is present, this parameter is ignored. :param status_callback_method: The HTTP method we should use when calling the `status_callback` URL. Can be: `GET` or `POST` and the default is `POST`. If an `application_sid` parameter is present, this parameter is ignored. - :param send_digits: A string of keys to dial after connecting to the number, maximum of 32 digits. Valid digits in the string include: any digit (`0`-`9`), '`#`', '`*`' and '`w`', to insert a half second pause. For example, if you connected to a company phone number and wanted to pause for one second, and then dial extension 1234 followed by the pound key, the value of this parameter would be `ww1234#`. Remember to URL-encode this string, since the '`#`' character has special meaning in a URL. If both `SendDigits` and `MachineDetection` parameters are provided, then `MachineDetection` will be ignored. + :param send_digits: The string of keys to dial after connecting to the number, with a maximum length of 32 digits. Valid digits in the string include any digit (`0`-`9`), '`A`', '`B`', '`C`', '`D`', '`#`', and '`*`'. You can also use '`w`' to insert a half-second pause and '`W`' to insert a one-second pause. For example, to pause for one second after connecting and then dial extension 1234 followed by the # key, set this parameter to `W1234#`. Be sure to URL-encode this string because the '`#`' character has special meaning in a URL. If both `SendDigits` and `MachineDetection` parameters are provided, then `MachineDetection` will be ignored. :param timeout: The integer number of seconds that we should allow the phone to ring before assuming there is no answer. The default is `60` seconds and the maximum is `600` seconds. For some call flows, we will add a 5-second buffer to the timeout value you provide. For this reason, a timeout value of 10 seconds could result in an actual timeout closer to 15 seconds. You can set this to a short time, such as `15` seconds, to hang up before reaching an answering machine or voicemail. :param record: Whether to record the call. Can be `true` to record the phone call, or `false` to not. The default is `false`. The `recording_url` is sent to the `status_callback` URL. :param recording_channels: The number of channels in the final recording. Can be: `mono` or `dual`. The default is `mono`. `mono` records both legs of the call in a single channel of the recording file. `dual` records each leg to a separate channel of the recording file. The first channel of a dual-channel recording contains the parent call and the second channel contains the child call. diff --git a/twilio/rest/api/v2010/account/conference/participant.py b/twilio/rest/api/v2010/account/conference/participant.py index c6511dadf6..3c49e5387c 100644 --- a/twilio/rest/api/v2010/account/conference/participant.py +++ b/twilio/rest/api/v2010/account/conference/participant.py @@ -168,7 +168,7 @@ def update( :param hold_method: The HTTP method we should use to call `hold_url`. Can be: `GET` or `POST` and the default is `GET`. :param announce_url: The URL we call using the `announce_method` for an announcement to the participant. The URL may return an MP3 file, a WAV file, or a TwiML document that contains ``, ``, ``, or `` verbs. :param announce_method: The HTTP method we should use to call `announce_url`. Can be: `GET` or `POST` and defaults to `POST`. - :param wait_url: The URL we call using the `wait_method` for the music to play while participants are waiting for the conference to start. The URL may return an MP3 file, a WAV file, or a TwiML document that contains ``, ``, ``, or `` verbs. The default value is the URL of our standard hold music. [Learn more about hold music](https://www.twilio.com/labs/twimlets/holdmusic). + :param wait_url: The URL that Twilio calls using the `wait_method` before the conference has started. The URL may return an MP3 file, a WAV file, or a TwiML document. The default value is the URL of our standard hold music. If you do not want anything to play while waiting for the conference to start, specify an empty string by setting `wait_url` to `''`. For more details on the allowable verbs within the `waitUrl`, see the `waitUrl` attribute in the [ TwiML instruction](https://www.twilio.com/docs/voice/twiml/conference#attributes-waiturl). :param wait_method: The HTTP method we should use to call `wait_url`. Can be `GET` or `POST` and the default is `POST`. When using a static audio file, this should be `GET` so that we can cache the file. :param beep_on_exit: Whether to play a notification beep to the conference when the participant exits. Can be: `true` or `false`. :param end_conference_on_exit: Whether to end the conference when the participant leaves. Can be: `true` or `false` and defaults to `false`. @@ -216,7 +216,7 @@ async def update_async( :param hold_method: The HTTP method we should use to call `hold_url`. Can be: `GET` or `POST` and the default is `GET`. :param announce_url: The URL we call using the `announce_method` for an announcement to the participant. The URL may return an MP3 file, a WAV file, or a TwiML document that contains ``, ``, ``, or `` verbs. :param announce_method: The HTTP method we should use to call `announce_url`. Can be: `GET` or `POST` and defaults to `POST`. - :param wait_url: The URL we call using the `wait_method` for the music to play while participants are waiting for the conference to start. The URL may return an MP3 file, a WAV file, or a TwiML document that contains ``, ``, ``, or `` verbs. The default value is the URL of our standard hold music. [Learn more about hold music](https://www.twilio.com/labs/twimlets/holdmusic). + :param wait_url: The URL that Twilio calls using the `wait_method` before the conference has started. The URL may return an MP3 file, a WAV file, or a TwiML document. The default value is the URL of our standard hold music. If you do not want anything to play while waiting for the conference to start, specify an empty string by setting `wait_url` to `''`. For more details on the allowable verbs within the `waitUrl`, see the `waitUrl` attribute in the [ TwiML instruction](https://www.twilio.com/docs/voice/twiml/conference#attributes-waiturl). :param wait_method: The HTTP method we should use to call `wait_url`. Can be `GET` or `POST` and the default is `POST`. When using a static audio file, this should be `GET` so that we can cache the file. :param beep_on_exit: Whether to play a notification beep to the conference when the participant exits. Can be: `true` or `false`. :param end_conference_on_exit: Whether to end the conference when the participant leaves. Can be: `true` or `false` and defaults to `false`. @@ -371,7 +371,7 @@ def update( :param hold_method: The HTTP method we should use to call `hold_url`. Can be: `GET` or `POST` and the default is `GET`. :param announce_url: The URL we call using the `announce_method` for an announcement to the participant. The URL may return an MP3 file, a WAV file, or a TwiML document that contains ``, ``, ``, or `` verbs. :param announce_method: The HTTP method we should use to call `announce_url`. Can be: `GET` or `POST` and defaults to `POST`. - :param wait_url: The URL we call using the `wait_method` for the music to play while participants are waiting for the conference to start. The URL may return an MP3 file, a WAV file, or a TwiML document that contains ``, ``, ``, or `` verbs. The default value is the URL of our standard hold music. [Learn more about hold music](https://www.twilio.com/labs/twimlets/holdmusic). + :param wait_url: The URL that Twilio calls using the `wait_method` before the conference has started. The URL may return an MP3 file, a WAV file, or a TwiML document. The default value is the URL of our standard hold music. If you do not want anything to play while waiting for the conference to start, specify an empty string by setting `wait_url` to `''`. For more details on the allowable verbs within the `waitUrl`, see the `waitUrl` attribute in the [ TwiML instruction](https://www.twilio.com/docs/voice/twiml/conference#attributes-waiturl). :param wait_method: The HTTP method we should use to call `wait_url`. Can be `GET` or `POST` and the default is `POST`. When using a static audio file, this should be `GET` so that we can cache the file. :param beep_on_exit: Whether to play a notification beep to the conference when the participant exits. Can be: `true` or `false`. :param end_conference_on_exit: Whether to end the conference when the participant leaves. Can be: `true` or `false` and defaults to `false`. @@ -441,7 +441,7 @@ async def update_async( :param hold_method: The HTTP method we should use to call `hold_url`. Can be: `GET` or `POST` and the default is `GET`. :param announce_url: The URL we call using the `announce_method` for an announcement to the participant. The URL may return an MP3 file, a WAV file, or a TwiML document that contains ``, ``, ``, or `` verbs. :param announce_method: The HTTP method we should use to call `announce_url`. Can be: `GET` or `POST` and defaults to `POST`. - :param wait_url: The URL we call using the `wait_method` for the music to play while participants are waiting for the conference to start. The URL may return an MP3 file, a WAV file, or a TwiML document that contains ``, ``, ``, or `` verbs. The default value is the URL of our standard hold music. [Learn more about hold music](https://www.twilio.com/labs/twimlets/holdmusic). + :param wait_url: The URL that Twilio calls using the `wait_method` before the conference has started. The URL may return an MP3 file, a WAV file, or a TwiML document. The default value is the URL of our standard hold music. If you do not want anything to play while waiting for the conference to start, specify an empty string by setting `wait_url` to `''`. For more details on the allowable verbs within the `waitUrl`, see the `waitUrl` attribute in the [ TwiML instruction](https://www.twilio.com/docs/voice/twiml/conference#attributes-waiturl). :param wait_method: The HTTP method we should use to call `wait_url`. Can be `GET` or `POST` and the default is `POST`. When using a static audio file, this should be `GET` so that we can cache the file. :param beep_on_exit: Whether to play a notification beep to the conference when the participant exits. Can be: `true` or `false`. :param end_conference_on_exit: Whether to end the conference when the participant leaves. Can be: `true` or `false` and defaults to `false`. @@ -611,7 +611,7 @@ def create( :param beep: Whether to play a notification beep to the conference when the participant joins. Can be: `true`, `false`, `onEnter`, or `onExit`. The default value is `true`. :param start_conference_on_enter: Whether to start the conference when the participant joins, if it has not already started. Can be: `true` or `false` and the default is `true`. If `false` and the conference has not started, the participant is muted and hears background music until another participant starts the conference. :param end_conference_on_exit: Whether to end the conference when the participant leaves. Can be: `true` or `false` and defaults to `false`. - :param wait_url: The URL we should call using the `wait_method` for the music to play while participants are waiting for the conference to start. The default value is the URL of our standard hold music. [Learn more about hold music](https://www.twilio.com/labs/twimlets/holdmusic). + :param wait_url: The URL that Twilio calls using the `wait_method` before the conference has started. The URL may return an MP3 file, a WAV file, or a TwiML document. The default value is the URL of our standard hold music. If you do not want anything to play while waiting for the conference to start, specify an empty string by setting `wait_url` to `''`. For more details on the allowable verbs within the `waitUrl`, see the `waitUrl` attribute in the [ TwiML instruction](https://www.twilio.com/docs/voice/twiml/conference#attributes-waiturl). :param wait_method: The HTTP method we should use to call `wait_url`. Can be `GET` or `POST` and the default is `POST`. When using a static audio file, this should be `GET` so that we can cache the file. :param early_media: Whether to allow an agent to hear the state of the outbound call, including ringing or disconnect messages. Can be: `true` or `false` and defaults to `true`. :param max_participants: The maximum number of participants in the conference. Can be a positive integer from `2` to `250`. The default value is `250`. @@ -800,7 +800,7 @@ async def create_async( :param beep: Whether to play a notification beep to the conference when the participant joins. Can be: `true`, `false`, `onEnter`, or `onExit`. The default value is `true`. :param start_conference_on_enter: Whether to start the conference when the participant joins, if it has not already started. Can be: `true` or `false` and the default is `true`. If `false` and the conference has not started, the participant is muted and hears background music until another participant starts the conference. :param end_conference_on_exit: Whether to end the conference when the participant leaves. Can be: `true` or `false` and defaults to `false`. - :param wait_url: The URL we should call using the `wait_method` for the music to play while participants are waiting for the conference to start. The default value is the URL of our standard hold music. [Learn more about hold music](https://www.twilio.com/labs/twimlets/holdmusic). + :param wait_url: The URL that Twilio calls using the `wait_method` before the conference has started. The URL may return an MP3 file, a WAV file, or a TwiML document. The default value is the URL of our standard hold music. If you do not want anything to play while waiting for the conference to start, specify an empty string by setting `wait_url` to `''`. For more details on the allowable verbs within the `waitUrl`, see the `waitUrl` attribute in the [ TwiML instruction](https://www.twilio.com/docs/voice/twiml/conference#attributes-waiturl). :param wait_method: The HTTP method we should use to call `wait_url`. Can be `GET` or `POST` and the default is `POST`. When using a static audio file, this should be `GET` so that we can cache the file. :param early_media: Whether to allow an agent to hear the state of the outbound call, including ringing or disconnect messages. Can be: `true` or `false` and defaults to `true`. :param max_participants: The maximum number of participants in the conference. Can be a positive integer from `2` to `250`. The default value is `250`. diff --git a/twilio/rest/flex_api/v1/interaction/__init__.py b/twilio/rest/flex_api/v1/interaction/__init__.py index c67d9c026e..653938f28d 100644 --- a/twilio/rest/flex_api/v1/interaction/__init__.py +++ b/twilio/rest/flex_api/v1/interaction/__init__.py @@ -32,6 +32,7 @@ class InteractionInstance(InstanceResource): :ivar url: :ivar links: :ivar interaction_context_sid: + :ivar webhook_ttid: """ def __init__( @@ -47,6 +48,7 @@ def __init__( self.interaction_context_sid: Optional[str] = payload.get( "interaction_context_sid" ) + self.webhook_ttid: Optional[str] = payload.get("webhook_ttid") self._solution = { "sid": sid or self.sid, @@ -86,6 +88,34 @@ async def fetch_async(self) -> "InteractionInstance": """ return await self._proxy.fetch_async() + def update( + self, webhook_ttid: Union[str, object] = values.unset + ) -> "InteractionInstance": + """ + Update the InteractionInstance + + :param webhook_ttid: The unique identifier for Interaction level webhook + + :returns: The updated InteractionInstance + """ + return self._proxy.update( + webhook_ttid=webhook_ttid, + ) + + async def update_async( + self, webhook_ttid: Union[str, object] = values.unset + ) -> "InteractionInstance": + """ + Asynchronous coroutine to update the InteractionInstance + + :param webhook_ttid: The unique identifier for Interaction level webhook + + :returns: The updated InteractionInstance + """ + return await self._proxy.update_async( + webhook_ttid=webhook_ttid, + ) + @property def channels(self) -> InteractionChannelList: """ @@ -164,6 +194,62 @@ async def fetch_async(self) -> InteractionInstance: sid=self._solution["sid"], ) + def update( + self, webhook_ttid: Union[str, object] = values.unset + ) -> InteractionInstance: + """ + Update the InteractionInstance + + :param webhook_ttid: The unique identifier for Interaction level webhook + + :returns: The updated InteractionInstance + """ + + data = values.of( + { + "WebhookTtid": webhook_ttid, + } + ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + + payload = self._version.update( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return InteractionInstance(self._version, payload, sid=self._solution["sid"]) + + async def update_async( + self, webhook_ttid: Union[str, object] = values.unset + ) -> InteractionInstance: + """ + Asynchronous coroutine to update the InteractionInstance + + :param webhook_ttid: The unique identifier for Interaction level webhook + + :returns: The updated InteractionInstance + """ + + data = values.of( + { + "WebhookTtid": webhook_ttid, + } + ) + headers = values.of({}) + + headers["Content-Type"] = "application/x-www-form-urlencoded" + + headers["Accept"] = "application/json" + + payload = await self._version.update_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return InteractionInstance(self._version, payload, sid=self._solution["sid"]) + @property def channels(self) -> InteractionChannelList: """ @@ -204,6 +290,7 @@ def create( channel: object, routing: Union[object, object] = values.unset, interaction_context_sid: Union[str, object] = values.unset, + webhook_ttid: Union[str, object] = values.unset, ) -> InteractionInstance: """ Create the InteractionInstance @@ -211,6 +298,7 @@ def create( :param channel: The Interaction's channel. :param routing: The Interaction's routing logic. :param interaction_context_sid: The Interaction context sid is used for adding a context lookup sid + :param webhook_ttid: The unique identifier for Interaction level webhook :returns: The created InteractionInstance """ @@ -220,6 +308,7 @@ def create( "Channel": serialize.object(channel), "Routing": serialize.object(routing), "InteractionContextSid": interaction_context_sid, + "WebhookTtid": webhook_ttid, } ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -239,6 +328,7 @@ async def create_async( channel: object, routing: Union[object, object] = values.unset, interaction_context_sid: Union[str, object] = values.unset, + webhook_ttid: Union[str, object] = values.unset, ) -> InteractionInstance: """ Asynchronously create the InteractionInstance @@ -246,6 +336,7 @@ async def create_async( :param channel: The Interaction's channel. :param routing: The Interaction's routing logic. :param interaction_context_sid: The Interaction context sid is used for adding a context lookup sid + :param webhook_ttid: The unique identifier for Interaction level webhook :returns: The created InteractionInstance """ @@ -255,6 +346,7 @@ async def create_async( "Channel": serialize.object(channel), "Routing": serialize.object(routing), "InteractionContextSid": interaction_context_sid, + "WebhookTtid": webhook_ttid, } ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) diff --git a/twilio/rest/messaging/MessagingBase.py b/twilio/rest/messaging/MessagingBase.py index 4fff74d914..e45ed56fcd 100644 --- a/twilio/rest/messaging/MessagingBase.py +++ b/twilio/rest/messaging/MessagingBase.py @@ -14,6 +14,7 @@ from twilio.base.domain import Domain from twilio.rest import Client from twilio.rest.messaging.v1 import V1 +from twilio.rest.messaging.v2 import V2 class MessagingBase(Domain): @@ -26,6 +27,7 @@ def __init__(self, twilio: Client): """ super().__init__(twilio, "https://messaging.twilio.com") self._v1: Optional[V1] = None + self._v2: Optional[V2] = None @property def v1(self) -> V1: @@ -36,6 +38,15 @@ def v1(self) -> V1: self._v1 = V1(self) return self._v1 + @property + def v2(self) -> V2: + """ + :returns: Versions v2 of Messaging + """ + if self._v2 is None: + self._v2 = V2(self) + return self._v2 + def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/messaging/v2/__init__.py b/twilio/rest/messaging/v2/__init__.py new file mode 100644 index 0000000000..7ef89fdc5a --- /dev/null +++ b/twilio/rest/messaging/v2/__init__.py @@ -0,0 +1,43 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Messaging + 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 Optional +from twilio.base.version import Version +from twilio.base.domain import Domain +from twilio.rest.messaging.v2.channels_sender import ChannelsSenderList + + +class V2(Version): + + def __init__(self, domain: Domain): + """ + Initialize the V2 version of Messaging + + :param domain: The Twilio.messaging domain + """ + super().__init__(domain, "v2") + self._channels_senders: Optional[ChannelsSenderList] = None + + @property + def channels_senders(self) -> ChannelsSenderList: + if self._channels_senders is None: + self._channels_senders = ChannelsSenderList(self) + return self._channels_senders + + def __repr__(self) -> str: + """ + Provide a friendly representation + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/messaging/v2/channels_sender.py b/twilio/rest/messaging/v2/channels_sender.py new file mode 100644 index 0000000000..53fa2e6e1e --- /dev/null +++ b/twilio/rest/messaging/v2/channels_sender.py @@ -0,0 +1,1242 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Messaging + 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, Union, Iterator, AsyncIterator +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version +from twilio.base.page import Page + + +class ChannelsSenderInstance(InstanceResource): + + class MessagingV2ChannelsSenderConfiguration(object): + """ + :ivar waba_id: The ID of the WhatsApp Business Account to use for this sender. + :ivar verification_method: The method to use for verification. Either \"sms\" or \"voice\". + :ivar verification_code: The verification code to use for this sender. + :ivar voice_application_sid: The SID of the Twilio Voice application to use for this sender. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.waba_id: Optional[str] = payload.get("waba_id") + self.verification_method: Optional["ChannelsSenderInstance.str"] = ( + payload.get("verification_method") + ) + self.verification_code: Optional[str] = payload.get("verification_code") + self.voice_application_sid: Optional[str] = payload.get( + "voice_application_sid" + ) + + def to_dict(self): + return { + "waba_id": self.waba_id, + "verification_method": self.verification_method, + "verification_code": self.verification_code, + "voice_application_sid": self.voice_application_sid, + } + + class MessagingV2ChannelsSenderProfile(object): + """ + :ivar name: The name of the sender. + :ivar about: The about text of the sender. + :ivar address: The address of the sender. + :ivar description: The description of the sender. + :ivar emails: The emails of the sender. + :ivar logo_url: The logo URL of the sender. + :ivar vertical: The vertical of the sender. Allowed values are: - \"Automotive\" - \"Beauty, Spa and Salon\" - \"Clothing and Apparel\" - \"Education\" - \"Entertainment\" - \"Event Planning and Service\" - \"Finance and Banking\" - \"Food and Grocery\" - \"Public Service\" - \"Hotel and Lodging\" - \"Medical and Health\" - \"Non-profit\" - \"Professional Services\" - \"Shopping and Retail\" - \"Travel and Transportation\" - \"Restaurant\" - \"Other\" + :ivar websites: The websites of the sender. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.name: Optional[str] = payload.get("name") + self.about: Optional[str] = payload.get("about") + self.address: Optional[str] = payload.get("address") + self.description: Optional[str] = payload.get("description") + self.emails: Optional[ + List[ChannelsSenderList.MessagingV2ChannelsSenderProfileEmails] + ] = payload.get("emails") + self.logo_url: Optional[str] = payload.get("logo_url") + self.vertical: Optional[str] = payload.get("vertical") + self.websites: Optional[ + List[ChannelsSenderList.MessagingV2ChannelsSenderProfileWebsites] + ] = payload.get("websites") + + def to_dict(self): + return { + "name": self.name, + "about": self.about, + "address": self.address, + "description": self.description, + "emails": ( + [emails.to_dict() for emails in self.emails] + if self.emails is not None + else None + ), + "logo_url": self.logo_url, + "vertical": self.vertical, + "websites": ( + [websites.to_dict() for websites in self.websites] + if self.websites is not None + else None + ), + } + + class MessagingV2ChannelsSenderProfileEmails(object): + """ + :ivar email: The email of the sender. + :ivar label: The label of the sender. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.email: Optional[str] = payload.get("email") + self.label: Optional[str] = payload.get("label") + + def to_dict(self): + return { + "email": self.email, + "label": self.label, + } + + class MessagingV2ChannelsSenderProfileWebsites(object): + """ + :ivar label: The label of the sender. + :ivar website: The website of the sender. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.label: Optional[str] = payload.get("label") + self.website: Optional[str] = payload.get("website") + + def to_dict(self): + return { + "label": self.label, + "website": self.website, + } + + class MessagingV2ChannelsSenderRequestsCreate(object): + """ + :ivar sender_id: The ID of this Sender prefixed with the channel, e.g., `whatsapp:E.164` + :ivar configuration: + :ivar webhook: + :ivar profile: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.sender_id: Optional[str] = payload.get("sender_id") + self.configuration: Optional[ + ChannelsSenderList.MessagingV2ChannelsSenderConfiguration + ] = payload.get("configuration") + self.webhook: Optional[ + ChannelsSenderList.MessagingV2ChannelsSenderWebhook + ] = payload.get("webhook") + self.profile: Optional[ + ChannelsSenderList.MessagingV2ChannelsSenderProfile + ] = payload.get("profile") + + def to_dict(self): + return { + "sender_id": self.sender_id, + "configuration": ( + self.configuration.to_dict() + if self.configuration is not None + else None + ), + "webhook": self.webhook.to_dict() if self.webhook is not None else None, + "profile": self.profile.to_dict() if self.profile is not None else None, + } + + class MessagingV2ChannelsSenderRequestsUpdate(object): + """ + :ivar configuration: + :ivar webhook: + :ivar profile: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.configuration: Optional[ + ChannelsSenderList.MessagingV2ChannelsSenderConfiguration + ] = payload.get("configuration") + self.webhook: Optional[ + ChannelsSenderList.MessagingV2ChannelsSenderWebhook + ] = payload.get("webhook") + self.profile: Optional[ + ChannelsSenderList.MessagingV2ChannelsSenderProfile + ] = payload.get("profile") + + def to_dict(self): + return { + "configuration": ( + self.configuration.to_dict() + if self.configuration is not None + else None + ), + "webhook": self.webhook.to_dict() if self.webhook is not None else None, + "profile": self.profile.to_dict() if self.profile is not None else None, + } + + class MessagingV2ChannelsSenderWebhook(object): + """ + :ivar callback_url: The URL to send the webhook to. + :ivar callback_method: The HTTP method to use for the webhook. Either \"POST\" or \"PUT\". + :ivar fallback_url: The URL to send the fallback webhook to. + :ivar fallback_method: The HTTP method to use for the fallback webhook. Either \"POST\" or \"PUT\". + :ivar status_callback_url: The URL to send the status callback to. + :ivar status_callback_method: The HTTP method to use for the status callback. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.callback_url: Optional[str] = payload.get("callback_url") + self.callback_method: Optional["ChannelsSenderInstance.str"] = payload.get( + "callback_method" + ) + self.fallback_url: Optional[str] = payload.get("fallback_url") + self.fallback_method: Optional["ChannelsSenderInstance.str"] = payload.get( + "fallback_method" + ) + self.status_callback_url: Optional[str] = payload.get("status_callback_url") + self.status_callback_method: Optional[str] = payload.get( + "status_callback_method" + ) + + def to_dict(self): + return { + "callback_url": self.callback_url, + "callback_method": self.callback_method, + "fallback_url": self.fallback_url, + "fallback_method": self.fallback_method, + "status_callback_url": self.status_callback_url, + "status_callback_method": self.status_callback_method, + } + + class Status(object): + CREATING = "CREATING" + ONLINE = "ONLINE" + OFFLINE = "OFFLINE" + PENDING_VERIFICATION = "PENDING_VERIFICATION" + VERIFYING = "VERIFYING" + ONLINE_UPDATING = "ONLINE:UPDATING" + STUBBED = "STUBBED" + + """ + :ivar sid: A 34 character string that uniquely identifies this Sender. + :ivar status: + :ivar sender_id: The ID of this Sender prefixed with the channel, e.g., `whatsapp:E.164` + :ivar configuration: + :ivar webhook: + :ivar profile: + :ivar properties: + :ivar offline_reasons: Reasons why the sender is offline., e.g., [{\"code\": \"21211400\", \"message\": \"Whatsapp business account is banned by provider {provider_name} | Credit line is assigned to another BSP\", \"more_info\": \"https://www.twilio.com/docs/errors/21211400\"}] + :ivar url: The URL of this resource, relative to `https://messaging.twilio.com`. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): + super().__init__(version) + + self.sid: Optional[str] = payload.get("sid") + self.status: Optional["ChannelsSenderInstance.Status"] = payload.get("status") + self.sender_id: Optional[str] = payload.get("sender_id") + self.configuration: Optional[str] = payload.get("configuration") + self.webhook: Optional[str] = payload.get("webhook") + self.profile: Optional[str] = payload.get("profile") + self.properties: Optional[str] = payload.get("properties") + self.offline_reasons: Optional[List[str]] = payload.get("offline_reasons") + self.url: Optional[str] = payload.get("url") + + self._solution = { + "sid": sid or self.sid, + } + self._context: Optional[ChannelsSenderContext] = None + + @property + def _proxy(self) -> "ChannelsSenderContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: ChannelsSenderContext for this ChannelsSenderInstance + """ + if self._context is None: + self._context = ChannelsSenderContext( + self._version, + sid=self._solution["sid"], + ) + return self._context + + def delete(self) -> bool: + """ + Deletes the ChannelsSenderInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the ChannelsSenderInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def fetch(self) -> "ChannelsSenderInstance": + """ + Fetch the ChannelsSenderInstance + + + :returns: The fetched ChannelsSenderInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "ChannelsSenderInstance": + """ + Asynchronous coroutine to fetch the ChannelsSenderInstance + + + :returns: The fetched ChannelsSenderInstance + """ + return await self._proxy.fetch_async() + + def update( + self, + messaging_v2_channels_sender_requests_update: Union[ + MessagingV2ChannelsSenderRequestsUpdate, object + ] = values.unset, + ) -> "ChannelsSenderInstance": + """ + Update the ChannelsSenderInstance + + :param messaging_v2_channels_sender_requests_update: + + :returns: The updated ChannelsSenderInstance + """ + return self._proxy.update( + messaging_v2_channels_sender_requests_update=messaging_v2_channels_sender_requests_update, + ) + + async def update_async( + self, + messaging_v2_channels_sender_requests_update: Union[ + MessagingV2ChannelsSenderRequestsUpdate, object + ] = values.unset, + ) -> "ChannelsSenderInstance": + """ + Asynchronous coroutine to update the ChannelsSenderInstance + + :param messaging_v2_channels_sender_requests_update: + + :returns: The updated ChannelsSenderInstance + """ + return await self._proxy.update_async( + messaging_v2_channels_sender_requests_update=messaging_v2_channels_sender_requests_update, + ) + + 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 ChannelsSenderContext(InstanceContext): + + class MessagingV2ChannelsSenderConfiguration(object): + """ + :ivar waba_id: The ID of the WhatsApp Business Account to use for this sender. + :ivar verification_method: The method to use for verification. Either \"sms\" or \"voice\". + :ivar verification_code: The verification code to use for this sender. + :ivar voice_application_sid: The SID of the Twilio Voice application to use for this sender. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.waba_id: Optional[str] = payload.get("waba_id") + self.verification_method: Optional["ChannelsSenderInstance.str"] = ( + payload.get("verification_method") + ) + self.verification_code: Optional[str] = payload.get("verification_code") + self.voice_application_sid: Optional[str] = payload.get( + "voice_application_sid" + ) + + def to_dict(self): + return { + "waba_id": self.waba_id, + "verification_method": self.verification_method, + "verification_code": self.verification_code, + "voice_application_sid": self.voice_application_sid, + } + + class MessagingV2ChannelsSenderProfile(object): + """ + :ivar name: The name of the sender. + :ivar about: The about text of the sender. + :ivar address: The address of the sender. + :ivar description: The description of the sender. + :ivar emails: The emails of the sender. + :ivar logo_url: The logo URL of the sender. + :ivar vertical: The vertical of the sender. Allowed values are: - \"Automotive\" - \"Beauty, Spa and Salon\" - \"Clothing and Apparel\" - \"Education\" - \"Entertainment\" - \"Event Planning and Service\" - \"Finance and Banking\" - \"Food and Grocery\" - \"Public Service\" - \"Hotel and Lodging\" - \"Medical and Health\" - \"Non-profit\" - \"Professional Services\" - \"Shopping and Retail\" - \"Travel and Transportation\" - \"Restaurant\" - \"Other\" + :ivar websites: The websites of the sender. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.name: Optional[str] = payload.get("name") + self.about: Optional[str] = payload.get("about") + self.address: Optional[str] = payload.get("address") + self.description: Optional[str] = payload.get("description") + self.emails: Optional[ + List[ChannelsSenderList.MessagingV2ChannelsSenderProfileEmails] + ] = payload.get("emails") + self.logo_url: Optional[str] = payload.get("logo_url") + self.vertical: Optional[str] = payload.get("vertical") + self.websites: Optional[ + List[ChannelsSenderList.MessagingV2ChannelsSenderProfileWebsites] + ] = payload.get("websites") + + def to_dict(self): + return { + "name": self.name, + "about": self.about, + "address": self.address, + "description": self.description, + "emails": ( + [emails.to_dict() for emails in self.emails] + if self.emails is not None + else None + ), + "logo_url": self.logo_url, + "vertical": self.vertical, + "websites": ( + [websites.to_dict() for websites in self.websites] + if self.websites is not None + else None + ), + } + + class MessagingV2ChannelsSenderProfileEmails(object): + """ + :ivar email: The email of the sender. + :ivar label: The label of the sender. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.email: Optional[str] = payload.get("email") + self.label: Optional[str] = payload.get("label") + + def to_dict(self): + return { + "email": self.email, + "label": self.label, + } + + class MessagingV2ChannelsSenderProfileWebsites(object): + """ + :ivar label: The label of the sender. + :ivar website: The website of the sender. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.label: Optional[str] = payload.get("label") + self.website: Optional[str] = payload.get("website") + + def to_dict(self): + return { + "label": self.label, + "website": self.website, + } + + class MessagingV2ChannelsSenderRequestsCreate(object): + """ + :ivar sender_id: The ID of this Sender prefixed with the channel, e.g., `whatsapp:E.164` + :ivar configuration: + :ivar webhook: + :ivar profile: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.sender_id: Optional[str] = payload.get("sender_id") + self.configuration: Optional[ + ChannelsSenderList.MessagingV2ChannelsSenderConfiguration + ] = payload.get("configuration") + self.webhook: Optional[ + ChannelsSenderList.MessagingV2ChannelsSenderWebhook + ] = payload.get("webhook") + self.profile: Optional[ + ChannelsSenderList.MessagingV2ChannelsSenderProfile + ] = payload.get("profile") + + def to_dict(self): + return { + "sender_id": self.sender_id, + "configuration": ( + self.configuration.to_dict() + if self.configuration is not None + else None + ), + "webhook": self.webhook.to_dict() if self.webhook is not None else None, + "profile": self.profile.to_dict() if self.profile is not None else None, + } + + class MessagingV2ChannelsSenderRequestsUpdate(object): + """ + :ivar configuration: + :ivar webhook: + :ivar profile: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.configuration: Optional[ + ChannelsSenderList.MessagingV2ChannelsSenderConfiguration + ] = payload.get("configuration") + self.webhook: Optional[ + ChannelsSenderList.MessagingV2ChannelsSenderWebhook + ] = payload.get("webhook") + self.profile: Optional[ + ChannelsSenderList.MessagingV2ChannelsSenderProfile + ] = payload.get("profile") + + def to_dict(self): + return { + "configuration": ( + self.configuration.to_dict() + if self.configuration is not None + else None + ), + "webhook": self.webhook.to_dict() if self.webhook is not None else None, + "profile": self.profile.to_dict() if self.profile is not None else None, + } + + class MessagingV2ChannelsSenderWebhook(object): + """ + :ivar callback_url: The URL to send the webhook to. + :ivar callback_method: The HTTP method to use for the webhook. Either \"POST\" or \"PUT\". + :ivar fallback_url: The URL to send the fallback webhook to. + :ivar fallback_method: The HTTP method to use for the fallback webhook. Either \"POST\" or \"PUT\". + :ivar status_callback_url: The URL to send the status callback to. + :ivar status_callback_method: The HTTP method to use for the status callback. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.callback_url: Optional[str] = payload.get("callback_url") + self.callback_method: Optional["ChannelsSenderInstance.str"] = payload.get( + "callback_method" + ) + self.fallback_url: Optional[str] = payload.get("fallback_url") + self.fallback_method: Optional["ChannelsSenderInstance.str"] = payload.get( + "fallback_method" + ) + self.status_callback_url: Optional[str] = payload.get("status_callback_url") + self.status_callback_method: Optional[str] = payload.get( + "status_callback_method" + ) + + def to_dict(self): + return { + "callback_url": self.callback_url, + "callback_method": self.callback_method, + "fallback_url": self.fallback_url, + "fallback_method": self.fallback_method, + "status_callback_url": self.status_callback_url, + "status_callback_method": self.status_callback_method, + } + + def __init__(self, version: Version, sid: str): + """ + Initialize the ChannelsSenderContext + + :param version: Version that contains the resource + :param sid: A 34 character string that uniquely identifies this Sender. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "sid": sid, + } + self._uri = "/Channels/Senders/{sid}".format(**self._solution) + + def delete(self) -> bool: + """ + Deletes the ChannelsSenderInstance + + + :returns: True if delete succeeds, False otherwise + """ + + headers = values.of({}) + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the ChannelsSenderInstance + + + :returns: True if delete succeeds, False otherwise + """ + + headers = values.of({}) + + return await self._version.delete_async( + method="DELETE", uri=self._uri, headers=headers + ) + + def fetch(self) -> ChannelsSenderInstance: + """ + Fetch the ChannelsSenderInstance + + + :returns: The fetched ChannelsSenderInstance + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) + + return ChannelsSenderInstance( + self._version, + payload, + sid=self._solution["sid"], + ) + + async def fetch_async(self) -> ChannelsSenderInstance: + """ + Asynchronous coroutine to fetch the ChannelsSenderInstance + + + :returns: The fetched ChannelsSenderInstance + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = await self._version.fetch_async( + method="GET", uri=self._uri, headers=headers + ) + + return ChannelsSenderInstance( + self._version, + payload, + sid=self._solution["sid"], + ) + + def update( + self, + messaging_v2_channels_sender_requests_update: Union[ + MessagingV2ChannelsSenderRequestsUpdate, object + ] = values.unset, + ) -> ChannelsSenderInstance: + """ + Update the ChannelsSenderInstance + + :param messaging_v2_channels_sender_requests_update: + + :returns: The updated ChannelsSenderInstance + """ + data = messaging_v2_channels_sender_requests_update.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + payload = self._version.update( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return ChannelsSenderInstance(self._version, payload, sid=self._solution["sid"]) + + async def update_async( + self, + messaging_v2_channels_sender_requests_update: Union[ + MessagingV2ChannelsSenderRequestsUpdate, object + ] = values.unset, + ) -> ChannelsSenderInstance: + """ + Asynchronous coroutine to update the ChannelsSenderInstance + + :param messaging_v2_channels_sender_requests_update: + + :returns: The updated ChannelsSenderInstance + """ + data = messaging_v2_channels_sender_requests_update.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + payload = await self._version.update_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return ChannelsSenderInstance(self._version, payload, sid=self._solution["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 ChannelsSenderPage(Page): + + def get_instance(self, payload: Dict[str, Any]) -> ChannelsSenderInstance: + """ + Build an instance of ChannelsSenderInstance + + :param payload: Payload response from the API + """ + return ChannelsSenderInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class ChannelsSenderList(ListResource): + + class MessagingV2ChannelsSenderConfiguration(object): + """ + :ivar waba_id: The ID of the WhatsApp Business Account to use for this sender. + :ivar verification_method: The method to use for verification. Either \"sms\" or \"voice\". + :ivar verification_code: The verification code to use for this sender. + :ivar voice_application_sid: The SID of the Twilio Voice application to use for this sender. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.waba_id: Optional[str] = payload.get("waba_id") + self.verification_method: Optional["ChannelsSenderInstance.str"] = ( + payload.get("verification_method") + ) + self.verification_code: Optional[str] = payload.get("verification_code") + self.voice_application_sid: Optional[str] = payload.get( + "voice_application_sid" + ) + + def to_dict(self): + return { + "waba_id": self.waba_id, + "verification_method": self.verification_method, + "verification_code": self.verification_code, + "voice_application_sid": self.voice_application_sid, + } + + class MessagingV2ChannelsSenderProfile(object): + """ + :ivar name: The name of the sender. + :ivar about: The about text of the sender. + :ivar address: The address of the sender. + :ivar description: The description of the sender. + :ivar emails: The emails of the sender. + :ivar logo_url: The logo URL of the sender. + :ivar vertical: The vertical of the sender. Allowed values are: - \"Automotive\" - \"Beauty, Spa and Salon\" - \"Clothing and Apparel\" - \"Education\" - \"Entertainment\" - \"Event Planning and Service\" - \"Finance and Banking\" - \"Food and Grocery\" - \"Public Service\" - \"Hotel and Lodging\" - \"Medical and Health\" - \"Non-profit\" - \"Professional Services\" - \"Shopping and Retail\" - \"Travel and Transportation\" - \"Restaurant\" - \"Other\" + :ivar websites: The websites of the sender. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.name: Optional[str] = payload.get("name") + self.about: Optional[str] = payload.get("about") + self.address: Optional[str] = payload.get("address") + self.description: Optional[str] = payload.get("description") + self.emails: Optional[ + List[ChannelsSenderList.MessagingV2ChannelsSenderProfileEmails] + ] = payload.get("emails") + self.logo_url: Optional[str] = payload.get("logo_url") + self.vertical: Optional[str] = payload.get("vertical") + self.websites: Optional[ + List[ChannelsSenderList.MessagingV2ChannelsSenderProfileWebsites] + ] = payload.get("websites") + + def to_dict(self): + return { + "name": self.name, + "about": self.about, + "address": self.address, + "description": self.description, + "emails": ( + [emails.to_dict() for emails in self.emails] + if self.emails is not None + else None + ), + "logo_url": self.logo_url, + "vertical": self.vertical, + "websites": ( + [websites.to_dict() for websites in self.websites] + if self.websites is not None + else None + ), + } + + class MessagingV2ChannelsSenderProfileEmails(object): + """ + :ivar email: The email of the sender. + :ivar label: The label of the sender. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.email: Optional[str] = payload.get("email") + self.label: Optional[str] = payload.get("label") + + def to_dict(self): + return { + "email": self.email, + "label": self.label, + } + + class MessagingV2ChannelsSenderProfileWebsites(object): + """ + :ivar label: The label of the sender. + :ivar website: The website of the sender. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.label: Optional[str] = payload.get("label") + self.website: Optional[str] = payload.get("website") + + def to_dict(self): + return { + "label": self.label, + "website": self.website, + } + + class MessagingV2ChannelsSenderRequestsCreate(object): + """ + :ivar sender_id: The ID of this Sender prefixed with the channel, e.g., `whatsapp:E.164` + :ivar configuration: + :ivar webhook: + :ivar profile: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.sender_id: Optional[str] = payload.get("sender_id") + self.configuration: Optional[ + ChannelsSenderList.MessagingV2ChannelsSenderConfiguration + ] = payload.get("configuration") + self.webhook: Optional[ + ChannelsSenderList.MessagingV2ChannelsSenderWebhook + ] = payload.get("webhook") + self.profile: Optional[ + ChannelsSenderList.MessagingV2ChannelsSenderProfile + ] = payload.get("profile") + + def to_dict(self): + return { + "sender_id": self.sender_id, + "configuration": ( + self.configuration.to_dict() + if self.configuration is not None + else None + ), + "webhook": self.webhook.to_dict() if self.webhook is not None else None, + "profile": self.profile.to_dict() if self.profile is not None else None, + } + + class MessagingV2ChannelsSenderRequestsUpdate(object): + """ + :ivar configuration: + :ivar webhook: + :ivar profile: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.configuration: Optional[ + ChannelsSenderList.MessagingV2ChannelsSenderConfiguration + ] = payload.get("configuration") + self.webhook: Optional[ + ChannelsSenderList.MessagingV2ChannelsSenderWebhook + ] = payload.get("webhook") + self.profile: Optional[ + ChannelsSenderList.MessagingV2ChannelsSenderProfile + ] = payload.get("profile") + + def to_dict(self): + return { + "configuration": ( + self.configuration.to_dict() + if self.configuration is not None + else None + ), + "webhook": self.webhook.to_dict() if self.webhook is not None else None, + "profile": self.profile.to_dict() if self.profile is not None else None, + } + + class MessagingV2ChannelsSenderWebhook(object): + """ + :ivar callback_url: The URL to send the webhook to. + :ivar callback_method: The HTTP method to use for the webhook. Either \"POST\" or \"PUT\". + :ivar fallback_url: The URL to send the fallback webhook to. + :ivar fallback_method: The HTTP method to use for the fallback webhook. Either \"POST\" or \"PUT\". + :ivar status_callback_url: The URL to send the status callback to. + :ivar status_callback_method: The HTTP method to use for the status callback. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.callback_url: Optional[str] = payload.get("callback_url") + self.callback_method: Optional["ChannelsSenderInstance.str"] = payload.get( + "callback_method" + ) + self.fallback_url: Optional[str] = payload.get("fallback_url") + self.fallback_method: Optional["ChannelsSenderInstance.str"] = payload.get( + "fallback_method" + ) + self.status_callback_url: Optional[str] = payload.get("status_callback_url") + self.status_callback_method: Optional[str] = payload.get( + "status_callback_method" + ) + + def to_dict(self): + return { + "callback_url": self.callback_url, + "callback_method": self.callback_method, + "fallback_url": self.fallback_url, + "fallback_method": self.fallback_method, + "status_callback_url": self.status_callback_url, + "status_callback_method": self.status_callback_method, + } + + def __init__(self, version: Version): + """ + Initialize the ChannelsSenderList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/Channels/Senders" + + def create( + self, + messaging_v2_channels_sender_requests_create: MessagingV2ChannelsSenderRequestsCreate, + ) -> ChannelsSenderInstance: + """ + Create the ChannelsSenderInstance + + :param messaging_v2_channels_sender_requests_create: + + :returns: The created ChannelsSenderInstance + """ + data = messaging_v2_channels_sender_requests_create.to_dict() + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return ChannelsSenderInstance(self._version, payload) + + async def create_async( + self, + messaging_v2_channels_sender_requests_create: MessagingV2ChannelsSenderRequestsCreate, + ) -> ChannelsSenderInstance: + """ + Asynchronously create the ChannelsSenderInstance + + :param messaging_v2_channels_sender_requests_create: + + :returns: The created ChannelsSenderInstance + """ + data = messaging_v2_channels_sender_requests_create.to_dict() + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return ChannelsSenderInstance(self._version, payload) + + def stream( + self, + channel: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[ChannelsSenderInstance]: + """ + Streams ChannelsSenderInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param str channel: + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = self.page(channel=channel, page_size=limits["page_size"]) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + channel: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[ChannelsSenderInstance]: + """ + Asynchronously streams ChannelsSenderInstance records from the API as a generator stream. + This operation lazily loads records as efficiently as possible until the limit + is reached. + The results are returned as a generator, so this operation is memory efficient. + + :param str channel: + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, stream() will attempt to read the + limit with the most efficient page size, i.e. min(limit, 1000) + + :returns: Generator that will yield up to limit results + """ + limits = self._version.read_limits(limit, page_size) + page = await self.page_async(channel=channel, page_size=limits["page_size"]) + + return self._version.stream_async(page, limits["limit"]) + + def list( + self, + channel: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[ChannelsSenderInstance]: + """ + Lists ChannelsSenderInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str channel: + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return list( + self.stream( + channel=channel, + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + channel: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[ChannelsSenderInstance]: + """ + Asynchronously lists ChannelsSenderInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str channel: + :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 + the default value of 50 records. If no page_size is defined + but a limit is defined, list() will attempt to read the limit + with the most efficient page size, i.e. min(limit, 1000) + + :returns: list that will contain up to limit results + """ + return [ + record + async for record in await self.stream_async( + channel=channel, + limit=limit, + page_size=page_size, + ) + ] + + def page( + self, + channel: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ChannelsSenderPage: + """ + Retrieve a single page of ChannelsSenderInstance records from the API. + Request is executed immediately + + :param channel: + :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 + + :returns: Page of ChannelsSenderInstance + """ + data = values.of( + { + "Channel": channel, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = self._version.page( + method="GET", uri=self._uri, params=data, headers=headers + ) + return ChannelsSenderPage(self._version, response) + + async def page_async( + self, + channel: Union[str, object] = values.unset, + page_token: Union[str, object] = values.unset, + page_number: Union[int, object] = values.unset, + page_size: Union[int, object] = values.unset, + ) -> ChannelsSenderPage: + """ + Asynchronously retrieve a single page of ChannelsSenderInstance records from the API. + Request is executed immediately + + :param channel: + :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 + + :returns: Page of ChannelsSenderInstance + """ + data = values.of( + { + "Channel": channel, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + response = await self._version.page_async( + method="GET", uri=self._uri, params=data, headers=headers + ) + return ChannelsSenderPage(self._version, response) + + def get_page(self, target_url: str) -> ChannelsSenderPage: + """ + Retrieve a specific page of ChannelsSenderInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of ChannelsSenderInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return ChannelsSenderPage(self._version, response) + + async def get_page_async(self, target_url: str) -> ChannelsSenderPage: + """ + Asynchronously retrieve a specific page of ChannelsSenderInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of ChannelsSenderInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return ChannelsSenderPage(self._version, response) + + def get(self, sid: str) -> ChannelsSenderContext: + """ + Constructs a ChannelsSenderContext + + :param sid: A 34 character string that uniquely identifies this Sender. + """ + return ChannelsSenderContext(self._version, sid=sid) + + def __call__(self, sid: str) -> ChannelsSenderContext: + """ + Constructs a ChannelsSenderContext + + :param sid: A 34 character string that uniquely identifies this Sender. + """ + return ChannelsSenderContext(self._version, sid=sid) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/numbers/v1/__init__.py b/twilio/rest/numbers/v1/__init__.py index 68f078a88d..043364c3d5 100644 --- a/twilio/rest/numbers/v1/__init__.py +++ b/twilio/rest/numbers/v1/__init__.py @@ -28,10 +28,12 @@ from twilio.rest.numbers.v1.porting_webhook_configuration_delete import ( PortingWebhookConfigurationDeleteList, ) +from twilio.rest.numbers.v1.porting_webhook_configuration_fetch import ( + PortingWebhookConfigurationFetchList, +) from twilio.rest.numbers.v1.signing_request_configuration import ( SigningRequestConfigurationList, ) -from twilio.rest.numbers.v1.webhook import WebhookList class V1(Version): @@ -56,10 +58,12 @@ def __init__(self, domain: Domain): self._porting_webhook_configurations_delete: Optional[ PortingWebhookConfigurationDeleteList ] = None + self._porting_webhook_configuration_fetch: Optional[ + PortingWebhookConfigurationFetchList + ] = None self._signing_request_configurations: Optional[ SigningRequestConfigurationList ] = None - self._webhook: Optional[WebhookList] = None @property def bulk_eligibilities(self) -> BulkEligibilityList: @@ -107,18 +111,22 @@ def porting_webhook_configurations_delete( ) return self._porting_webhook_configurations_delete + @property + def porting_webhook_configuration_fetch( + self, + ) -> PortingWebhookConfigurationFetchList: + if self._porting_webhook_configuration_fetch is None: + self._porting_webhook_configuration_fetch = ( + PortingWebhookConfigurationFetchList(self) + ) + return self._porting_webhook_configuration_fetch + @property def signing_request_configurations(self) -> SigningRequestConfigurationList: if self._signing_request_configurations is None: self._signing_request_configurations = SigningRequestConfigurationList(self) return self._signing_request_configurations - @property - def webhook(self) -> WebhookList: - if self._webhook is None: - self._webhook = WebhookList(self) - return self._webhook - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/numbers/v1/webhook.py b/twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py similarity index 78% rename from twilio/rest/numbers/v1/webhook.py rename to twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py index 69bd556326..5d381768c7 100644 --- a/twilio/rest/numbers/v1/webhook.py +++ b/twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py @@ -21,7 +21,7 @@ from twilio.base.version import Version -class WebhookInstance(InstanceResource): +class PortingWebhookConfigurationFetchInstance(InstanceResource): """ :ivar url: The URL of the webhook configuration request :ivar port_in_target_url: The complete webhook url that will be called when a notification event for port in request or port in phone number happens @@ -52,14 +52,14 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" -class WebhookList(ListResource): +class PortingWebhookConfigurationFetchList(ListResource): def __init__(self, version: Version): """ - Initialize the WebhookList + Initialize the PortingWebhookConfigurationFetchList :param version: Version that contains the resource @@ -68,12 +68,12 @@ def __init__(self, version: Version): self._uri = "/Porting/Configuration/Webhook" - def fetch(self) -> WebhookInstance: + def fetch(self) -> PortingWebhookConfigurationFetchInstance: """ - Asynchronously fetch the WebhookInstance + Asynchronously fetch the PortingWebhookConfigurationFetchInstance - :returns: The fetched WebhookInstance + :returns: The fetched PortingWebhookConfigurationFetchInstance """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -81,14 +81,14 @@ def fetch(self) -> WebhookInstance: payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) - return WebhookInstance(self._version, payload) + return PortingWebhookConfigurationFetchInstance(self._version, payload) - async def fetch_async(self) -> WebhookInstance: + async def fetch_async(self) -> PortingWebhookConfigurationFetchInstance: """ - Asynchronously fetch the WebhookInstance + Asynchronously fetch the PortingWebhookConfigurationFetchInstance - :returns: The fetched WebhookInstance + :returns: The fetched PortingWebhookConfigurationFetchInstance """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -98,7 +98,7 @@ async def fetch_async(self) -> WebhookInstance: method="GET", uri=self._uri, headers=headers ) - return WebhookInstance(self._version, payload) + return PortingWebhookConfigurationFetchInstance(self._version, payload) def __repr__(self) -> str: """ @@ -106,4 +106,4 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" diff --git a/twilio/rest/serverless/v1/service/build/__init__.py b/twilio/rest/serverless/v1/service/build/__init__.py index ddd59918b4..5a7b6b7023 100644 --- a/twilio/rest/serverless/v1/service/build/__init__.py +++ b/twilio/rest/serverless/v1/service/build/__init__.py @@ -34,6 +34,8 @@ class Runtime(object): NODE14 = "node14" NODE16 = "node16" NODE18 = "node18" + NODE20 = "node20" + NODE22 = "node22" class Status(object): BUILDING = "building" diff --git a/twilio/rest/video/v1/room/__init__.py b/twilio/rest/video/v1/room/__init__.py index 0fb7a7b0dd..d51b8b8711 100644 --- a/twilio/rest/video/v1/room/__init__.py +++ b/twilio/rest/video/v1/room/__init__.py @@ -416,9 +416,11 @@ def create( status_callback_method: Union[str, object] = values.unset, max_participants: Union[int, object] = values.unset, record_participants_on_connect: Union[bool, object] = values.unset, + transcribe_participants_on_connect: Union[bool, object] = values.unset, video_codecs: Union[List["RoomInstance.VideoCodec"], object] = values.unset, media_region: Union[str, object] = values.unset, recording_rules: Union[object, object] = values.unset, + transcriptions_configuration: Union[object, object] = values.unset, audio_only: Union[bool, object] = values.unset, max_participant_duration: Union[int, object] = values.unset, empty_room_timeout: Union[int, object] = values.unset, @@ -435,9 +437,11 @@ def create( :param status_callback_method: The HTTP method Twilio should use to call `status_callback`. Can be `POST` or `GET`. :param max_participants: The maximum number of concurrent Participants allowed in the room. The maximum allowed value is 50. :param record_participants_on_connect: Whether to start recording when Participants connect. + :param transcribe_participants_on_connect: Whether to start transcriptions when Participants connect. If TranscriptionsConfiguration is not provided, default settings will be used. :param video_codecs: An array of the video codecs that are supported when publishing a track in the room. Can be: `VP8` and `H264`. :param media_region: The region for the Room's media server. Can be one of the [available Media Regions](https://www.twilio.com/docs/video/ip-addresses#group-rooms-media-servers). :param recording_rules: A collection of Recording Rules that describe how to include or exclude matching tracks for recording + :param transcriptions_configuration: A collection of properties that describe transcription behaviour. If TranscribeParticipantsOnConnect is set to true and TranscriptionsConfiguration is not provided, default settings will be used. :param audio_only: When set to true, indicates that the participants in the room will only publish audio. No video tracks will be allowed. :param max_participant_duration: The maximum number of seconds a Participant can be connected to the room. The maximum possible value is 86400 seconds (24 hours). The default is 14400 seconds (4 hours). :param empty_room_timeout: Configures how long (in minutes) a room will remain active after last participant leaves. Valid values range from 1 to 60 minutes (no fractions). @@ -458,9 +462,15 @@ def create( "RecordParticipantsOnConnect": serialize.boolean_to_string( record_participants_on_connect ), + "TranscribeParticipantsOnConnect": serialize.boolean_to_string( + transcribe_participants_on_connect + ), "VideoCodecs": serialize.map(video_codecs, lambda e: e), "MediaRegion": media_region, "RecordingRules": serialize.object(recording_rules), + "TranscriptionsConfiguration": serialize.object( + transcriptions_configuration + ), "AudioOnly": serialize.boolean_to_string(audio_only), "MaxParticipantDuration": max_participant_duration, "EmptyRoomTimeout": empty_room_timeout, @@ -489,9 +499,11 @@ async def create_async( status_callback_method: Union[str, object] = values.unset, max_participants: Union[int, object] = values.unset, record_participants_on_connect: Union[bool, object] = values.unset, + transcribe_participants_on_connect: Union[bool, object] = values.unset, video_codecs: Union[List["RoomInstance.VideoCodec"], object] = values.unset, media_region: Union[str, object] = values.unset, recording_rules: Union[object, object] = values.unset, + transcriptions_configuration: Union[object, object] = values.unset, audio_only: Union[bool, object] = values.unset, max_participant_duration: Union[int, object] = values.unset, empty_room_timeout: Union[int, object] = values.unset, @@ -508,9 +520,11 @@ async def create_async( :param status_callback_method: The HTTP method Twilio should use to call `status_callback`. Can be `POST` or `GET`. :param max_participants: The maximum number of concurrent Participants allowed in the room. The maximum allowed value is 50. :param record_participants_on_connect: Whether to start recording when Participants connect. + :param transcribe_participants_on_connect: Whether to start transcriptions when Participants connect. If TranscriptionsConfiguration is not provided, default settings will be used. :param video_codecs: An array of the video codecs that are supported when publishing a track in the room. Can be: `VP8` and `H264`. :param media_region: The region for the Room's media server. Can be one of the [available Media Regions](https://www.twilio.com/docs/video/ip-addresses#group-rooms-media-servers). :param recording_rules: A collection of Recording Rules that describe how to include or exclude matching tracks for recording + :param transcriptions_configuration: A collection of properties that describe transcription behaviour. If TranscribeParticipantsOnConnect is set to true and TranscriptionsConfiguration is not provided, default settings will be used. :param audio_only: When set to true, indicates that the participants in the room will only publish audio. No video tracks will be allowed. :param max_participant_duration: The maximum number of seconds a Participant can be connected to the room. The maximum possible value is 86400 seconds (24 hours). The default is 14400 seconds (4 hours). :param empty_room_timeout: Configures how long (in minutes) a room will remain active after last participant leaves. Valid values range from 1 to 60 minutes (no fractions). @@ -531,9 +545,15 @@ async def create_async( "RecordParticipantsOnConnect": serialize.boolean_to_string( record_participants_on_connect ), + "TranscribeParticipantsOnConnect": serialize.boolean_to_string( + transcribe_participants_on_connect + ), "VideoCodecs": serialize.map(video_codecs, lambda e: e), "MediaRegion": media_region, "RecordingRules": serialize.object(recording_rules), + "TranscriptionsConfiguration": serialize.object( + transcriptions_configuration + ), "AudioOnly": serialize.boolean_to_string(audio_only), "MaxParticipantDuration": max_participant_duration, "EmptyRoomTimeout": empty_room_timeout, From c5b9ee0c46776db22c24837a62f631d479964755 Mon Sep 17 00:00:00 2001 From: Twilio Date: Mon, 5 May 2025 10:41:40 +0000 Subject: [PATCH 87/87] Release 9.6.0 --- setup.py | 2 +- twilio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index d03f823242..b0ea12a364 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name="twilio", - version="9.5.2", + version="9.6.0", description="Twilio API client and TwiML generator", author="Twilio", help_center="https://www.twilio.com/help/contact", diff --git a/twilio/__init__.py b/twilio/__init__.py index 15e4058354..128c99df6b 100644 --- a/twilio/__init__.py +++ b/twilio/__init__.py @@ -1,2 +1,2 @@ -__version_info__ = ("9", "5", "2") +__version_info__ = ("9", "6", "0") __version__ = ".".join(__version_info__)