diff --git a/CHANGES.md b/CHANGES.md index bccccfbea9..b9e9c6e477 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-01-25] Version 8.12.0 +--------------------------- +**Oauth** +- updated openid discovery endpoint uri **(breaking change)** +- Added device code authorization endpoint +- added oauth JWKS endpoint +- Get userinfo resource +- OpenID discovery resource +- Add new API for token endpoint + + [2024-01-14] Version 8.11.1 --------------------------- **Library - Chore** diff --git a/setup.py b/setup.py index 0d4b6b95fb..213c094a09 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name="twilio", - version="8.11.1", + version="8.12.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 358affa551..cda97201bf 100644 --- a/twilio/__init__.py +++ b/twilio/__init__.py @@ -1,2 +1,2 @@ -__version_info__ = ("8", "11", "1") +__version_info__ = ("8", "12", "0") __version__ = ".".join(__version_info__) diff --git a/twilio/rest/__init__.py b/twilio/rest/__init__.py index ef6e22e9c5..e883e66ec7 100644 --- a/twilio/rest/__init__.py +++ b/twilio/rest/__init__.py @@ -15,6 +15,7 @@ if TYPE_CHECKING: from twilio.rest.accounts import Accounts from twilio.rest.api import Api + from twilio.rest.autopilot import Autopilot from twilio.rest.bulkexports import Bulkexports from twilio.rest.chat import Chat from twilio.rest.content import Content @@ -32,6 +33,7 @@ from twilio.rest.monitor import Monitor from twilio.rest.notify import Notify from twilio.rest.numbers import Numbers + from twilio.rest.oauth import Oauth from twilio.rest.preview import Preview from twilio.rest.pricing import Pricing from twilio.rest.proxy import Proxy @@ -122,6 +124,7 @@ def __init__( # Domains self._accounts: Optional["Accounts"] = None self._api: Optional["Api"] = None + self._autopilot: Optional["Autopilot"] = None self._bulkexports: Optional["Bulkexports"] = None self._chat: Optional["Chat"] = None self._content: Optional["Content"] = None @@ -139,6 +142,7 @@ def __init__( self._monitor: Optional["Monitor"] = None self._notify: Optional["Notify"] = None self._numbers: Optional["Numbers"] = None + self._oauth: Optional["Oauth"] = None self._preview: Optional["Preview"] = None self._pricing: Optional["Pricing"] = None self._proxy: Optional["Proxy"] = None @@ -181,6 +185,19 @@ def api(self) -> "Api": self._api = Api(self) return self._api + @property + def autopilot(self) -> "Autopilot": + """ + Access the Autopilot Twilio Domain + + :returns: Autopilot Twilio Domain + """ + if self._autopilot is None: + from twilio.rest.autopilot import Autopilot + + self._autopilot = Autopilot(self) + return self._autopilot + @property def bulkexports(self) -> "Bulkexports": """ @@ -402,6 +419,19 @@ def numbers(self) -> "Numbers": self._numbers = Numbers(self) return self._numbers + @property + def oauth(self) -> "Oauth": + """ + Access the Oauth Twilio Domain + + :returns: Oauth Twilio Domain + """ + if self._oauth is None: + from twilio.rest.oauth import Oauth + + self._oauth = Oauth(self) + return self._oauth + @property def preview(self) -> "Preview": """ diff --git a/twilio/rest/accounts/v1/credential/aws.py b/twilio/rest/accounts/v1/credential/aws.py index ae1efb6a1b..0e17164ecb 100644 --- a/twilio/rest/accounts/v1/credential/aws.py +++ b/twilio/rest/accounts/v1/credential/aws.py @@ -321,7 +321,6 @@ def create( :returns: The created AwsInstance """ - data = values.of( { "Credentials": credentials, @@ -353,7 +352,6 @@ async def create_async( :returns: The created AwsInstance """ - data = values.of( { "Credentials": credentials, diff --git a/twilio/rest/accounts/v1/credential/public_key.py b/twilio/rest/accounts/v1/credential/public_key.py index 2177ebced2..f78a6728c1 100644 --- a/twilio/rest/accounts/v1/credential/public_key.py +++ b/twilio/rest/accounts/v1/credential/public_key.py @@ -325,7 +325,6 @@ def create( :returns: The created PublicKeyInstance """ - data = values.of( { "PublicKey": public_key, @@ -357,7 +356,6 @@ async def create_async( :returns: The created PublicKeyInstance """ - data = values.of( { "PublicKey": public_key, diff --git a/twilio/rest/accounts/v1/safelist.py b/twilio/rest/accounts/v1/safelist.py index 9ba12c1e99..fb658a677f 100644 --- a/twilio/rest/accounts/v1/safelist.py +++ b/twilio/rest/accounts/v1/safelist.py @@ -13,7 +13,7 @@ """ -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 @@ -64,7 +64,6 @@ def create(self, phone_number: str) -> SafelistInstance: :returns: The created SafelistInstance """ - data = values.of( { "PhoneNumber": phone_number, @@ -87,7 +86,6 @@ async def create_async(self, phone_number: str) -> SafelistInstance: :returns: The created SafelistInstance """ - data = values.of( { "PhoneNumber": phone_number, @@ -102,77 +100,23 @@ async def create_async(self, phone_number: str) -> SafelistInstance: return SafelistInstance(self._version, payload) - 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). - :returns: True if delete succeeds, False otherwise - """ - - params = values.of( - { - "PhoneNumber": phone_number, - } - ) - return self._version.delete(method="DELETE", uri=self._uri, params=params) - - async def delete_async( - 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). - :returns: True if delete succeeds, False otherwise - """ - - params = values.of( - { - "PhoneNumber": phone_number, - } - ) - return await self._version.delete_async( - method="DELETE", uri=self._uri, params=params - ) - - def fetch( - self, phone_number: Union[str, object] = values.unset - ) -> SafelistInstance: + def fetch(self) -> SafelistInstance: """ 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). :returns: The fetched SafelistInstance """ - - params = values.of( - { - "PhoneNumber": phone_number, - } - ) - payload = self._version.fetch(method="GET", uri=self._uri, params=params) + payload = self._version.fetch(method="GET", uri=self._uri) return SafelistInstance(self._version, payload) - async def fetch_async( - self, phone_number: Union[str, object] = values.unset - ) -> SafelistInstance: + async def fetch_async(self) -> SafelistInstance: """ 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). :returns: The fetched SafelistInstance """ - - params = values.of( - { - "PhoneNumber": phone_number, - } - ) - payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=params - ) + payload = await self._version.fetch_async(method="GET", uri=self._uri) return SafelistInstance(self._version, payload) diff --git a/twilio/rest/api/v2010/account/__init__.py b/twilio/rest/api/v2010/account/__init__.py index d45ee80182..fafb4f573c 100644 --- a/twilio/rest/api/v2010/account/__init__.py +++ b/twilio/rest/api/v2010/account/__init__.py @@ -821,7 +821,6 @@ def create( :returns: The created AccountInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -846,7 +845,6 @@ async def create_async( :returns: The created AccountInstance """ - data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/api/v2010/account/address/__init__.py b/twilio/rest/api/v2010/account/address/__init__.py index 2c52ef902d..224601e270 100644 --- a/twilio/rest/api/v2010/account/address/__init__.py +++ b/twilio/rest/api/v2010/account/address/__init__.py @@ -513,7 +513,6 @@ def create( :returns: The created AddressInstance """ - data = values.of( { "CustomerName": customer_name, @@ -568,7 +567,6 @@ async def create_async( :returns: The created AddressInstance """ - data = values.of( { "CustomerName": customer_name, diff --git a/twilio/rest/api/v2010/account/application.py b/twilio/rest/api/v2010/account/application.py index d11dc6f7cc..5179d5d55b 100644 --- a/twilio/rest/api/v2010/account/application.py +++ b/twilio/rest/api/v2010/account/application.py @@ -602,7 +602,6 @@ def create( :returns: The created ApplicationInstance """ - data = values.of( { "ApiVersion": api_version, @@ -675,7 +674,6 @@ async def create_async( :returns: The created ApplicationInstance """ - data = values.of( { "ApiVersion": api_version, diff --git a/twilio/rest/api/v2010/account/authorized_connect_app.py b/twilio/rest/api/v2010/account/authorized_connect_app.py index a62da5a760..4d71766b62 100644 --- a/twilio/rest/api/v2010/account/authorized_connect_app.py +++ b/twilio/rest/api/v2010/account/authorized_connect_app.py @@ -13,8 +13,9 @@ """ +from datetime import datetime from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import values +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 @@ -34,6 +35,8 @@ class Permission(object): :ivar connect_app_friendly_name: The name of the Connect App. :ivar connect_app_homepage_url: The public URL for the Connect App. :ivar connect_app_sid: The SID that we assigned to the Connect App. + :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 permissions: The set of permissions that you authorized for the Connect App. Can be: `get-all` or `post-all`. :ivar uri: The URI of the resource, relative to `https://api.twilio.com`. """ @@ -61,6 +64,12 @@ def __init__( "connect_app_homepage_url" ) self.connect_app_sid: Optional[str] = payload.get("connect_app_sid") + 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.permissions: Optional[ List["AuthorizedConnectAppInstance.Permission"] ] = payload.get("permissions") diff --git a/twilio/rest/api/v2010/account/balance.py b/twilio/rest/api/v2010/account/balance.py index befb75e694..e3c2d5e7e4 100644 --- a/twilio/rest/api/v2010/account/balance.py +++ b/twilio/rest/api/v2010/account/balance.py @@ -70,10 +70,8 @@ def fetch(self) -> BalanceInstance: """ Asynchronously fetch the BalanceInstance - :returns: The fetched BalanceInstance """ - payload = self._version.fetch(method="GET", uri=self._uri) return BalanceInstance( @@ -84,10 +82,8 @@ async def fetch_async(self) -> BalanceInstance: """ Asynchronously fetch the BalanceInstance - :returns: The fetched BalanceInstance """ - payload = await self._version.fetch_async(method="GET", uri=self._uri) return BalanceInstance( diff --git a/twilio/rest/api/v2010/account/call/__init__.py b/twilio/rest/api/v2010/account/call/__init__.py index 02acc7c42c..7c969eff7d 100644 --- a/twilio/rest/api/v2010/account/call/__init__.py +++ b/twilio/rest/api/v2010/account/call/__init__.py @@ -785,7 +785,6 @@ def create( :returns: The created CallInstance """ - data = values.of( { "To": to, @@ -919,7 +918,6 @@ async def create_async( :returns: The created CallInstance """ - data = values.of( { "To": to, diff --git a/twilio/rest/api/v2010/account/call/feedback_summary.py b/twilio/rest/api/v2010/account/call/feedback_summary.py index a856fda5ac..fcfb4e0ab1 100644 --- a/twilio/rest/api/v2010/account/call/feedback_summary.py +++ b/twilio/rest/api/v2010/account/call/feedback_summary.py @@ -70,7 +70,7 @@ def __init__( payload.get("end_date") ) self.include_subaccounts: Optional[bool] = payload.get("include_subaccounts") - self.issues: Optional[List[Dict[str, object]]] = payload.get("issues") + self.issues: Optional[List[object]] = payload.get("issues") self.quality_score_average: Optional[float] = deserialize.decimal( payload.get("quality_score_average") ) @@ -286,7 +286,6 @@ def create( :returns: The created FeedbackSummaryInstance """ - data = values.of( { "StartDate": serialize.iso8601_date(start_date), @@ -326,7 +325,6 @@ async def create_async( :returns: The created FeedbackSummaryInstance """ - data = values.of( { "StartDate": serialize.iso8601_date(start_date), diff --git a/twilio/rest/api/v2010/account/call/payment.py b/twilio/rest/api/v2010/account/call/payment.py index 2233971912..10d00441ba 100644 --- a/twilio/rest/api/v2010/account/call/payment.py +++ b/twilio/rest/api/v2010/account/call/payment.py @@ -338,7 +338,6 @@ def create( :returns: The created PaymentInstance """ - data = values.of( { "IdempotencyKey": idempotency_key, @@ -416,7 +415,6 @@ async def create_async( :returns: The created PaymentInstance """ - data = values.of( { "IdempotencyKey": idempotency_key, diff --git a/twilio/rest/api/v2010/account/call/recording.py b/twilio/rest/api/v2010/account/call/recording.py index 99ed688ea2..7ca36f3e00 100644 --- a/twilio/rest/api/v2010/account/call/recording.py +++ b/twilio/rest/api/v2010/account/call/recording.py @@ -438,7 +438,6 @@ def create( :returns: The created RecordingInstance """ - data = values.of( { "RecordingStatusCallbackEvent": serialize.map( @@ -486,7 +485,6 @@ async def create_async( :returns: The created RecordingInstance """ - data = values.of( { "RecordingStatusCallbackEvent": serialize.map( diff --git a/twilio/rest/api/v2010/account/call/siprec.py b/twilio/rest/api/v2010/account/call/siprec.py index 23b8cfbe35..86bfd5c6bc 100644 --- a/twilio/rest/api/v2010/account/call/siprec.py +++ b/twilio/rest/api/v2010/account/call/siprec.py @@ -651,7 +651,6 @@ def create( :returns: The created SiprecInstance """ - data = values.of( { "Name": name, @@ -1288,7 +1287,6 @@ async def create_async( :returns: The created SiprecInstance """ - data = values.of( { "Name": name, diff --git a/twilio/rest/api/v2010/account/call/stream.py b/twilio/rest/api/v2010/account/call/stream.py index 949d6dc197..1999e9379b 100644 --- a/twilio/rest/api/v2010/account/call/stream.py +++ b/twilio/rest/api/v2010/account/call/stream.py @@ -653,7 +653,6 @@ def create( :returns: The created StreamInstance """ - data = values.of( { "Url": url, @@ -1290,7 +1289,6 @@ async def create_async( :returns: The created StreamInstance """ - data = values.of( { "Url": url, 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 2aef221eb5..0beef389d7 100644 --- a/twilio/rest/api/v2010/account/call/user_defined_message.py +++ b/twilio/rest/api/v2010/account/call/user_defined_message.py @@ -92,7 +92,6 @@ def create( :returns: The created UserDefinedMessageInstance """ - data = values.of( { "Content": content, @@ -124,7 +123,6 @@ async def create_async( :returns: The created UserDefinedMessageInstance """ - data = values.of( { "Content": content, 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 8d90b7bf5e..c34905dcdb 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 @@ -198,7 +198,6 @@ def create( :returns: The created UserDefinedMessageSubscriptionInstance """ - data = values.of( { "Callback": callback, @@ -235,7 +234,6 @@ async def create_async( :returns: The created UserDefinedMessageSubscriptionInstance """ - data = values.of( { "Callback": callback, diff --git a/twilio/rest/api/v2010/account/conference/participant.py b/twilio/rest/api/v2010/account/conference/participant.py index c14ae1d5fa..e1c2e90b36 100644 --- a/twilio/rest/api/v2010/account/conference/participant.py +++ b/twilio/rest/api/v2010/account/conference/participant.py @@ -571,7 +571,6 @@ def create( amd_status_callback: Union[str, object] = values.unset, amd_status_callback_method: Union[str, object] = values.unset, trim: Union[str, object] = values.unset, - call_token: Union[str, object] = values.unset, ) -> ParticipantInstance: """ Create the ParticipantInstance @@ -623,11 +622,9 @@ def create( :param amd_status_callback: The URL that we should call using the `amd_status_callback_method` to notify customer application whether the call was answered by human, machine or fax. :param amd_status_callback_method: The HTTP method we should use when calling the `amd_status_callback` URL. Can be: `GET` or `POST` and the default is `POST`. :param trim: Whether to trim any leading and trailing silence from the participant recording. Can be: `trim-silence` or `do-not-trim` and the default is `trim-silence`. - :param call_token: A token string needed to invoke a forwarded call. A call_token is generated when an incoming call is received on a Twilio number. Pass an incoming call's call_token value to a forwarded call via the call_token parameter when creating a new call. A forwarded call should bear the same CallerID of the original incoming call. :returns: The created ParticipantInstance """ - data = values.of( { "From": from_, @@ -685,7 +682,6 @@ def create( "AmdStatusCallback": amd_status_callback, "AmdStatusCallbackMethod": amd_status_callback_method, "Trim": trim, - "CallToken": call_token, } ) @@ -753,7 +749,6 @@ async def create_async( amd_status_callback: Union[str, object] = values.unset, amd_status_callback_method: Union[str, object] = values.unset, trim: Union[str, object] = values.unset, - call_token: Union[str, object] = values.unset, ) -> ParticipantInstance: """ Asynchronously create the ParticipantInstance @@ -805,11 +800,9 @@ async def create_async( :param amd_status_callback: The URL that we should call using the `amd_status_callback_method` to notify customer application whether the call was answered by human, machine or fax. :param amd_status_callback_method: The HTTP method we should use when calling the `amd_status_callback` URL. Can be: `GET` or `POST` and the default is `POST`. :param trim: Whether to trim any leading and trailing silence from the participant recording. Can be: `trim-silence` or `do-not-trim` and the default is `trim-silence`. - :param call_token: A token string needed to invoke a forwarded call. A call_token is generated when an incoming call is received on a Twilio number. Pass an incoming call's call_token value to a forwarded call via the call_token parameter when creating a new call. A forwarded call should bear the same CallerID of the original incoming call. :returns: The created ParticipantInstance """ - data = values.of( { "From": from_, @@ -867,7 +860,6 @@ async def create_async( "AmdStatusCallback": amd_status_callback, "AmdStatusCallbackMethod": amd_status_callback_method, "Trim": trim, - "CallToken": call_token, } ) 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 f26c7589b2..121d2f03c8 100644 --- a/twilio/rest/api/v2010/account/incoming_phone_number/__init__.py +++ b/twilio/rest/api/v2010/account/incoming_phone_number/__init__.py @@ -807,7 +807,6 @@ def create( :returns: The created IncomingPhoneNumberInstance """ - data = values.of( { "ApiVersion": api_version, @@ -908,7 +907,6 @@ async def create_async( :returns: The created IncomingPhoneNumberInstance """ - data = values.of( { "ApiVersion": api_version, 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 645d0e846c..4b04d75256 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 @@ -313,7 +313,6 @@ def create(self, installed_add_on_sid: str) -> AssignedAddOnInstance: :returns: The created AssignedAddOnInstance """ - data = values.of( { "InstalledAddOnSid": installed_add_on_sid, @@ -341,7 +340,6 @@ async def create_async(self, installed_add_on_sid: str) -> AssignedAddOnInstance :returns: The created AssignedAddOnInstance """ - data = values.of( { "InstalledAddOnSid": installed_add_on_sid, 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 eb69e05c08..4af79dcf8a 100644 --- a/twilio/rest/api/v2010/account/incoming_phone_number/local.py +++ b/twilio/rest/api/v2010/account/incoming_phone_number/local.py @@ -247,7 +247,6 @@ def create( :returns: The created LocalInstance """ - data = values.of( { "PhoneNumber": phone_number, @@ -343,7 +342,6 @@ async def create_async( :returns: The created LocalInstance """ - data = values.of( { "PhoneNumber": phone_number, 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 7acd28c0f0..2ab5a652c5 100644 --- a/twilio/rest/api/v2010/account/incoming_phone_number/mobile.py +++ b/twilio/rest/api/v2010/account/incoming_phone_number/mobile.py @@ -249,7 +249,6 @@ def create( :returns: The created MobileInstance """ - data = values.of( { "PhoneNumber": phone_number, @@ -347,7 +346,6 @@ async def create_async( :returns: The created MobileInstance """ - data = values.of( { "PhoneNumber": phone_number, 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 7d8592e90a..3b995504a5 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 @@ -249,7 +249,6 @@ def create( :returns: The created TollFreeInstance """ - data = values.of( { "PhoneNumber": phone_number, @@ -347,7 +346,6 @@ async def create_async( :returns: The created TollFreeInstance """ - data = values.of( { "PhoneNumber": phone_number, diff --git a/twilio/rest/api/v2010/account/message/__init__.py b/twilio/rest/api/v2010/account/message/__init__.py index ace53ea0de..58ea4f32b8 100644 --- a/twilio/rest/api/v2010/account/message/__init__.py +++ b/twilio/rest/api/v2010/account/message/__init__.py @@ -69,7 +69,7 @@ class UpdateStatus(object): :ivar body: The text content of the message :ivar num_segments: The number of segments that make up the complete message. SMS message bodies that exceed the [character limit](https://www.twilio.com/docs/glossary/what-sms-character-limit) are segmented and charged as multiple messages. Note: For messages sent via a Messaging Service, `num_segments` is initially `0`, since a sender hasn't yet been assigned. :ivar direction: - :ivar from_: The sender's phone number (in [E.164](https://en.wikipedia.org/wiki/E.164) format), [alphanumeric sender ID](https://www.twilio.com/docs/sms/quickstart), [Wireless SIM](https://www.twilio.com/docs/iot/wireless/programmable-wireless-send-machine-machine-sms-commands), [short code](https://www.twilio.com/en-us/messaging/channels/sms/short-codes), or [channel address](https://www.twilio.com/docs/messaging/channels) (e.g., `whatsapp:+15554449999`). For incoming messages, this is the number or channel address of the sender. For outgoing messages, this value is a Twilio phone number, alphanumeric sender ID, short code, or channel address from which the message is sent. + :ivar from_: The sender's phone number (in [E.164](https://en.wikipedia.org/wiki/E.164) format), [alphanumeric sender ID](https://www.twilio.com/docs/sms/send-messages#use-an-alphanumeric-sender-id), [Wireless SIM](https://www.twilio.com/docs/iot/wireless/programmable-wireless-send-machine-machine-sms-commands), [short code](https://www.twilio.com/docs/sms/api/short-code), or [channel address](https://www.twilio.com/docs/messaging/channels) (e.g., `whatsapp:+15554449999`). For incoming messages, this is the number or channel address of the sender. For outgoing messages, this value is a Twilio phone number, alphanumeric sender ID, short code, or channel address from which the message is sent. :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. @@ -515,21 +515,20 @@ 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 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 shorten_urls: For Messaging Services with [Link Shortening configured](https://www.twilio.com/docs/messaging/features/how-to-configure-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. :param send_as_mms: If set to `true`, Twilio delivers the message as a single MMS message, regardless of the presence of media. :param content_variables: For [Content Editor/API](https://www.twilio.com/docs/content) only: Key-value pairs of [Template variables](https://www.twilio.com/docs/content/using-variables-with-content-api) and their substitution values. `content_sid` parameter must also be provided. If values are not defined in the `content_variables` parameter, the [Template's default placeholder values](https://www.twilio.com/docs/content/content-api-resources#create-templates) are used. :param risk_check: - :param from_: The sender's Twilio phone number (in [E.164](https://en.wikipedia.org/wiki/E.164) format), [alphanumeric sender ID](https://www.twilio.com/docs/sms/quickstart), [Wireless SIM](https://www.twilio.com/docs/iot/wireless/programmable-wireless-send-machine-machine-sms-commands), [short code](https://www.twilio.com/en-us/messaging/channels/sms/short-codes), or [channel address](https://www.twilio.com/docs/messaging/channels) (e.g., `whatsapp:+15554449999`). The value of the `from` parameter must be a sender that is hosted within Twilio and belongs to the Account creating the Message. If you are using `messaging_service_sid`, this parameter can be empty (Twilio assigns a `from` value from the Messaging Service's Sender Pool) or you can provide a specific sender from your Sender Pool. + :param from_: The sender's Twilio phone number (in [E.164](https://en.wikipedia.org/wiki/E.164) format), [alphanumeric sender ID](https://www.twilio.com/docs/sms/send-messages#use-an-alphanumeric-sender-id), [Wireless SIM](https://www.twilio.com/docs/iot/wireless/programmable-wireless-send-machine-machine-sms-commands), [short code](https://www.twilio.com/docs/sms/api/short-code), or [channel address](https://www.twilio.com/docs/messaging/channels) (e.g., `whatsapp:+15554449999`). The value of the `from` parameter must be a sender that is hosted within Twilio and belongs to the Account creating the Message. If you are using `messaging_service_sid`, this parameter can be empty (Twilio assigns a `from` value from the Messaging Service's Sender Pool) or you can provide a specific sender from your Sender Pool. :param messaging_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/services) you want to associate with the Message. When this parameter is provided and the `from` parameter is omitted, Twilio selects the optimal sender from the Messaging Service's Sender Pool. You may also provide a `from` parameter if you want to use a specific Sender from the Sender Pool. :param body: The text content of the outgoing message. Can be up to 1,600 characters in length. SMS only: If the `body` contains more than 160 [GSM-7](https://www.twilio.com/docs/glossary/what-is-gsm-7-character-encoding) characters (or 70 [UCS-2](https://www.twilio.com/docs/glossary/what-is-ucs-2-character-encoding) characters), the message is segmented and charged accordingly. For long `body` text, consider using the [send_as_mms parameter](https://www.twilio.com/blog/mms-for-long-text-messages). - :param media_url: The URL of media to include in the Message content. `jpeg`, `jpg`, `gif`, and `png` file types are fully supported by Twilio and content is formatted for delivery on destination devices. The media size limit is 5 MB for supported file types (`jpeg`, `jpg`, `png`, `gif`) and 500 KB for [other types](https://www.twilio.com/docs/messaging/guides/accepted-mime-types) of accepted media. To send more than one image in the message, provide multiple `media_url` parameters in the POST request. You can include up to ten `media_url` parameters per message. [International](https://support.twilio.com/hc/en-us/articles/223179808-Sending-and-receiving-MMS-messages) and [carrier](https://support.twilio.com/hc/en-us/articles/223133707-Is-MMS-supported-for-all-carriers-in-US-and-Canada-) limits apply. + :param media_url: The URL of media to include in the Message content. `jpeg`, `jpg`, `gif`, and `png` file types are fully supported by Twilio and content is formatted for delivery on destination devices. The media size limit is 5 MB for supported file types (`jpeg`, `jpg`, `png`, `gif`) and 500 KB for [other types](https://www.twilio.com/docs/sms/accepted-mime-types) of accepted media. To send more than one image in the message, provide multiple `media_url` parameters in the POST request. You can include up to ten `media_url` parameters per message. [International](https://support.twilio.com/hc/en-us/articles/223179808-Sending-and-receiving-MMS-messages) and [carrier](https://support.twilio.com/hc/en-us/articles/223133707-Is-MMS-supported-for-all-carriers-in-US-and-Canada-) limits apply. :param content_sid: For [Content Editor/API](https://www.twilio.com/docs/content) only: The SID of the Content Template to be used with the Message, e.g., `HXXXXXXXXXXXXXXXXXXXXXXXXXXXXX`. If this parameter is not provided, a Content Template is not used. Find the SID in the Console on the Content Editor page. For Content API users, the SID is found in Twilio's response when [creating the Template](https://www.twilio.com/docs/content/content-api-resources#create-templates) or by [fetching your Templates](https://www.twilio.com/docs/content/content-api-resources#fetch-all-content-resources). :returns: The created MessageInstance """ - data = values.of( { "To": to, @@ -613,21 +612,20 @@ 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 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 shorten_urls: For Messaging Services with [Link Shortening configured](https://www.twilio.com/docs/messaging/features/how-to-configure-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. :param send_as_mms: If set to `true`, Twilio delivers the message as a single MMS message, regardless of the presence of media. :param content_variables: For [Content Editor/API](https://www.twilio.com/docs/content) only: Key-value pairs of [Template variables](https://www.twilio.com/docs/content/using-variables-with-content-api) and their substitution values. `content_sid` parameter must also be provided. If values are not defined in the `content_variables` parameter, the [Template's default placeholder values](https://www.twilio.com/docs/content/content-api-resources#create-templates) are used. :param risk_check: - :param from_: The sender's Twilio phone number (in [E.164](https://en.wikipedia.org/wiki/E.164) format), [alphanumeric sender ID](https://www.twilio.com/docs/sms/quickstart), [Wireless SIM](https://www.twilio.com/docs/iot/wireless/programmable-wireless-send-machine-machine-sms-commands), [short code](https://www.twilio.com/en-us/messaging/channels/sms/short-codes), or [channel address](https://www.twilio.com/docs/messaging/channels) (e.g., `whatsapp:+15554449999`). The value of the `from` parameter must be a sender that is hosted within Twilio and belongs to the Account creating the Message. If you are using `messaging_service_sid`, this parameter can be empty (Twilio assigns a `from` value from the Messaging Service's Sender Pool) or you can provide a specific sender from your Sender Pool. + :param from_: The sender's Twilio phone number (in [E.164](https://en.wikipedia.org/wiki/E.164) format), [alphanumeric sender ID](https://www.twilio.com/docs/sms/send-messages#use-an-alphanumeric-sender-id), [Wireless SIM](https://www.twilio.com/docs/iot/wireless/programmable-wireless-send-machine-machine-sms-commands), [short code](https://www.twilio.com/docs/sms/api/short-code), or [channel address](https://www.twilio.com/docs/messaging/channels) (e.g., `whatsapp:+15554449999`). The value of the `from` parameter must be a sender that is hosted within Twilio and belongs to the Account creating the Message. If you are using `messaging_service_sid`, this parameter can be empty (Twilio assigns a `from` value from the Messaging Service's Sender Pool) or you can provide a specific sender from your Sender Pool. :param messaging_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/services) you want to associate with the Message. When this parameter is provided and the `from` parameter is omitted, Twilio selects the optimal sender from the Messaging Service's Sender Pool. You may also provide a `from` parameter if you want to use a specific Sender from the Sender Pool. :param body: The text content of the outgoing message. Can be up to 1,600 characters in length. SMS only: If the `body` contains more than 160 [GSM-7](https://www.twilio.com/docs/glossary/what-is-gsm-7-character-encoding) characters (or 70 [UCS-2](https://www.twilio.com/docs/glossary/what-is-ucs-2-character-encoding) characters), the message is segmented and charged accordingly. For long `body` text, consider using the [send_as_mms parameter](https://www.twilio.com/blog/mms-for-long-text-messages). - :param media_url: The URL of media to include in the Message content. `jpeg`, `jpg`, `gif`, and `png` file types are fully supported by Twilio and content is formatted for delivery on destination devices. The media size limit is 5 MB for supported file types (`jpeg`, `jpg`, `png`, `gif`) and 500 KB for [other types](https://www.twilio.com/docs/messaging/guides/accepted-mime-types) of accepted media. To send more than one image in the message, provide multiple `media_url` parameters in the POST request. You can include up to ten `media_url` parameters per message. [International](https://support.twilio.com/hc/en-us/articles/223179808-Sending-and-receiving-MMS-messages) and [carrier](https://support.twilio.com/hc/en-us/articles/223133707-Is-MMS-supported-for-all-carriers-in-US-and-Canada-) limits apply. + :param media_url: The URL of media to include in the Message content. `jpeg`, `jpg`, `gif`, and `png` file types are fully supported by Twilio and content is formatted for delivery on destination devices. The media size limit is 5 MB for supported file types (`jpeg`, `jpg`, `png`, `gif`) and 500 KB for [other types](https://www.twilio.com/docs/sms/accepted-mime-types) of accepted media. To send more than one image in the message, provide multiple `media_url` parameters in the POST request. You can include up to ten `media_url` parameters per message. [International](https://support.twilio.com/hc/en-us/articles/223179808-Sending-and-receiving-MMS-messages) and [carrier](https://support.twilio.com/hc/en-us/articles/223133707-Is-MMS-supported-for-all-carriers-in-US-and-Canada-) limits apply. :param content_sid: For [Content Editor/API](https://www.twilio.com/docs/content) only: The SID of the Content Template to be used with the Message, e.g., `HXXXXXXXXXXXXXXXXXXXXXXXXXXXXX`. If this parameter is not provided, a Content Template is not used. Find the SID in the Console on the Content Editor page. For Content API users, the SID is found in Twilio's response when [creating the Template](https://www.twilio.com/docs/content/content-api-resources#create-templates) or by [fetching your Templates](https://www.twilio.com/docs/content/content-api-resources#fetch-all-content-resources). :returns: The created MessageInstance """ - data = values.of( { "To": to, diff --git a/twilio/rest/api/v2010/account/message/feedback.py b/twilio/rest/api/v2010/account/message/feedback.py index 61a23207c3..7c371ee883 100644 --- a/twilio/rest/api/v2010/account/message/feedback.py +++ b/twilio/rest/api/v2010/account/message/feedback.py @@ -104,7 +104,6 @@ def create( :returns: The created FeedbackInstance """ - data = values.of( { "Outcome": outcome, @@ -134,7 +133,6 @@ async def create_async( :returns: The created FeedbackInstance """ - data = values.of( { "Outcome": outcome, diff --git a/twilio/rest/api/v2010/account/new_key.py b/twilio/rest/api/v2010/account/new_key.py index 2f1015cf00..e7af236ebe 100644 --- a/twilio/rest/api/v2010/account/new_key.py +++ b/twilio/rest/api/v2010/account/new_key.py @@ -86,7 +86,6 @@ def create( :returns: The created NewKeyInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -113,7 +112,6 @@ async def create_async( :returns: The created NewKeyInstance """ - data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/api/v2010/account/new_signing_key.py b/twilio/rest/api/v2010/account/new_signing_key.py index 45f32b50d0..d24e833b86 100644 --- a/twilio/rest/api/v2010/account/new_signing_key.py +++ b/twilio/rest/api/v2010/account/new_signing_key.py @@ -86,7 +86,6 @@ def create( :returns: The created NewSigningKeyInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -113,7 +112,6 @@ async def create_async( :returns: The created NewSigningKeyInstance """ - data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/api/v2010/account/queue/__init__.py b/twilio/rest/api/v2010/account/queue/__init__.py index 0d4530a4b2..73589708fb 100644 --- a/twilio/rest/api/v2010/account/queue/__init__.py +++ b/twilio/rest/api/v2010/account/queue/__init__.py @@ -397,7 +397,6 @@ def create( :returns: The created QueueInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -426,7 +425,6 @@ async def create_async( :returns: The created QueueInstance """ - data = values.of( { "FriendlyName": friendly_name, 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 e026e652df..08ac5bcfe6 100644 --- a/twilio/rest/api/v2010/account/sip/credential_list/__init__.py +++ b/twilio/rest/api/v2010/account/sip/credential_list/__init__.py @@ -368,7 +368,6 @@ def create(self, friendly_name: str) -> CredentialListInstance: :returns: The created CredentialListInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -393,7 +392,6 @@ async def create_async(self, friendly_name: str) -> CredentialListInstance: :returns: The created CredentialListInstance """ - data = values.of( { "FriendlyName": friendly_name, 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 e40caaa329..585950c25c 100644 --- a/twilio/rest/api/v2010/account/sip/credential_list/credential.py +++ b/twilio/rest/api/v2010/account/sip/credential_list/credential.py @@ -366,7 +366,6 @@ def create(self, username: str, password: str) -> CredentialInstance: :returns: The created CredentialInstance """ - data = values.of( { "Username": username, @@ -396,7 +395,6 @@ async def create_async(self, username: str, password: str) -> CredentialInstance :returns: The created CredentialInstance """ - data = values.of( { "Username": username, diff --git a/twilio/rest/api/v2010/account/sip/domain/__init__.py b/twilio/rest/api/v2010/account/sip/domain/__init__.py index 71174f32be..29a2aaeb2a 100644 --- a/twilio/rest/api/v2010/account/sip/domain/__init__.py +++ b/twilio/rest/api/v2010/account/sip/domain/__init__.py @@ -633,7 +633,6 @@ def create( :returns: The created DomainInstance """ - data = values.of( { "DomainName": domain_name, @@ -697,7 +696,6 @@ async def create_async( :returns: The created DomainInstance """ - data = values.of( { "DomainName": domain_name, 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 3ddec185c3..c9cade64f9 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 @@ -281,7 +281,6 @@ def create( :returns: The created AuthCallsCredentialListMappingInstance """ - data = values.of( { "CredentialListSid": credential_list_sid, @@ -311,7 +310,6 @@ async def create_async( :returns: The created AuthCallsCredentialListMappingInstance """ - data = values.of( { "CredentialListSid": credential_list_sid, 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 c410104410..f83393c377 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 @@ -285,7 +285,6 @@ def create( :returns: The created AuthCallsIpAccessControlListMappingInstance """ - data = values.of( { "IpAccessControlListSid": ip_access_control_list_sid, @@ -315,7 +314,6 @@ async def create_async( :returns: The created AuthCallsIpAccessControlListMappingInstance """ - data = values.of( { "IpAccessControlListSid": ip_access_control_list_sid, 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 37f05c7587..a63a6e3290 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 @@ -281,7 +281,6 @@ def create( :returns: The created AuthRegistrationsCredentialListMappingInstance """ - data = values.of( { "CredentialListSid": credential_list_sid, @@ -311,7 +310,6 @@ async def create_async( :returns: The created AuthRegistrationsCredentialListMappingInstance """ - data = values.of( { "CredentialListSid": credential_list_sid, 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 81fb012810..248e0ca37b 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 @@ -277,7 +277,6 @@ def create(self, credential_list_sid: str) -> CredentialListMappingInstance: :returns: The created CredentialListMappingInstance """ - data = values.of( { "CredentialListSid": credential_list_sid, @@ -307,7 +306,6 @@ async def create_async( :returns: The created CredentialListMappingInstance """ - data = values.of( { "CredentialListSid": credential_list_sid, 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 bbea7ade36..cfe65e99dc 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 @@ -283,7 +283,6 @@ def create( :returns: The created IpAccessControlListMappingInstance """ - data = values.of( { "IpAccessControlListSid": ip_access_control_list_sid, @@ -313,7 +312,6 @@ async def create_async( :returns: The created IpAccessControlListMappingInstance """ - data = values.of( { "IpAccessControlListSid": ip_access_control_list_sid, 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 33b219f39b..fac56d8573 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 @@ -372,7 +372,6 @@ def create(self, friendly_name: str) -> IpAccessControlListInstance: :returns: The created IpAccessControlListInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -397,7 +396,6 @@ async def create_async(self, friendly_name: str) -> IpAccessControlListInstance: :returns: The created IpAccessControlListInstance """ - data = values.of( { "FriendlyName": friendly_name, 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 362b645fa3..2ce7f69f18 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 @@ -416,7 +416,6 @@ def create( :returns: The created IpAddressInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -453,7 +452,6 @@ async def create_async( :returns: The created IpAddressInstance """ - data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/api/v2010/account/token.py b/twilio/rest/api/v2010/account/token.py index 3d00c3cf0c..744bedd295 100644 --- a/twilio/rest/api/v2010/account/token.py +++ b/twilio/rest/api/v2010/account/token.py @@ -88,7 +88,6 @@ def create(self, ttl: Union[int, object] = values.unset) -> TokenInstance: :returns: The created TokenInstance """ - data = values.of( { "Ttl": ttl, @@ -115,7 +114,6 @@ async def create_async( :returns: The created TokenInstance """ - data = values.of( { "Ttl": ttl, diff --git a/twilio/rest/api/v2010/account/usage/trigger.py b/twilio/rest/api/v2010/account/usage/trigger.py index 67fd82f780..bd165916e2 100644 --- a/twilio/rest/api/v2010/account/usage/trigger.py +++ b/twilio/rest/api/v2010/account/usage/trigger.py @@ -751,7 +751,6 @@ def create( :returns: The created TriggerInstance """ - data = values.of( { "CallbackUrl": callback_url, @@ -797,7 +796,6 @@ async def create_async( :returns: The created TriggerInstance """ - data = values.of( { "CallbackUrl": callback_url, diff --git a/twilio/rest/api/v2010/account/validation_request.py b/twilio/rest/api/v2010/account/validation_request.py index d126cea26c..84ef8ee253 100644 --- a/twilio/rest/api/v2010/account/validation_request.py +++ b/twilio/rest/api/v2010/account/validation_request.py @@ -94,7 +94,6 @@ def create( :returns: The created ValidationRequestInstance """ - data = values.of( { "PhoneNumber": phone_number, @@ -137,7 +136,6 @@ async def create_async( :returns: The created ValidationRequestInstance """ - data = values.of( { "PhoneNumber": phone_number, diff --git a/twilio/rest/autopilot/AutopilotBase.py b/twilio/rest/autopilot/AutopilotBase.py new file mode 100644 index 0000000000..3b1a7f7112 --- /dev/null +++ b/twilio/rest/autopilot/AutopilotBase.py @@ -0,0 +1,43 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +from typing import Optional + +from twilio.base.domain import Domain +from twilio.rest import Client +from twilio.rest.autopilot.v1 import V1 + + +class AutopilotBase(Domain): + def __init__(self, twilio: Client): + """ + Initialize the Autopilot Domain + + :returns: Domain for Autopilot + """ + super().__init__(twilio, "https://autopilot.twilio.com") + self._v1: Optional[V1] = None + + @property + def v1(self) -> V1: + """ + :returns: Versions v1 of Autopilot + """ + 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/autopilot/v1/__init__.py b/twilio/rest/autopilot/v1/__init__.py new file mode 100644 index 0000000000..fd23e47670 --- /dev/null +++ b/twilio/rest/autopilot/v1/__init__.py @@ -0,0 +1,50 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Autopilot + 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.autopilot.v1.assistant import AssistantList +from twilio.rest.autopilot.v1.restore_assistant import RestoreAssistantList + + +class V1(Version): + def __init__(self, domain: Domain): + """ + Initialize the V1 version of Autopilot + + :param domain: The Twilio.autopilot domain + """ + super().__init__(domain, "v1") + self._assistants: Optional[AssistantList] = None + self._restore_assistant: Optional[RestoreAssistantList] = None + + @property + def assistants(self) -> AssistantList: + if self._assistants is None: + self._assistants = AssistantList(self) + return self._assistants + + @property + def restore_assistant(self) -> RestoreAssistantList: + if self._restore_assistant is None: + self._restore_assistant = RestoreAssistantList(self) + return self._restore_assistant + + def __repr__(self) -> str: + """ + Provide a friendly representation + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/autopilot/v1/assistant/__init__.py b/twilio/rest/autopilot/v1/assistant/__init__.py new file mode 100644 index 0000000000..a25268fc45 --- /dev/null +++ b/twilio/rest/autopilot/v1/assistant/__init__.py @@ -0,0 +1,879 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Autopilot + 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.autopilot.v1.assistant.defaults import DefaultsList +from twilio.rest.autopilot.v1.assistant.dialogue import DialogueList +from twilio.rest.autopilot.v1.assistant.field_type import FieldTypeList +from twilio.rest.autopilot.v1.assistant.model_build import ModelBuildList +from twilio.rest.autopilot.v1.assistant.query import QueryList +from twilio.rest.autopilot.v1.assistant.style_sheet import StyleSheetList +from twilio.rest.autopilot.v1.assistant.task import TaskList +from twilio.rest.autopilot.v1.assistant.webhook import WebhookList + + +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 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. + :ivar friendly_name: The string that you assigned to describe the resource. It is not unique and can be up to 255 characters long. + :ivar latest_model_build_sid: Reserved. + :ivar links: A list of the URLs of the Assistant's related resources. + :ivar log_queries: Whether queries should be logged and kept after training. Can be: `true` or `false` and defaults to `true`. If `true`, queries are stored for 30 days, and then deleted. If `false`, no queries are stored. + :ivar development_stage: A string describing the state of the assistant. + :ivar needs_model_build: Whether model needs to be rebuilt. + :ivar sid: The unique string that we created to identify the Assistant 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. It can be up to 64 characters long. + :ivar url: The absolute URL of the Assistant resource. + :ivar callback_url: Reserved. + :ivar callback_events: Reserved. + """ + + 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.friendly_name: Optional[str] = payload.get("friendly_name") + self.latest_model_build_sid: Optional[str] = payload.get( + "latest_model_build_sid" + ) + self.links: Optional[Dict[str, object]] = payload.get("links") + self.log_queries: Optional[bool] = payload.get("log_queries") + self.development_stage: Optional[str] = payload.get("development_stage") + self.needs_model_build: Optional[bool] = payload.get("needs_model_build") + self.sid: Optional[str] = payload.get("sid") + self.unique_name: Optional[str] = payload.get("unique_name") + self.url: Optional[str] = payload.get("url") + self.callback_url: Optional[str] = payload.get("callback_url") + self.callback_events: Optional[str] = payload.get("callback_events") + + self._solution = { + "sid": sid or self.sid, + } + 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, + sid=self._solution["sid"], + ) + 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, + friendly_name: Union[str, object] = values.unset, + log_queries: Union[bool, object] = values.unset, + unique_name: Union[str, object] = values.unset, + callback_url: Union[str, object] = values.unset, + callback_events: Union[str, object] = values.unset, + style_sheet: Union[object, object] = values.unset, + defaults: Union[object, object] = values.unset, + development_stage: Union[str, object] = values.unset, + ) -> "AssistantInstance": + """ + Update the AssistantInstance + + :param friendly_name: A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. + :param log_queries: Whether queries should be logged and kept after training. Can be: `true` or `false` and defaults to `true`. If `true`, queries are stored for 30 days, and then deleted. If `false`, no queries are stored. + :param unique_name: An application-defined string that uniquely identifies the resource. It can be used as an alternative to the `sid` in the URL path to address the resource. The first 64 characters must be unique. + :param callback_url: Reserved. + :param callback_events: Reserved. + :param style_sheet: The JSON string that defines the Assistant's [style sheet](https://www.twilio.com/docs/autopilot/api/assistant/stylesheet) + :param defaults: A JSON object that defines the Assistant's [default tasks](https://www.twilio.com/docs/autopilot/api/assistant/defaults) for various scenarios, including initiation actions and fallback tasks. + :param development_stage: A string describing the state of the assistant. + + :returns: The updated AssistantInstance + """ + return self._proxy.update( + friendly_name=friendly_name, + log_queries=log_queries, + unique_name=unique_name, + callback_url=callback_url, + callback_events=callback_events, + style_sheet=style_sheet, + defaults=defaults, + development_stage=development_stage, + ) + + async def update_async( + self, + friendly_name: Union[str, object] = values.unset, + log_queries: Union[bool, object] = values.unset, + unique_name: Union[str, object] = values.unset, + callback_url: Union[str, object] = values.unset, + callback_events: Union[str, object] = values.unset, + style_sheet: Union[object, object] = values.unset, + defaults: Union[object, object] = values.unset, + development_stage: Union[str, object] = values.unset, + ) -> "AssistantInstance": + """ + Asynchronous coroutine to update the AssistantInstance + + :param friendly_name: A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. + :param log_queries: Whether queries should be logged and kept after training. Can be: `true` or `false` and defaults to `true`. If `true`, queries are stored for 30 days, and then deleted. If `false`, no queries are stored. + :param unique_name: An application-defined string that uniquely identifies the resource. It can be used as an alternative to the `sid` in the URL path to address the resource. The first 64 characters must be unique. + :param callback_url: Reserved. + :param callback_events: Reserved. + :param style_sheet: The JSON string that defines the Assistant's [style sheet](https://www.twilio.com/docs/autopilot/api/assistant/stylesheet) + :param defaults: A JSON object that defines the Assistant's [default tasks](https://www.twilio.com/docs/autopilot/api/assistant/defaults) for various scenarios, including initiation actions and fallback tasks. + :param development_stage: A string describing the state of the assistant. + + :returns: The updated AssistantInstance + """ + return await self._proxy.update_async( + friendly_name=friendly_name, + log_queries=log_queries, + unique_name=unique_name, + callback_url=callback_url, + callback_events=callback_events, + style_sheet=style_sheet, + defaults=defaults, + development_stage=development_stage, + ) + + @property + def defaults(self) -> DefaultsList: + """ + Access the defaults + """ + return self._proxy.defaults + + @property + def dialogues(self) -> DialogueList: + """ + Access the dialogues + """ + return self._proxy.dialogues + + @property + def field_types(self) -> FieldTypeList: + """ + Access the field_types + """ + return self._proxy.field_types + + @property + def model_builds(self) -> ModelBuildList: + """ + Access the model_builds + """ + return self._proxy.model_builds + + @property + def queries(self) -> QueryList: + """ + Access the queries + """ + return self._proxy.queries + + @property + def style_sheet(self) -> StyleSheetList: + """ + Access the style_sheet + """ + return self._proxy.style_sheet + + @property + def tasks(self) -> TaskList: + """ + Access the tasks + """ + return self._proxy.tasks + + @property + def webhooks(self) -> WebhookList: + """ + Access the webhooks + """ + return self._proxy.webhooks + + 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, sid: str): + """ + Initialize the AssistantContext + + :param version: Version that contains the resource + :param sid: The Twilio-provided string that uniquely identifies the Assistant resource to update. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "sid": sid, + } + self._uri = "/Assistants/{sid}".format(**self._solution) + + self._defaults: Optional[DefaultsList] = None + self._dialogues: Optional[DialogueList] = None + self._field_types: Optional[FieldTypeList] = None + self._model_builds: Optional[ModelBuildList] = None + self._queries: Optional[QueryList] = None + self._style_sheet: Optional[StyleSheetList] = None + self._tasks: Optional[TaskList] = None + self._webhooks: Optional[WebhookList] = 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, + sid=self._solution["sid"], + ) + + 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, + sid=self._solution["sid"], + ) + + def update( + self, + friendly_name: Union[str, object] = values.unset, + log_queries: Union[bool, object] = values.unset, + unique_name: Union[str, object] = values.unset, + callback_url: Union[str, object] = values.unset, + callback_events: Union[str, object] = values.unset, + style_sheet: Union[object, object] = values.unset, + defaults: Union[object, object] = values.unset, + development_stage: Union[str, object] = values.unset, + ) -> AssistantInstance: + """ + Update the AssistantInstance + + :param friendly_name: A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. + :param log_queries: Whether queries should be logged and kept after training. Can be: `true` or `false` and defaults to `true`. If `true`, queries are stored for 30 days, and then deleted. If `false`, no queries are stored. + :param unique_name: An application-defined string that uniquely identifies the resource. It can be used as an alternative to the `sid` in the URL path to address the resource. The first 64 characters must be unique. + :param callback_url: Reserved. + :param callback_events: Reserved. + :param style_sheet: The JSON string that defines the Assistant's [style sheet](https://www.twilio.com/docs/autopilot/api/assistant/stylesheet) + :param defaults: A JSON object that defines the Assistant's [default tasks](https://www.twilio.com/docs/autopilot/api/assistant/defaults) for various scenarios, including initiation actions and fallback tasks. + :param development_stage: A string describing the state of the assistant. + + :returns: The updated AssistantInstance + """ + data = values.of( + { + "FriendlyName": friendly_name, + "LogQueries": log_queries, + "UniqueName": unique_name, + "CallbackUrl": callback_url, + "CallbackEvents": callback_events, + "StyleSheet": serialize.object(style_sheet), + "Defaults": serialize.object(defaults), + "DevelopmentStage": development_stage, + } + ) + + payload = self._version.update( + method="POST", + uri=self._uri, + data=data, + ) + + return AssistantInstance(self._version, payload, sid=self._solution["sid"]) + + async def update_async( + self, + friendly_name: Union[str, object] = values.unset, + log_queries: Union[bool, object] = values.unset, + unique_name: Union[str, object] = values.unset, + callback_url: Union[str, object] = values.unset, + callback_events: Union[str, object] = values.unset, + style_sheet: Union[object, object] = values.unset, + defaults: Union[object, object] = values.unset, + development_stage: Union[str, object] = values.unset, + ) -> AssistantInstance: + """ + Asynchronous coroutine to update the AssistantInstance + + :param friendly_name: A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. + :param log_queries: Whether queries should be logged and kept after training. Can be: `true` or `false` and defaults to `true`. If `true`, queries are stored for 30 days, and then deleted. If `false`, no queries are stored. + :param unique_name: An application-defined string that uniquely identifies the resource. It can be used as an alternative to the `sid` in the URL path to address the resource. The first 64 characters must be unique. + :param callback_url: Reserved. + :param callback_events: Reserved. + :param style_sheet: The JSON string that defines the Assistant's [style sheet](https://www.twilio.com/docs/autopilot/api/assistant/stylesheet) + :param defaults: A JSON object that defines the Assistant's [default tasks](https://www.twilio.com/docs/autopilot/api/assistant/defaults) for various scenarios, including initiation actions and fallback tasks. + :param development_stage: A string describing the state of the assistant. + + :returns: The updated AssistantInstance + """ + data = values.of( + { + "FriendlyName": friendly_name, + "LogQueries": log_queries, + "UniqueName": unique_name, + "CallbackUrl": callback_url, + "CallbackEvents": callback_events, + "StyleSheet": serialize.object(style_sheet), + "Defaults": serialize.object(defaults), + "DevelopmentStage": development_stage, + } + ) + + payload = await self._version.update_async( + method="POST", + uri=self._uri, + data=data, + ) + + return AssistantInstance(self._version, payload, sid=self._solution["sid"]) + + @property + def defaults(self) -> DefaultsList: + """ + Access the defaults + """ + if self._defaults is None: + self._defaults = DefaultsList( + self._version, + self._solution["sid"], + ) + return self._defaults + + @property + def dialogues(self) -> DialogueList: + """ + Access the dialogues + """ + if self._dialogues is None: + self._dialogues = DialogueList( + self._version, + self._solution["sid"], + ) + return self._dialogues + + @property + def field_types(self) -> FieldTypeList: + """ + Access the field_types + """ + if self._field_types is None: + self._field_types = FieldTypeList( + self._version, + self._solution["sid"], + ) + return self._field_types + + @property + def model_builds(self) -> ModelBuildList: + """ + Access the model_builds + """ + if self._model_builds is None: + self._model_builds = ModelBuildList( + self._version, + self._solution["sid"], + ) + return self._model_builds + + @property + def queries(self) -> QueryList: + """ + Access the queries + """ + if self._queries is None: + self._queries = QueryList( + self._version, + self._solution["sid"], + ) + return self._queries + + @property + def style_sheet(self) -> StyleSheetList: + """ + Access the style_sheet + """ + if self._style_sheet is None: + self._style_sheet = StyleSheetList( + self._version, + self._solution["sid"], + ) + return self._style_sheet + + @property + def tasks(self) -> TaskList: + """ + Access the tasks + """ + if self._tasks is None: + self._tasks = TaskList( + self._version, + self._solution["sid"], + ) + return self._tasks + + @property + def webhooks(self) -> WebhookList: + """ + Access the webhooks + """ + if self._webhooks is None: + self._webhooks = WebhookList( + self._version, + self._solution["sid"], + ) + return self._webhooks + + 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): + def __init__(self, version: Version): + """ + Initialize the AssistantList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/Assistants" + + def create( + self, + friendly_name: Union[str, object] = values.unset, + log_queries: Union[bool, object] = values.unset, + unique_name: Union[str, object] = values.unset, + callback_url: Union[str, object] = values.unset, + callback_events: Union[str, object] = values.unset, + style_sheet: Union[object, object] = values.unset, + defaults: Union[object, object] = values.unset, + ) -> AssistantInstance: + """ + Create the AssistantInstance + + :param friendly_name: A descriptive string that you create to describe the new resource. It is not unique and can be up to 255 characters long. + :param log_queries: Whether queries should be logged and kept after training. Can be: `true` or `false` and defaults to `true`. If `true`, queries are stored for 30 days, and then deleted. If `false`, no queries are stored. + :param unique_name: An application-defined string that uniquely identifies the new resource. It can be used as an alternative to the `sid` in the URL path to address the resource. The first 64 characters must be unique. + :param callback_url: Reserved. + :param callback_events: Reserved. + :param style_sheet: The JSON string that defines the Assistant's [style sheet](https://www.twilio.com/docs/autopilot/api/assistant/stylesheet) + :param defaults: A JSON object that defines the Assistant's [default tasks](https://www.twilio.com/docs/autopilot/api/assistant/defaults) for various scenarios, including initiation actions and fallback tasks. + + :returns: The created AssistantInstance + """ + data = values.of( + { + "FriendlyName": friendly_name, + "LogQueries": log_queries, + "UniqueName": unique_name, + "CallbackUrl": callback_url, + "CallbackEvents": callback_events, + "StyleSheet": serialize.object(style_sheet), + "Defaults": serialize.object(defaults), + } + ) + + payload = self._version.create( + method="POST", + uri=self._uri, + data=data, + ) + + return AssistantInstance(self._version, payload) + + async def create_async( + self, + friendly_name: Union[str, object] = values.unset, + log_queries: Union[bool, object] = values.unset, + unique_name: Union[str, object] = values.unset, + callback_url: Union[str, object] = values.unset, + callback_events: Union[str, object] = values.unset, + style_sheet: Union[object, object] = values.unset, + defaults: Union[object, object] = values.unset, + ) -> AssistantInstance: + """ + Asynchronously create the AssistantInstance + + :param friendly_name: A descriptive string that you create to describe the new resource. It is not unique and can be up to 255 characters long. + :param log_queries: Whether queries should be logged and kept after training. Can be: `true` or `false` and defaults to `true`. If `true`, queries are stored for 30 days, and then deleted. If `false`, no queries are stored. + :param unique_name: An application-defined string that uniquely identifies the new resource. It can be used as an alternative to the `sid` in the URL path to address the resource. The first 64 characters must be unique. + :param callback_url: Reserved. + :param callback_events: Reserved. + :param style_sheet: The JSON string that defines the Assistant's [style sheet](https://www.twilio.com/docs/autopilot/api/assistant/stylesheet) + :param defaults: A JSON object that defines the Assistant's [default tasks](https://www.twilio.com/docs/autopilot/api/assistant/defaults) for various scenarios, including initiation actions and fallback tasks. + + :returns: The created AssistantInstance + """ + data = values.of( + { + "FriendlyName": friendly_name, + "LogQueries": log_queries, + "UniqueName": unique_name, + "CallbackUrl": callback_url, + "CallbackEvents": callback_events, + "StyleSheet": serialize.object(style_sheet), + "Defaults": serialize.object(defaults), + } + ) + + payload = await self._version.create_async( + method="POST", + uri=self._uri, + data=data, + ) + + 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, sid: str) -> AssistantContext: + """ + Constructs a AssistantContext + + :param sid: The Twilio-provided string that uniquely identifies the Assistant resource to update. + """ + return AssistantContext(self._version, sid=sid) + + def __call__(self, sid: str) -> AssistantContext: + """ + Constructs a AssistantContext + + :param sid: The Twilio-provided string that uniquely identifies the Assistant resource to update. + """ + return AssistantContext(self._version, sid=sid) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/autopilot/v1/assistant/defaults.py b/twilio/rest/autopilot/v1/assistant/defaults.py new file mode 100644 index 0000000000..0db77b8417 --- /dev/null +++ b/twilio/rest/autopilot/v1/assistant/defaults.py @@ -0,0 +1,273 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Autopilot + 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 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 DefaultsInstance(InstanceResource): + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Defaults resource. + :ivar assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. + :ivar url: The absolute URL of the Defaults resource. + :ivar data: The JSON string that describes the default task links for the `assistant_initiation`, `collect`, and `fallback` situations. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], assistant_sid: str): + super().__init__(version) + + self.account_sid: Optional[str] = payload.get("account_sid") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.url: Optional[str] = payload.get("url") + self.data: Optional[Dict[str, object]] = payload.get("data") + + self._solution = { + "assistant_sid": assistant_sid, + } + self._context: Optional[DefaultsContext] = None + + @property + def _proxy(self) -> "DefaultsContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: DefaultsContext for this DefaultsInstance + """ + if self._context is None: + self._context = DefaultsContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + ) + return self._context + + def fetch(self) -> "DefaultsInstance": + """ + Fetch the DefaultsInstance + + + :returns: The fetched DefaultsInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "DefaultsInstance": + """ + Asynchronous coroutine to fetch the DefaultsInstance + + + :returns: The fetched DefaultsInstance + """ + return await self._proxy.fetch_async() + + def update( + self, defaults: Union[object, object] = values.unset + ) -> "DefaultsInstance": + """ + Update the DefaultsInstance + + :param defaults: A JSON string that describes the default task links for the `assistant_initiation`, `collect`, and `fallback` situations. + + :returns: The updated DefaultsInstance + """ + return self._proxy.update( + defaults=defaults, + ) + + async def update_async( + self, defaults: Union[object, object] = values.unset + ) -> "DefaultsInstance": + """ + Asynchronous coroutine to update the DefaultsInstance + + :param defaults: A JSON string that describes the default task links for the `assistant_initiation`, `collect`, and `fallback` situations. + + :returns: The updated DefaultsInstance + """ + return await self._proxy.update_async( + defaults=defaults, + ) + + 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 DefaultsContext(InstanceContext): + def __init__(self, version: Version, assistant_sid: str): + """ + Initialize the DefaultsContext + + :param version: Version that contains the resource + :param assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource to update. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + } + self._uri = "/Assistants/{assistant_sid}/Defaults".format(**self._solution) + + def fetch(self) -> DefaultsInstance: + """ + Fetch the DefaultsInstance + + + :returns: The fetched DefaultsInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return DefaultsInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + ) + + async def fetch_async(self) -> DefaultsInstance: + """ + Asynchronous coroutine to fetch the DefaultsInstance + + + :returns: The fetched DefaultsInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return DefaultsInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + ) + + def update( + self, defaults: Union[object, object] = values.unset + ) -> DefaultsInstance: + """ + Update the DefaultsInstance + + :param defaults: A JSON string that describes the default task links for the `assistant_initiation`, `collect`, and `fallback` situations. + + :returns: The updated DefaultsInstance + """ + data = values.of( + { + "Defaults": serialize.object(defaults), + } + ) + + payload = self._version.update( + method="POST", + uri=self._uri, + data=data, + ) + + return DefaultsInstance( + self._version, payload, assistant_sid=self._solution["assistant_sid"] + ) + + async def update_async( + self, defaults: Union[object, object] = values.unset + ) -> DefaultsInstance: + """ + Asynchronous coroutine to update the DefaultsInstance + + :param defaults: A JSON string that describes the default task links for the `assistant_initiation`, `collect`, and `fallback` situations. + + :returns: The updated DefaultsInstance + """ + data = values.of( + { + "Defaults": serialize.object(defaults), + } + ) + + payload = await self._version.update_async( + method="POST", + uri=self._uri, + data=data, + ) + + return DefaultsInstance( + self._version, payload, assistant_sid=self._solution["assistant_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 DefaultsList(ListResource): + def __init__(self, version: Version, assistant_sid: str): + """ + Initialize the DefaultsList + + :param version: Version that contains the resource + :param assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource to fetch. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + } + + def get(self) -> DefaultsContext: + """ + Constructs a DefaultsContext + + """ + return DefaultsContext( + self._version, assistant_sid=self._solution["assistant_sid"] + ) + + def __call__(self) -> DefaultsContext: + """ + Constructs a DefaultsContext + + """ + return DefaultsContext( + self._version, assistant_sid=self._solution["assistant_sid"] + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/autopilot/v1/assistant/dialogue.py b/twilio/rest/autopilot/v1/assistant/dialogue.py new file mode 100644 index 0000000000..6e06f4ff2b --- /dev/null +++ b/twilio/rest/autopilot/v1/assistant/dialogue.py @@ -0,0 +1,210 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Autopilot + 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 DialogueInstance(InstanceResource): + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Dialogue resource. + :ivar assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. + :ivar sid: The unique string that we created to identify the Dialogue resource. + :ivar data: The JSON string that describes the dialogue session object. + :ivar url: The absolute URL of the Dialogue resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + assistant_sid: str, + sid: Optional[str] = None, + ): + super().__init__(version) + + self.account_sid: Optional[str] = payload.get("account_sid") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.sid: Optional[str] = payload.get("sid") + self.data: Optional[Dict[str, object]] = payload.get("data") + self.url: Optional[str] = payload.get("url") + + self._solution = { + "assistant_sid": assistant_sid, + "sid": sid or self.sid, + } + self._context: Optional[DialogueContext] = None + + @property + def _proxy(self) -> "DialogueContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: DialogueContext for this DialogueInstance + """ + if self._context is None: + self._context = DialogueContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + sid=self._solution["sid"], + ) + return self._context + + def fetch(self) -> "DialogueInstance": + """ + Fetch the DialogueInstance + + + :returns: The fetched DialogueInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "DialogueInstance": + """ + Asynchronous coroutine to fetch the DialogueInstance + + + :returns: The fetched DialogueInstance + """ + 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 DialogueContext(InstanceContext): + def __init__(self, version: Version, assistant_sid: str, sid: str): + """ + Initialize the DialogueContext + + :param version: Version that contains the resource + :param assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource to fetch. + :param sid: The Twilio-provided string that uniquely identifies the Dialogue resource to fetch. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + "sid": sid, + } + self._uri = "/Assistants/{assistant_sid}/Dialogues/{sid}".format( + **self._solution + ) + + def fetch(self) -> DialogueInstance: + """ + Fetch the DialogueInstance + + + :returns: The fetched DialogueInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return DialogueInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + sid=self._solution["sid"], + ) + + async def fetch_async(self) -> DialogueInstance: + """ + Asynchronous coroutine to fetch the DialogueInstance + + + :returns: The fetched DialogueInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return DialogueInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_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 DialogueList(ListResource): + def __init__(self, version: Version, assistant_sid: str): + """ + Initialize the DialogueList + + :param version: Version that contains the resource + :param assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource to fetch. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + } + + def get(self, sid: str) -> DialogueContext: + """ + Constructs a DialogueContext + + :param sid: The Twilio-provided string that uniquely identifies the Dialogue resource to fetch. + """ + return DialogueContext( + self._version, assistant_sid=self._solution["assistant_sid"], sid=sid + ) + + def __call__(self, sid: str) -> DialogueContext: + """ + Constructs a DialogueContext + + :param sid: The Twilio-provided string that uniquely identifies the Dialogue resource to fetch. + """ + return DialogueContext( + self._version, assistant_sid=self._solution["assistant_sid"], sid=sid + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/autopilot/v1/assistant/field_type/__init__.py b/twilio/rest/autopilot/v1/assistant/field_type/__init__.py new file mode 100644 index 0000000000..4639a6e962 --- /dev/null +++ b/twilio/rest/autopilot/v1/assistant/field_type/__init__.py @@ -0,0 +1,652 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Autopilot + 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.autopilot.v1.assistant.field_type.field_value import FieldValueList + + +class FieldTypeInstance(InstanceResource): + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the FieldType resource. + :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. + :ivar friendly_name: The string that you assigned to describe the resource. It is not unique and can be up to 255 characters long. + :ivar links: A list of the URLs of related resources. + :ivar assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. + :ivar sid: The unique string that we created to identify the FieldType 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. + :ivar url: The absolute URL of the FieldType resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + assistant_sid: str, + 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.friendly_name: Optional[str] = payload.get("friendly_name") + self.links: Optional[Dict[str, object]] = payload.get("links") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.sid: Optional[str] = payload.get("sid") + self.unique_name: Optional[str] = payload.get("unique_name") + self.url: Optional[str] = payload.get("url") + + self._solution = { + "assistant_sid": assistant_sid, + "sid": sid or self.sid, + } + self._context: Optional[FieldTypeContext] = None + + @property + def _proxy(self) -> "FieldTypeContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: FieldTypeContext for this FieldTypeInstance + """ + if self._context is None: + self._context = FieldTypeContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + sid=self._solution["sid"], + ) + return self._context + + def delete(self) -> bool: + """ + Deletes the FieldTypeInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the FieldTypeInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def fetch(self) -> "FieldTypeInstance": + """ + Fetch the FieldTypeInstance + + + :returns: The fetched FieldTypeInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "FieldTypeInstance": + """ + Asynchronous coroutine to fetch the FieldTypeInstance + + + :returns: The fetched FieldTypeInstance + """ + return await self._proxy.fetch_async() + + def update( + self, + friendly_name: Union[str, object] = values.unset, + unique_name: Union[str, object] = values.unset, + ) -> "FieldTypeInstance": + """ + Update the FieldTypeInstance + + :param friendly_name: A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. + :param unique_name: An application-defined string that uniquely identifies the resource. It can be used as an alternative to the `sid` in the URL path to address the resource. The first 64 characters must be unique. + + :returns: The updated FieldTypeInstance + """ + return self._proxy.update( + friendly_name=friendly_name, + unique_name=unique_name, + ) + + async def update_async( + self, + friendly_name: Union[str, object] = values.unset, + unique_name: Union[str, object] = values.unset, + ) -> "FieldTypeInstance": + """ + Asynchronous coroutine to update the FieldTypeInstance + + :param friendly_name: A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. + :param unique_name: An application-defined string that uniquely identifies the resource. It can be used as an alternative to the `sid` in the URL path to address the resource. The first 64 characters must be unique. + + :returns: The updated FieldTypeInstance + """ + return await self._proxy.update_async( + friendly_name=friendly_name, + unique_name=unique_name, + ) + + @property + def field_values(self) -> FieldValueList: + """ + Access the field_values + """ + return self._proxy.field_values + + 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 FieldTypeContext(InstanceContext): + def __init__(self, version: Version, assistant_sid: str, sid: str): + """ + Initialize the FieldTypeContext + + :param version: Version that contains the resource + :param assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the to update. + :param sid: The Twilio-provided string that uniquely identifies the FieldType resource to update. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + "sid": sid, + } + self._uri = "/Assistants/{assistant_sid}/FieldTypes/{sid}".format( + **self._solution + ) + + self._field_values: Optional[FieldValueList] = None + + def delete(self) -> bool: + """ + Deletes the FieldTypeInstance + + + :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 FieldTypeInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._version.delete_async( + method="DELETE", + uri=self._uri, + ) + + def fetch(self) -> FieldTypeInstance: + """ + Fetch the FieldTypeInstance + + + :returns: The fetched FieldTypeInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return FieldTypeInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + sid=self._solution["sid"], + ) + + async def fetch_async(self) -> FieldTypeInstance: + """ + Asynchronous coroutine to fetch the FieldTypeInstance + + + :returns: The fetched FieldTypeInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return FieldTypeInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + sid=self._solution["sid"], + ) + + def update( + self, + friendly_name: Union[str, object] = values.unset, + unique_name: Union[str, object] = values.unset, + ) -> FieldTypeInstance: + """ + Update the FieldTypeInstance + + :param friendly_name: A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. + :param unique_name: An application-defined string that uniquely identifies the resource. It can be used as an alternative to the `sid` in the URL path to address the resource. The first 64 characters must be unique. + + :returns: The updated FieldTypeInstance + """ + data = values.of( + { + "FriendlyName": friendly_name, + "UniqueName": unique_name, + } + ) + + payload = self._version.update( + method="POST", + uri=self._uri, + data=data, + ) + + return FieldTypeInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + sid=self._solution["sid"], + ) + + async def update_async( + self, + friendly_name: Union[str, object] = values.unset, + unique_name: Union[str, object] = values.unset, + ) -> FieldTypeInstance: + """ + Asynchronous coroutine to update the FieldTypeInstance + + :param friendly_name: A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. + :param unique_name: An application-defined string that uniquely identifies the resource. It can be used as an alternative to the `sid` in the URL path to address the resource. The first 64 characters must be unique. + + :returns: The updated FieldTypeInstance + """ + data = values.of( + { + "FriendlyName": friendly_name, + "UniqueName": unique_name, + } + ) + + payload = await self._version.update_async( + method="POST", + uri=self._uri, + data=data, + ) + + return FieldTypeInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + sid=self._solution["sid"], + ) + + @property + def field_values(self) -> FieldValueList: + """ + Access the field_values + """ + if self._field_values is None: + self._field_values = FieldValueList( + self._version, + self._solution["assistant_sid"], + self._solution["sid"], + ) + return self._field_values + + 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 FieldTypePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> FieldTypeInstance: + """ + Build an instance of FieldTypeInstance + + :param payload: Payload response from the API + """ + return FieldTypeInstance( + self._version, payload, assistant_sid=self._solution["assistant_sid"] + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class FieldTypeList(ListResource): + def __init__(self, version: Version, assistant_sid: str): + """ + Initialize the FieldTypeList + + :param version: Version that contains the resource + :param assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resources to read. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + } + self._uri = "/Assistants/{assistant_sid}/FieldTypes".format(**self._solution) + + def create( + self, unique_name: str, friendly_name: Union[str, object] = values.unset + ) -> FieldTypeInstance: + """ + Create the FieldTypeInstance + + :param unique_name: An application-defined string that uniquely identifies the new resource. It can be used as an alternative to the `sid` in the URL path to address the resource. The first 64 characters must be unique. + :param friendly_name: A descriptive string that you create to describe the new resource. It is not unique and can be up to 255 characters long. + + :returns: The created FieldTypeInstance + """ + data = values.of( + { + "UniqueName": unique_name, + "FriendlyName": friendly_name, + } + ) + + payload = self._version.create( + method="POST", + uri=self._uri, + data=data, + ) + + return FieldTypeInstance( + self._version, payload, assistant_sid=self._solution["assistant_sid"] + ) + + async def create_async( + self, unique_name: str, friendly_name: Union[str, object] = values.unset + ) -> FieldTypeInstance: + """ + Asynchronously create the FieldTypeInstance + + :param unique_name: An application-defined string that uniquely identifies the new resource. It can be used as an alternative to the `sid` in the URL path to address the resource. The first 64 characters must be unique. + :param friendly_name: A descriptive string that you create to describe the new resource. It is not unique and can be up to 255 characters long. + + :returns: The created FieldTypeInstance + """ + data = values.of( + { + "UniqueName": unique_name, + "FriendlyName": friendly_name, + } + ) + + payload = await self._version.create_async( + method="POST", + uri=self._uri, + data=data, + ) + + return FieldTypeInstance( + self._version, payload, assistant_sid=self._solution["assistant_sid"] + ) + + def stream( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[FieldTypeInstance]: + """ + Streams FieldTypeInstance 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[FieldTypeInstance]: + """ + Asynchronously streams FieldTypeInstance 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[FieldTypeInstance]: + """ + Lists FieldTypeInstance 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[FieldTypeInstance]: + """ + Asynchronously lists FieldTypeInstance 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, + ) -> FieldTypePage: + """ + Retrieve a single page of FieldTypeInstance 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 FieldTypeInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = self._version.page(method="GET", uri=self._uri, params=data) + return FieldTypePage(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, + ) -> FieldTypePage: + """ + Asynchronously retrieve a single page of FieldTypeInstance 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 FieldTypeInstance + """ + 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 FieldTypePage(self._version, response, self._solution) + + def get_page(self, target_url: str) -> FieldTypePage: + """ + Retrieve a specific page of FieldTypeInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of FieldTypeInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return FieldTypePage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> FieldTypePage: + """ + Asynchronously retrieve a specific page of FieldTypeInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of FieldTypeInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return FieldTypePage(self._version, response, self._solution) + + def get(self, sid: str) -> FieldTypeContext: + """ + Constructs a FieldTypeContext + + :param sid: The Twilio-provided string that uniquely identifies the FieldType resource to update. + """ + return FieldTypeContext( + self._version, assistant_sid=self._solution["assistant_sid"], sid=sid + ) + + def __call__(self, sid: str) -> FieldTypeContext: + """ + Constructs a FieldTypeContext + + :param sid: The Twilio-provided string that uniquely identifies the FieldType resource to update. + """ + return FieldTypeContext( + self._version, assistant_sid=self._solution["assistant_sid"], sid=sid + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/autopilot/v1/assistant/field_type/field_value.py b/twilio/rest/autopilot/v1/assistant/field_type/field_value.py new file mode 100644 index 0000000000..38cb71161f --- /dev/null +++ b/twilio/rest/autopilot/v1/assistant/field_type/field_value.py @@ -0,0 +1,577 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Autopilot + 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 FieldValueInstance(InstanceResource): + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the FieldValue resource. + :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. + :ivar field_type_sid: The SID of the Field Type associated with the Field Value. + :ivar language: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) tag that specifies the language of the value. Currently supported tags: `en-US` + :ivar assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the FieldType associated with the resource. + :ivar sid: The unique string that we created to identify the FieldValue resource. + :ivar value: The Field Value data. + :ivar url: The absolute URL of the FieldValue resource. + :ivar synonym_of: The word for which the field value is a synonym of. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + assistant_sid: str, + field_type_sid: str, + 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.field_type_sid: Optional[str] = payload.get("field_type_sid") + self.language: Optional[str] = payload.get("language") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.sid: Optional[str] = payload.get("sid") + self.value: Optional[str] = payload.get("value") + self.url: Optional[str] = payload.get("url") + self.synonym_of: Optional[str] = payload.get("synonym_of") + + self._solution = { + "assistant_sid": assistant_sid, + "field_type_sid": field_type_sid, + "sid": sid or self.sid, + } + self._context: Optional[FieldValueContext] = None + + @property + def _proxy(self) -> "FieldValueContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: FieldValueContext for this FieldValueInstance + """ + if self._context is None: + self._context = FieldValueContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + field_type_sid=self._solution["field_type_sid"], + sid=self._solution["sid"], + ) + return self._context + + def delete(self) -> bool: + """ + Deletes the FieldValueInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the FieldValueInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def fetch(self) -> "FieldValueInstance": + """ + Fetch the FieldValueInstance + + + :returns: The fetched FieldValueInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "FieldValueInstance": + """ + Asynchronous coroutine to fetch the FieldValueInstance + + + :returns: The fetched FieldValueInstance + """ + 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 FieldValueContext(InstanceContext): + def __init__( + self, version: Version, assistant_sid: str, field_type_sid: str, sid: str + ): + """ + Initialize the FieldValueContext + + :param version: Version that contains the resource + :param assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the FieldType associated with the resource to fetch. + :param field_type_sid: The SID of the Field Type associated with the Field Value to fetch. + :param sid: The Twilio-provided string that uniquely identifies the FieldValue resource to fetch. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + "field_type_sid": field_type_sid, + "sid": sid, + } + self._uri = "/Assistants/{assistant_sid}/FieldTypes/{field_type_sid}/FieldValues/{sid}".format( + **self._solution + ) + + def delete(self) -> bool: + """ + Deletes the FieldValueInstance + + + :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 FieldValueInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._version.delete_async( + method="DELETE", + uri=self._uri, + ) + + def fetch(self) -> FieldValueInstance: + """ + Fetch the FieldValueInstance + + + :returns: The fetched FieldValueInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return FieldValueInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + field_type_sid=self._solution["field_type_sid"], + sid=self._solution["sid"], + ) + + async def fetch_async(self) -> FieldValueInstance: + """ + Asynchronous coroutine to fetch the FieldValueInstance + + + :returns: The fetched FieldValueInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return FieldValueInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + field_type_sid=self._solution["field_type_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 FieldValuePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> FieldValueInstance: + """ + Build an instance of FieldValueInstance + + :param payload: Payload response from the API + """ + return FieldValueInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + field_type_sid=self._solution["field_type_sid"], + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class FieldValueList(ListResource): + def __init__(self, version: Version, assistant_sid: str, field_type_sid: str): + """ + Initialize the FieldValueList + + :param version: Version that contains the resource + :param assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the FieldType associated with the resources to read. + :param field_type_sid: The SID of the Field Type associated with the Field Value to read. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + "field_type_sid": field_type_sid, + } + self._uri = "/Assistants/{assistant_sid}/FieldTypes/{field_type_sid}/FieldValues".format( + **self._solution + ) + + def create( + self, language: str, value: str, synonym_of: Union[str, object] = values.unset + ) -> FieldValueInstance: + """ + Create the FieldValueInstance + + :param language: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) tag that specifies the language of the value. Currently supported tags: `en-US` + :param value: The Field Value data. + :param synonym_of: The string value that indicates which word the field value is a synonym of. + + :returns: The created FieldValueInstance + """ + data = values.of( + { + "Language": language, + "Value": value, + "SynonymOf": synonym_of, + } + ) + + payload = self._version.create( + method="POST", + uri=self._uri, + data=data, + ) + + return FieldValueInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + field_type_sid=self._solution["field_type_sid"], + ) + + async def create_async( + self, language: str, value: str, synonym_of: Union[str, object] = values.unset + ) -> FieldValueInstance: + """ + Asynchronously create the FieldValueInstance + + :param language: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) tag that specifies the language of the value. Currently supported tags: `en-US` + :param value: The Field Value data. + :param synonym_of: The string value that indicates which word the field value is a synonym of. + + :returns: The created FieldValueInstance + """ + data = values.of( + { + "Language": language, + "Value": value, + "SynonymOf": synonym_of, + } + ) + + payload = await self._version.create_async( + method="POST", + uri=self._uri, + data=data, + ) + + return FieldValueInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + field_type_sid=self._solution["field_type_sid"], + ) + + def stream( + self, + language: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[FieldValueInstance]: + """ + Streams FieldValueInstance 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 language: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) tag that specifies the language of the value. Currently supported tags: `en-US` + :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(language=language, page_size=limits["page_size"]) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + language: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[FieldValueInstance]: + """ + Asynchronously streams FieldValueInstance 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 language: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) tag that specifies the language of the value. Currently supported tags: `en-US` + :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(language=language, page_size=limits["page_size"]) + + return self._version.stream_async(page, limits["limit"]) + + def list( + self, + language: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[FieldValueInstance]: + """ + Lists FieldValueInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str language: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) tag that specifies the language of the value. Currently supported tags: `en-US` + :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( + language=language, + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + language: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[FieldValueInstance]: + """ + Asynchronously lists FieldValueInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str language: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) tag that specifies the language of the value. Currently supported tags: `en-US` + :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( + language=language, + limit=limit, + page_size=page_size, + ) + ] + + def page( + self, + language: 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, + ) -> FieldValuePage: + """ + Retrieve a single page of FieldValueInstance records from the API. + Request is executed immediately + + :param language: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) tag that specifies the language of the value. Currently supported tags: `en-US` + :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 FieldValueInstance + """ + data = values.of( + { + "Language": language, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = self._version.page(method="GET", uri=self._uri, params=data) + return FieldValuePage(self._version, response, self._solution) + + async def page_async( + self, + language: 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, + ) -> FieldValuePage: + """ + Asynchronously retrieve a single page of FieldValueInstance records from the API. + Request is executed immediately + + :param language: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) tag that specifies the language of the value. Currently supported tags: `en-US` + :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 FieldValueInstance + """ + data = values.of( + { + "Language": language, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = await self._version.page_async( + method="GET", uri=self._uri, params=data + ) + return FieldValuePage(self._version, response, self._solution) + + def get_page(self, target_url: str) -> FieldValuePage: + """ + Retrieve a specific page of FieldValueInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of FieldValueInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return FieldValuePage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> FieldValuePage: + """ + Asynchronously retrieve a specific page of FieldValueInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of FieldValueInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return FieldValuePage(self._version, response, self._solution) + + def get(self, sid: str) -> FieldValueContext: + """ + Constructs a FieldValueContext + + :param sid: The Twilio-provided string that uniquely identifies the FieldValue resource to fetch. + """ + return FieldValueContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + field_type_sid=self._solution["field_type_sid"], + sid=sid, + ) + + def __call__(self, sid: str) -> FieldValueContext: + """ + Constructs a FieldValueContext + + :param sid: The Twilio-provided string that uniquely identifies the FieldValue resource to fetch. + """ + return FieldValueContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + field_type_sid=self._solution["field_type_sid"], + sid=sid, + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/autopilot/v1/assistant/model_build.py b/twilio/rest/autopilot/v1/assistant/model_build.py new file mode 100644 index 0000000000..ccfb8a1c36 --- /dev/null +++ b/twilio/rest/autopilot/v1/assistant/model_build.py @@ -0,0 +1,627 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Autopilot + 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 ModelBuildInstance(InstanceResource): + class Status(object): + ENQUEUED = "enqueued" + BUILDING = "building" + COMPLETED = "completed" + FAILED = "failed" + CANCELED = "canceled" + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ModelBuild resource. + :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. + :ivar assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. + :ivar sid: The unique string that we created to identify the ModelBuild resource. + :ivar status: + :ivar unique_name: An application-defined string that uniquely identifies the resource. It can be used as an alternative to the `sid` in the URL path to address the resource. + :ivar url: The absolute URL of the ModelBuild resource. + :ivar build_duration: The time in seconds it took to build the model. + :ivar error_code: If the `status` for the model build is `failed`, this value is a code to more information about the failure. This value will be null for all other statuses. See [error code dictionary](https://www.twilio.com/docs/api/errors) for a description of the error. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + assistant_sid: str, + 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.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.sid: Optional[str] = payload.get("sid") + self.status: Optional["ModelBuildInstance.Status"] = payload.get("status") + self.unique_name: Optional[str] = payload.get("unique_name") + self.url: Optional[str] = payload.get("url") + self.build_duration: Optional[int] = deserialize.integer( + payload.get("build_duration") + ) + self.error_code: Optional[int] = deserialize.integer(payload.get("error_code")) + + self._solution = { + "assistant_sid": assistant_sid, + "sid": sid or self.sid, + } + self._context: Optional[ModelBuildContext] = None + + @property + def _proxy(self) -> "ModelBuildContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: ModelBuildContext for this ModelBuildInstance + """ + if self._context is None: + self._context = ModelBuildContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + sid=self._solution["sid"], + ) + return self._context + + def delete(self) -> bool: + """ + Deletes the ModelBuildInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the ModelBuildInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def fetch(self) -> "ModelBuildInstance": + """ + Fetch the ModelBuildInstance + + + :returns: The fetched ModelBuildInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "ModelBuildInstance": + """ + Asynchronous coroutine to fetch the ModelBuildInstance + + + :returns: The fetched ModelBuildInstance + """ + return await self._proxy.fetch_async() + + def update( + self, unique_name: Union[str, object] = values.unset + ) -> "ModelBuildInstance": + """ + Update the ModelBuildInstance + + :param unique_name: An application-defined string that uniquely identifies the resource. This value must be a unique string of no more than 64 characters. It can be used as an alternative to the `sid` in the URL path to address the resource. + + :returns: The updated ModelBuildInstance + """ + return self._proxy.update( + unique_name=unique_name, + ) + + async def update_async( + self, unique_name: Union[str, object] = values.unset + ) -> "ModelBuildInstance": + """ + Asynchronous coroutine to update the ModelBuildInstance + + :param unique_name: An application-defined string that uniquely identifies the resource. This value must be a unique string of no more than 64 characters. It can be used as an alternative to the `sid` in the URL path to address the resource. + + :returns: The updated ModelBuildInstance + """ + return await self._proxy.update_async( + unique_name=unique_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 ModelBuildContext(InstanceContext): + def __init__(self, version: Version, assistant_sid: str, sid: str): + """ + Initialize the ModelBuildContext + + :param version: Version that contains the resource + :param assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource to update. + :param sid: The Twilio-provided string that uniquely identifies the ModelBuild resource to update. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + "sid": sid, + } + self._uri = "/Assistants/{assistant_sid}/ModelBuilds/{sid}".format( + **self._solution + ) + + def delete(self) -> bool: + """ + Deletes the ModelBuildInstance + + + :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 ModelBuildInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._version.delete_async( + method="DELETE", + uri=self._uri, + ) + + def fetch(self) -> ModelBuildInstance: + """ + Fetch the ModelBuildInstance + + + :returns: The fetched ModelBuildInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return ModelBuildInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + sid=self._solution["sid"], + ) + + async def fetch_async(self) -> ModelBuildInstance: + """ + Asynchronous coroutine to fetch the ModelBuildInstance + + + :returns: The fetched ModelBuildInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return ModelBuildInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + sid=self._solution["sid"], + ) + + def update( + self, unique_name: Union[str, object] = values.unset + ) -> ModelBuildInstance: + """ + Update the ModelBuildInstance + + :param unique_name: An application-defined string that uniquely identifies the resource. This value must be a unique string of no more than 64 characters. It can be used as an alternative to the `sid` in the URL path to address the resource. + + :returns: The updated ModelBuildInstance + """ + data = values.of( + { + "UniqueName": unique_name, + } + ) + + payload = self._version.update( + method="POST", + uri=self._uri, + data=data, + ) + + return ModelBuildInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + sid=self._solution["sid"], + ) + + async def update_async( + self, unique_name: Union[str, object] = values.unset + ) -> ModelBuildInstance: + """ + Asynchronous coroutine to update the ModelBuildInstance + + :param unique_name: An application-defined string that uniquely identifies the resource. This value must be a unique string of no more than 64 characters. It can be used as an alternative to the `sid` in the URL path to address the resource. + + :returns: The updated ModelBuildInstance + """ + data = values.of( + { + "UniqueName": unique_name, + } + ) + + payload = await self._version.update_async( + method="POST", + uri=self._uri, + data=data, + ) + + return ModelBuildInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_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 ModelBuildPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ModelBuildInstance: + """ + Build an instance of ModelBuildInstance + + :param payload: Payload response from the API + """ + return ModelBuildInstance( + self._version, payload, assistant_sid=self._solution["assistant_sid"] + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class ModelBuildList(ListResource): + def __init__(self, version: Version, assistant_sid: str): + """ + Initialize the ModelBuildList + + :param version: Version that contains the resource + :param assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resources to read. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + } + self._uri = "/Assistants/{assistant_sid}/ModelBuilds".format(**self._solution) + + def create( + self, + status_callback: Union[str, object] = values.unset, + unique_name: Union[str, object] = values.unset, + ) -> ModelBuildInstance: + """ + Create the ModelBuildInstance + + :param status_callback: The URL we should call using a POST method to send status information to your application. + :param unique_name: An application-defined string that uniquely identifies the new resource. This value must be a unique string of no more than 64 characters. It can be used as an alternative to the `sid` in the URL path to address the resource. + + :returns: The created ModelBuildInstance + """ + data = values.of( + { + "StatusCallback": status_callback, + "UniqueName": unique_name, + } + ) + + payload = self._version.create( + method="POST", + uri=self._uri, + data=data, + ) + + return ModelBuildInstance( + self._version, payload, assistant_sid=self._solution["assistant_sid"] + ) + + async def create_async( + self, + status_callback: Union[str, object] = values.unset, + unique_name: Union[str, object] = values.unset, + ) -> ModelBuildInstance: + """ + Asynchronously create the ModelBuildInstance + + :param status_callback: The URL we should call using a POST method to send status information to your application. + :param unique_name: An application-defined string that uniquely identifies the new resource. This value must be a unique string of no more than 64 characters. It can be used as an alternative to the `sid` in the URL path to address the resource. + + :returns: The created ModelBuildInstance + """ + data = values.of( + { + "StatusCallback": status_callback, + "UniqueName": unique_name, + } + ) + + payload = await self._version.create_async( + method="POST", + uri=self._uri, + data=data, + ) + + return ModelBuildInstance( + self._version, payload, assistant_sid=self._solution["assistant_sid"] + ) + + def stream( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[ModelBuildInstance]: + """ + Streams ModelBuildInstance 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[ModelBuildInstance]: + """ + Asynchronously streams ModelBuildInstance 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[ModelBuildInstance]: + """ + Lists ModelBuildInstance 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[ModelBuildInstance]: + """ + Asynchronously lists ModelBuildInstance 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, + ) -> ModelBuildPage: + """ + Retrieve a single page of ModelBuildInstance 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 ModelBuildInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = self._version.page(method="GET", uri=self._uri, params=data) + return ModelBuildPage(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, + ) -> ModelBuildPage: + """ + Asynchronously retrieve a single page of ModelBuildInstance 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 ModelBuildInstance + """ + 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 ModelBuildPage(self._version, response, self._solution) + + def get_page(self, target_url: str) -> ModelBuildPage: + """ + Retrieve a specific page of ModelBuildInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of ModelBuildInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return ModelBuildPage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> ModelBuildPage: + """ + Asynchronously retrieve a specific page of ModelBuildInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of ModelBuildInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return ModelBuildPage(self._version, response, self._solution) + + def get(self, sid: str) -> ModelBuildContext: + """ + Constructs a ModelBuildContext + + :param sid: The Twilio-provided string that uniquely identifies the ModelBuild resource to update. + """ + return ModelBuildContext( + self._version, assistant_sid=self._solution["assistant_sid"], sid=sid + ) + + def __call__(self, sid: str) -> ModelBuildContext: + """ + Constructs a ModelBuildContext + + :param sid: The Twilio-provided string that uniquely identifies the ModelBuild resource to update. + """ + return ModelBuildContext( + self._version, assistant_sid=self._solution["assistant_sid"], sid=sid + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/autopilot/v1/assistant/query.py b/twilio/rest/autopilot/v1/assistant/query.py new file mode 100644 index 0000000000..500f6bb7f7 --- /dev/null +++ b/twilio/rest/autopilot/v1/assistant/query.py @@ -0,0 +1,729 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Autopilot + 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 QueryInstance(InstanceResource): + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Query resource. + :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. + :ivar results: The natural language analysis results that include the [Task](https://www.twilio.com/docs/autopilot/api/task) recognized and a list of identified [Fields](https://www.twilio.com/docs/autopilot/api/task-field). + :ivar language: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used by the Query. For example: `en-US`. + :ivar model_build_sid: The SID of the [Model Build](https://www.twilio.com/docs/autopilot/api/model-build) queried. + :ivar query: The end-user's natural language input. + :ivar sample_sid: The SID of an optional reference to the [Sample](https://www.twilio.com/docs/autopilot/api/task-sample) created from the query. + :ivar assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. + :ivar sid: The unique string that we created to identify the Query resource. + :ivar status: The status of the Query. Can be: `pending-review`, `reviewed`, or `discarded` + :ivar url: The absolute URL of the Query resource. + :ivar source_channel: The communication channel from where the end-user input came. + :ivar dialogue_sid: The SID of the [Dialogue](https://www.twilio.com/docs/autopilot/api/dialogue). + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + assistant_sid: str, + 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.results: Optional[Dict[str, object]] = payload.get("results") + self.language: Optional[str] = payload.get("language") + self.model_build_sid: Optional[str] = payload.get("model_build_sid") + self.query: Optional[str] = payload.get("query") + self.sample_sid: Optional[str] = payload.get("sample_sid") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.sid: Optional[str] = payload.get("sid") + self.status: Optional[str] = payload.get("status") + self.url: Optional[str] = payload.get("url") + self.source_channel: Optional[str] = payload.get("source_channel") + self.dialogue_sid: Optional[str] = payload.get("dialogue_sid") + + self._solution = { + "assistant_sid": assistant_sid, + "sid": sid or self.sid, + } + self._context: Optional[QueryContext] = None + + @property + def _proxy(self) -> "QueryContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: QueryContext for this QueryInstance + """ + if self._context is None: + self._context = QueryContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + sid=self._solution["sid"], + ) + return self._context + + def delete(self) -> bool: + """ + Deletes the QueryInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the QueryInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def fetch(self) -> "QueryInstance": + """ + Fetch the QueryInstance + + + :returns: The fetched QueryInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "QueryInstance": + """ + Asynchronous coroutine to fetch the QueryInstance + + + :returns: The fetched QueryInstance + """ + return await self._proxy.fetch_async() + + def update( + self, + sample_sid: Union[str, object] = values.unset, + status: Union[str, object] = values.unset, + ) -> "QueryInstance": + """ + Update the QueryInstance + + :param sample_sid: The SID of an optional reference to the [Sample](https://www.twilio.com/docs/autopilot/api/task-sample) created from the query. + :param status: The new status of the resource. Can be: `pending-review`, `reviewed`, or `discarded` + + :returns: The updated QueryInstance + """ + return self._proxy.update( + sample_sid=sample_sid, + status=status, + ) + + async def update_async( + self, + sample_sid: Union[str, object] = values.unset, + status: Union[str, object] = values.unset, + ) -> "QueryInstance": + """ + Asynchronous coroutine to update the QueryInstance + + :param sample_sid: The SID of an optional reference to the [Sample](https://www.twilio.com/docs/autopilot/api/task-sample) created from the query. + :param status: The new status of the resource. Can be: `pending-review`, `reviewed`, or `discarded` + + :returns: The updated QueryInstance + """ + return await self._proxy.update_async( + sample_sid=sample_sid, + 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 QueryContext(InstanceContext): + def __init__(self, version: Version, assistant_sid: str, sid: str): + """ + Initialize the QueryContext + + :param version: Version that contains the resource + :param assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource to update. + :param sid: The Twilio-provided string that uniquely identifies the Query resource to update. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + "sid": sid, + } + self._uri = "/Assistants/{assistant_sid}/Queries/{sid}".format(**self._solution) + + def delete(self) -> bool: + """ + Deletes the QueryInstance + + + :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 QueryInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._version.delete_async( + method="DELETE", + uri=self._uri, + ) + + def fetch(self) -> QueryInstance: + """ + Fetch the QueryInstance + + + :returns: The fetched QueryInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return QueryInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + sid=self._solution["sid"], + ) + + async def fetch_async(self) -> QueryInstance: + """ + Asynchronous coroutine to fetch the QueryInstance + + + :returns: The fetched QueryInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return QueryInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + sid=self._solution["sid"], + ) + + def update( + self, + sample_sid: Union[str, object] = values.unset, + status: Union[str, object] = values.unset, + ) -> QueryInstance: + """ + Update the QueryInstance + + :param sample_sid: The SID of an optional reference to the [Sample](https://www.twilio.com/docs/autopilot/api/task-sample) created from the query. + :param status: The new status of the resource. Can be: `pending-review`, `reviewed`, or `discarded` + + :returns: The updated QueryInstance + """ + data = values.of( + { + "SampleSid": sample_sid, + "Status": status, + } + ) + + payload = self._version.update( + method="POST", + uri=self._uri, + data=data, + ) + + return QueryInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + sid=self._solution["sid"], + ) + + async def update_async( + self, + sample_sid: Union[str, object] = values.unset, + status: Union[str, object] = values.unset, + ) -> QueryInstance: + """ + Asynchronous coroutine to update the QueryInstance + + :param sample_sid: The SID of an optional reference to the [Sample](https://www.twilio.com/docs/autopilot/api/task-sample) created from the query. + :param status: The new status of the resource. Can be: `pending-review`, `reviewed`, or `discarded` + + :returns: The updated QueryInstance + """ + data = values.of( + { + "SampleSid": sample_sid, + "Status": status, + } + ) + + payload = await self._version.update_async( + method="POST", + uri=self._uri, + data=data, + ) + + return QueryInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_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 QueryPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> QueryInstance: + """ + Build an instance of QueryInstance + + :param payload: Payload response from the API + """ + return QueryInstance( + self._version, payload, assistant_sid=self._solution["assistant_sid"] + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class QueryList(ListResource): + def __init__(self, version: Version, assistant_sid: str): + """ + Initialize the QueryList + + :param version: Version that contains the resource + :param assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resources to read. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + } + self._uri = "/Assistants/{assistant_sid}/Queries".format(**self._solution) + + def create( + self, + language: str, + query: str, + tasks: Union[str, object] = values.unset, + model_build: Union[str, object] = values.unset, + ) -> QueryInstance: + """ + Create the QueryInstance + + :param language: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the new query. For example: `en-US`. + :param query: The end-user's natural language input. It can be up to 2048 characters long. + :param tasks: The list of tasks to limit the new query to. Tasks are expressed as a comma-separated list of task `unique_name` values. For example, `task-unique_name-1, task-unique_name-2`. Listing specific tasks is useful to constrain the paths that a user can take. + :param model_build: The SID or unique name of the [Model Build](https://www.twilio.com/docs/autopilot/api/model-build) to be queried. + + :returns: The created QueryInstance + """ + data = values.of( + { + "Language": language, + "Query": query, + "Tasks": tasks, + "ModelBuild": model_build, + } + ) + + payload = self._version.create( + method="POST", + uri=self._uri, + data=data, + ) + + return QueryInstance( + self._version, payload, assistant_sid=self._solution["assistant_sid"] + ) + + async def create_async( + self, + language: str, + query: str, + tasks: Union[str, object] = values.unset, + model_build: Union[str, object] = values.unset, + ) -> QueryInstance: + """ + Asynchronously create the QueryInstance + + :param language: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the new query. For example: `en-US`. + :param query: The end-user's natural language input. It can be up to 2048 characters long. + :param tasks: The list of tasks to limit the new query to. Tasks are expressed as a comma-separated list of task `unique_name` values. For example, `task-unique_name-1, task-unique_name-2`. Listing specific tasks is useful to constrain the paths that a user can take. + :param model_build: The SID or unique name of the [Model Build](https://www.twilio.com/docs/autopilot/api/model-build) to be queried. + + :returns: The created QueryInstance + """ + data = values.of( + { + "Language": language, + "Query": query, + "Tasks": tasks, + "ModelBuild": model_build, + } + ) + + payload = await self._version.create_async( + method="POST", + uri=self._uri, + data=data, + ) + + return QueryInstance( + self._version, payload, assistant_sid=self._solution["assistant_sid"] + ) + + def stream( + self, + language: Union[str, object] = values.unset, + model_build: Union[str, object] = values.unset, + status: Union[str, object] = values.unset, + dialogue_sid: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[QueryInstance]: + """ + Streams QueryInstance 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 language: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used by the Query resources to read. For example: `en-US`. + :param str model_build: The SID or unique name of the [Model Build](https://www.twilio.com/docs/autopilot/api/model-build) to be queried. + :param str status: The status of the resources to read. Can be: `pending-review`, `reviewed`, or `discarded` + :param str dialogue_sid: The SID of the [Dialogue](https://www.twilio.com/docs/autopilot/api/dialogue). + :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( + language=language, + model_build=model_build, + status=status, + dialogue_sid=dialogue_sid, + page_size=limits["page_size"], + ) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + language: Union[str, object] = values.unset, + model_build: Union[str, object] = values.unset, + status: Union[str, object] = values.unset, + dialogue_sid: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[QueryInstance]: + """ + Asynchronously streams QueryInstance 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 language: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used by the Query resources to read. For example: `en-US`. + :param str model_build: The SID or unique name of the [Model Build](https://www.twilio.com/docs/autopilot/api/model-build) to be queried. + :param str status: The status of the resources to read. Can be: `pending-review`, `reviewed`, or `discarded` + :param str dialogue_sid: The SID of the [Dialogue](https://www.twilio.com/docs/autopilot/api/dialogue). + :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( + language=language, + model_build=model_build, + status=status, + dialogue_sid=dialogue_sid, + page_size=limits["page_size"], + ) + + return self._version.stream_async(page, limits["limit"]) + + def list( + self, + language: Union[str, object] = values.unset, + model_build: Union[str, object] = values.unset, + status: Union[str, object] = values.unset, + dialogue_sid: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[QueryInstance]: + """ + Lists QueryInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str language: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used by the Query resources to read. For example: `en-US`. + :param str model_build: The SID or unique name of the [Model Build](https://www.twilio.com/docs/autopilot/api/model-build) to be queried. + :param str status: The status of the resources to read. Can be: `pending-review`, `reviewed`, or `discarded` + :param str dialogue_sid: The SID of the [Dialogue](https://www.twilio.com/docs/autopilot/api/dialogue). + :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( + language=language, + model_build=model_build, + status=status, + dialogue_sid=dialogue_sid, + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + language: Union[str, object] = values.unset, + model_build: Union[str, object] = values.unset, + status: Union[str, object] = values.unset, + dialogue_sid: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[QueryInstance]: + """ + Asynchronously lists QueryInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str language: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used by the Query resources to read. For example: `en-US`. + :param str model_build: The SID or unique name of the [Model Build](https://www.twilio.com/docs/autopilot/api/model-build) to be queried. + :param str status: The status of the resources to read. Can be: `pending-review`, `reviewed`, or `discarded` + :param str dialogue_sid: The SID of the [Dialogue](https://www.twilio.com/docs/autopilot/api/dialogue). + :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( + language=language, + model_build=model_build, + status=status, + dialogue_sid=dialogue_sid, + limit=limit, + page_size=page_size, + ) + ] + + def page( + self, + language: Union[str, object] = values.unset, + model_build: Union[str, object] = values.unset, + status: Union[str, object] = values.unset, + dialogue_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, + ) -> QueryPage: + """ + Retrieve a single page of QueryInstance records from the API. + Request is executed immediately + + :param language: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used by the Query resources to read. For example: `en-US`. + :param model_build: The SID or unique name of the [Model Build](https://www.twilio.com/docs/autopilot/api/model-build) to be queried. + :param status: The status of the resources to read. Can be: `pending-review`, `reviewed`, or `discarded` + :param dialogue_sid: The SID of the [Dialogue](https://www.twilio.com/docs/autopilot/api/dialogue). + :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 QueryInstance + """ + data = values.of( + { + "Language": language, + "ModelBuild": model_build, + "Status": status, + "DialogueSid": dialogue_sid, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = self._version.page(method="GET", uri=self._uri, params=data) + return QueryPage(self._version, response, self._solution) + + async def page_async( + self, + language: Union[str, object] = values.unset, + model_build: Union[str, object] = values.unset, + status: Union[str, object] = values.unset, + dialogue_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, + ) -> QueryPage: + """ + Asynchronously retrieve a single page of QueryInstance records from the API. + Request is executed immediately + + :param language: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used by the Query resources to read. For example: `en-US`. + :param model_build: The SID or unique name of the [Model Build](https://www.twilio.com/docs/autopilot/api/model-build) to be queried. + :param status: The status of the resources to read. Can be: `pending-review`, `reviewed`, or `discarded` + :param dialogue_sid: The SID of the [Dialogue](https://www.twilio.com/docs/autopilot/api/dialogue). + :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 QueryInstance + """ + data = values.of( + { + "Language": language, + "ModelBuild": model_build, + "Status": status, + "DialogueSid": dialogue_sid, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = await self._version.page_async( + method="GET", uri=self._uri, params=data + ) + return QueryPage(self._version, response, self._solution) + + def get_page(self, target_url: str) -> QueryPage: + """ + Retrieve a specific page of QueryInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of QueryInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return QueryPage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> QueryPage: + """ + Asynchronously retrieve a specific page of QueryInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of QueryInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return QueryPage(self._version, response, self._solution) + + def get(self, sid: str) -> QueryContext: + """ + Constructs a QueryContext + + :param sid: The Twilio-provided string that uniquely identifies the Query resource to update. + """ + return QueryContext( + self._version, assistant_sid=self._solution["assistant_sid"], sid=sid + ) + + def __call__(self, sid: str) -> QueryContext: + """ + Constructs a QueryContext + + :param sid: The Twilio-provided string that uniquely identifies the Query resource to update. + """ + return QueryContext( + self._version, assistant_sid=self._solution["assistant_sid"], sid=sid + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/autopilot/v1/assistant/style_sheet.py b/twilio/rest/autopilot/v1/assistant/style_sheet.py new file mode 100644 index 0000000000..980ab40111 --- /dev/null +++ b/twilio/rest/autopilot/v1/assistant/style_sheet.py @@ -0,0 +1,273 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Autopilot + 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 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 StyleSheetInstance(InstanceResource): + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the StyleSheet resource. + :ivar assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. + :ivar url: The absolute URL of the StyleSheet resource. + :ivar data: The JSON string that describes the style sheet object. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], assistant_sid: str): + super().__init__(version) + + self.account_sid: Optional[str] = payload.get("account_sid") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.url: Optional[str] = payload.get("url") + self.data: Optional[Dict[str, object]] = payload.get("data") + + self._solution = { + "assistant_sid": assistant_sid, + } + self._context: Optional[StyleSheetContext] = None + + @property + def _proxy(self) -> "StyleSheetContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: StyleSheetContext for this StyleSheetInstance + """ + if self._context is None: + self._context = StyleSheetContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + ) + return self._context + + def fetch(self) -> "StyleSheetInstance": + """ + Fetch the StyleSheetInstance + + + :returns: The fetched StyleSheetInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "StyleSheetInstance": + """ + Asynchronous coroutine to fetch the StyleSheetInstance + + + :returns: The fetched StyleSheetInstance + """ + return await self._proxy.fetch_async() + + def update( + self, style_sheet: Union[object, object] = values.unset + ) -> "StyleSheetInstance": + """ + Update the StyleSheetInstance + + :param style_sheet: The JSON string that describes the style sheet object. + + :returns: The updated StyleSheetInstance + """ + return self._proxy.update( + style_sheet=style_sheet, + ) + + async def update_async( + self, style_sheet: Union[object, object] = values.unset + ) -> "StyleSheetInstance": + """ + Asynchronous coroutine to update the StyleSheetInstance + + :param style_sheet: The JSON string that describes the style sheet object. + + :returns: The updated StyleSheetInstance + """ + return await self._proxy.update_async( + style_sheet=style_sheet, + ) + + 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 StyleSheetContext(InstanceContext): + def __init__(self, version: Version, assistant_sid: str): + """ + Initialize the StyleSheetContext + + :param version: Version that contains the resource + :param assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource to update. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + } + self._uri = "/Assistants/{assistant_sid}/StyleSheet".format(**self._solution) + + def fetch(self) -> StyleSheetInstance: + """ + Fetch the StyleSheetInstance + + + :returns: The fetched StyleSheetInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return StyleSheetInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + ) + + async def fetch_async(self) -> StyleSheetInstance: + """ + Asynchronous coroutine to fetch the StyleSheetInstance + + + :returns: The fetched StyleSheetInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return StyleSheetInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + ) + + def update( + self, style_sheet: Union[object, object] = values.unset + ) -> StyleSheetInstance: + """ + Update the StyleSheetInstance + + :param style_sheet: The JSON string that describes the style sheet object. + + :returns: The updated StyleSheetInstance + """ + data = values.of( + { + "StyleSheet": serialize.object(style_sheet), + } + ) + + payload = self._version.update( + method="POST", + uri=self._uri, + data=data, + ) + + return StyleSheetInstance( + self._version, payload, assistant_sid=self._solution["assistant_sid"] + ) + + async def update_async( + self, style_sheet: Union[object, object] = values.unset + ) -> StyleSheetInstance: + """ + Asynchronous coroutine to update the StyleSheetInstance + + :param style_sheet: The JSON string that describes the style sheet object. + + :returns: The updated StyleSheetInstance + """ + data = values.of( + { + "StyleSheet": serialize.object(style_sheet), + } + ) + + payload = await self._version.update_async( + method="POST", + uri=self._uri, + data=data, + ) + + return StyleSheetInstance( + self._version, payload, assistant_sid=self._solution["assistant_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 StyleSheetList(ListResource): + def __init__(self, version: Version, assistant_sid: str): + """ + Initialize the StyleSheetList + + :param version: Version that contains the resource + :param assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource to fetch. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + } + + def get(self) -> StyleSheetContext: + """ + Constructs a StyleSheetContext + + """ + return StyleSheetContext( + self._version, assistant_sid=self._solution["assistant_sid"] + ) + + def __call__(self) -> StyleSheetContext: + """ + Constructs a StyleSheetContext + + """ + return StyleSheetContext( + self._version, assistant_sid=self._solution["assistant_sid"] + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/autopilot/v1/assistant/task/__init__.py b/twilio/rest/autopilot/v1/assistant/task/__init__.py new file mode 100644 index 0000000000..c90b412acf --- /dev/null +++ b/twilio/rest/autopilot/v1/assistant/task/__init__.py @@ -0,0 +1,758 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Autopilot + 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.autopilot.v1.assistant.task.field import FieldList +from twilio.rest.autopilot.v1.assistant.task.sample import SampleList +from twilio.rest.autopilot.v1.assistant.task.task_actions import TaskActionsList +from twilio.rest.autopilot.v1.assistant.task.task_statistics import TaskStatisticsList + + +class TaskInstance(InstanceResource): + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Task resource. + :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. + :ivar friendly_name: The string that you assigned to describe the resource. It is not unique and can be up to 255 characters long. + :ivar links: A list of the URLs of related resources. + :ivar assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. + :ivar sid: The unique string that we created to identify the Task 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. + :ivar actions_url: The URL from which the Assistant can fetch actions. + :ivar url: The absolute URL of the Task resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + assistant_sid: str, + 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.friendly_name: Optional[str] = payload.get("friendly_name") + self.links: Optional[Dict[str, object]] = payload.get("links") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.sid: Optional[str] = payload.get("sid") + self.unique_name: Optional[str] = payload.get("unique_name") + self.actions_url: Optional[str] = payload.get("actions_url") + self.url: Optional[str] = payload.get("url") + + self._solution = { + "assistant_sid": assistant_sid, + "sid": sid or self.sid, + } + self._context: Optional[TaskContext] = None + + @property + def _proxy(self) -> "TaskContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: TaskContext for this TaskInstance + """ + if self._context is None: + self._context = TaskContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + sid=self._solution["sid"], + ) + return self._context + + def delete(self) -> bool: + """ + Deletes the TaskInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the TaskInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def fetch(self) -> "TaskInstance": + """ + Fetch the TaskInstance + + + :returns: The fetched TaskInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "TaskInstance": + """ + Asynchronous coroutine to fetch the TaskInstance + + + :returns: The fetched TaskInstance + """ + return await self._proxy.fetch_async() + + def update( + self, + friendly_name: Union[str, object] = values.unset, + unique_name: Union[str, object] = values.unset, + actions: Union[object, object] = values.unset, + actions_url: Union[str, object] = values.unset, + ) -> "TaskInstance": + """ + Update the TaskInstance + + :param friendly_name: A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. + :param unique_name: An application-defined string that uniquely identifies the resource. This value must be 64 characters or less in length and be unique. It can be used as an alternative to the `sid` in the URL path to address the resource. + :param actions: The JSON string that specifies the [actions](https://www.twilio.com/docs/autopilot/actions) that instruct the Assistant on how to perform the task. + :param actions_url: The URL from which the Assistant can fetch actions. + + :returns: The updated TaskInstance + """ + return self._proxy.update( + friendly_name=friendly_name, + unique_name=unique_name, + actions=actions, + actions_url=actions_url, + ) + + async def update_async( + self, + friendly_name: Union[str, object] = values.unset, + unique_name: Union[str, object] = values.unset, + actions: Union[object, object] = values.unset, + actions_url: Union[str, object] = values.unset, + ) -> "TaskInstance": + """ + Asynchronous coroutine to update the TaskInstance + + :param friendly_name: A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. + :param unique_name: An application-defined string that uniquely identifies the resource. This value must be 64 characters or less in length and be unique. It can be used as an alternative to the `sid` in the URL path to address the resource. + :param actions: The JSON string that specifies the [actions](https://www.twilio.com/docs/autopilot/actions) that instruct the Assistant on how to perform the task. + :param actions_url: The URL from which the Assistant can fetch actions. + + :returns: The updated TaskInstance + """ + return await self._proxy.update_async( + friendly_name=friendly_name, + unique_name=unique_name, + actions=actions, + actions_url=actions_url, + ) + + @property + def fields(self) -> FieldList: + """ + Access the fields + """ + return self._proxy.fields + + @property + def samples(self) -> SampleList: + """ + Access the samples + """ + return self._proxy.samples + + @property + def task_actions(self) -> TaskActionsList: + """ + Access the task_actions + """ + return self._proxy.task_actions + + @property + def statistics(self) -> TaskStatisticsList: + """ + Access the statistics + """ + return self._proxy.statistics + + 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 TaskContext(InstanceContext): + def __init__(self, version: Version, assistant_sid: str, sid: str): + """ + Initialize the TaskContext + + :param version: Version that contains the resource + :param assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource to update. + :param sid: The Twilio-provided string that uniquely identifies the Task resource to update. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + "sid": sid, + } + self._uri = "/Assistants/{assistant_sid}/Tasks/{sid}".format(**self._solution) + + self._fields: Optional[FieldList] = None + self._samples: Optional[SampleList] = None + self._task_actions: Optional[TaskActionsList] = None + self._statistics: Optional[TaskStatisticsList] = None + + def delete(self) -> bool: + """ + Deletes the TaskInstance + + + :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 TaskInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._version.delete_async( + method="DELETE", + uri=self._uri, + ) + + def fetch(self) -> TaskInstance: + """ + Fetch the TaskInstance + + + :returns: The fetched TaskInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return TaskInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + sid=self._solution["sid"], + ) + + async def fetch_async(self) -> TaskInstance: + """ + Asynchronous coroutine to fetch the TaskInstance + + + :returns: The fetched TaskInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return TaskInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + sid=self._solution["sid"], + ) + + def update( + self, + friendly_name: Union[str, object] = values.unset, + unique_name: Union[str, object] = values.unset, + actions: Union[object, object] = values.unset, + actions_url: Union[str, object] = values.unset, + ) -> TaskInstance: + """ + Update the TaskInstance + + :param friendly_name: A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. + :param unique_name: An application-defined string that uniquely identifies the resource. This value must be 64 characters or less in length and be unique. It can be used as an alternative to the `sid` in the URL path to address the resource. + :param actions: The JSON string that specifies the [actions](https://www.twilio.com/docs/autopilot/actions) that instruct the Assistant on how to perform the task. + :param actions_url: The URL from which the Assistant can fetch actions. + + :returns: The updated TaskInstance + """ + data = values.of( + { + "FriendlyName": friendly_name, + "UniqueName": unique_name, + "Actions": serialize.object(actions), + "ActionsUrl": actions_url, + } + ) + + payload = self._version.update( + method="POST", + uri=self._uri, + data=data, + ) + + return TaskInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + sid=self._solution["sid"], + ) + + async def update_async( + self, + friendly_name: Union[str, object] = values.unset, + unique_name: Union[str, object] = values.unset, + actions: Union[object, object] = values.unset, + actions_url: Union[str, object] = values.unset, + ) -> TaskInstance: + """ + Asynchronous coroutine to update the TaskInstance + + :param friendly_name: A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. + :param unique_name: An application-defined string that uniquely identifies the resource. This value must be 64 characters or less in length and be unique. It can be used as an alternative to the `sid` in the URL path to address the resource. + :param actions: The JSON string that specifies the [actions](https://www.twilio.com/docs/autopilot/actions) that instruct the Assistant on how to perform the task. + :param actions_url: The URL from which the Assistant can fetch actions. + + :returns: The updated TaskInstance + """ + data = values.of( + { + "FriendlyName": friendly_name, + "UniqueName": unique_name, + "Actions": serialize.object(actions), + "ActionsUrl": actions_url, + } + ) + + payload = await self._version.update_async( + method="POST", + uri=self._uri, + data=data, + ) + + return TaskInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + sid=self._solution["sid"], + ) + + @property + def fields(self) -> FieldList: + """ + Access the fields + """ + if self._fields is None: + self._fields = FieldList( + self._version, + self._solution["assistant_sid"], + self._solution["sid"], + ) + return self._fields + + @property + def samples(self) -> SampleList: + """ + Access the samples + """ + if self._samples is None: + self._samples = SampleList( + self._version, + self._solution["assistant_sid"], + self._solution["sid"], + ) + return self._samples + + @property + def task_actions(self) -> TaskActionsList: + """ + Access the task_actions + """ + if self._task_actions is None: + self._task_actions = TaskActionsList( + self._version, + self._solution["assistant_sid"], + self._solution["sid"], + ) + return self._task_actions + + @property + def statistics(self) -> TaskStatisticsList: + """ + Access the statistics + """ + if self._statistics is None: + self._statistics = TaskStatisticsList( + self._version, + self._solution["assistant_sid"], + self._solution["sid"], + ) + return self._statistics + + 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 TaskPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> TaskInstance: + """ + Build an instance of TaskInstance + + :param payload: Payload response from the API + """ + return TaskInstance( + self._version, payload, assistant_sid=self._solution["assistant_sid"] + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class TaskList(ListResource): + def __init__(self, version: Version, assistant_sid: str): + """ + Initialize the TaskList + + :param version: Version that contains the resource + :param assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resources to read. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + } + self._uri = "/Assistants/{assistant_sid}/Tasks".format(**self._solution) + + def create( + self, + unique_name: str, + friendly_name: Union[str, object] = values.unset, + actions: Union[object, object] = values.unset, + actions_url: Union[str, object] = values.unset, + ) -> TaskInstance: + """ + Create the TaskInstance + + :param unique_name: An application-defined string that uniquely identifies the new resource. It can be used as an alternative to the `sid` in the URL path to address the resource. This value must be unique and 64 characters or less in length. + :param friendly_name: A descriptive string that you create to describe the new resource. It is not unique and can be up to 255 characters long. + :param actions: The JSON string that specifies the [actions](https://www.twilio.com/docs/autopilot/actions) that instruct the Assistant on how to perform the task. It is optional and not unique. + :param actions_url: The URL from which the Assistant can fetch actions. + + :returns: The created TaskInstance + """ + data = values.of( + { + "UniqueName": unique_name, + "FriendlyName": friendly_name, + "Actions": serialize.object(actions), + "ActionsUrl": actions_url, + } + ) + + payload = self._version.create( + method="POST", + uri=self._uri, + data=data, + ) + + return TaskInstance( + self._version, payload, assistant_sid=self._solution["assistant_sid"] + ) + + async def create_async( + self, + unique_name: str, + friendly_name: Union[str, object] = values.unset, + actions: Union[object, object] = values.unset, + actions_url: Union[str, object] = values.unset, + ) -> TaskInstance: + """ + Asynchronously create the TaskInstance + + :param unique_name: An application-defined string that uniquely identifies the new resource. It can be used as an alternative to the `sid` in the URL path to address the resource. This value must be unique and 64 characters or less in length. + :param friendly_name: A descriptive string that you create to describe the new resource. It is not unique and can be up to 255 characters long. + :param actions: The JSON string that specifies the [actions](https://www.twilio.com/docs/autopilot/actions) that instruct the Assistant on how to perform the task. It is optional and not unique. + :param actions_url: The URL from which the Assistant can fetch actions. + + :returns: The created TaskInstance + """ + data = values.of( + { + "UniqueName": unique_name, + "FriendlyName": friendly_name, + "Actions": serialize.object(actions), + "ActionsUrl": actions_url, + } + ) + + payload = await self._version.create_async( + method="POST", + uri=self._uri, + data=data, + ) + + return TaskInstance( + self._version, payload, assistant_sid=self._solution["assistant_sid"] + ) + + def stream( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[TaskInstance]: + """ + Streams TaskInstance 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[TaskInstance]: + """ + Asynchronously streams TaskInstance 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[TaskInstance]: + """ + Lists TaskInstance 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[TaskInstance]: + """ + Asynchronously lists TaskInstance 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, + ) -> TaskPage: + """ + Retrieve a single page of TaskInstance 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 TaskInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = self._version.page(method="GET", uri=self._uri, params=data) + return TaskPage(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, + ) -> TaskPage: + """ + Asynchronously retrieve a single page of TaskInstance 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 TaskInstance + """ + 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 TaskPage(self._version, response, self._solution) + + def get_page(self, target_url: str) -> TaskPage: + """ + Retrieve a specific page of TaskInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of TaskInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return TaskPage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> TaskPage: + """ + Asynchronously retrieve a specific page of TaskInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of TaskInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return TaskPage(self._version, response, self._solution) + + def get(self, sid: str) -> TaskContext: + """ + Constructs a TaskContext + + :param sid: The Twilio-provided string that uniquely identifies the Task resource to update. + """ + return TaskContext( + self._version, assistant_sid=self._solution["assistant_sid"], sid=sid + ) + + def __call__(self, sid: str) -> TaskContext: + """ + Constructs a TaskContext + + :param sid: The Twilio-provided string that uniquely identifies the Task resource to update. + """ + return TaskContext( + self._version, assistant_sid=self._solution["assistant_sid"], sid=sid + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/autopilot/v1/assistant/task/field.py b/twilio/rest/autopilot/v1/assistant/task/field.py new file mode 100644 index 0000000000..dc48c44659 --- /dev/null +++ b/twilio/rest/autopilot/v1/assistant/task/field.py @@ -0,0 +1,549 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Autopilot + 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 FieldInstance(InstanceResource): + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Field resource. + :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. + :ivar field_type: The Field Type of the field. Can be: a [Built-in Field Type](https://www.twilio.com/docs/autopilot/built-in-field-types), the unique_name, or the SID of a custom Field Type. + :ivar task_sid: The SID of the [Task](https://www.twilio.com/docs/autopilot/api/task) resource associated with this Field. + :ivar assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the Task associated with the resource. + :ivar sid: The unique string that we created to identify the Field 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. + :ivar url: The absolute URL of the Field resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + assistant_sid: str, + task_sid: str, + 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.field_type: Optional[str] = payload.get("field_type") + self.task_sid: Optional[str] = payload.get("task_sid") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.sid: Optional[str] = payload.get("sid") + self.unique_name: Optional[str] = payload.get("unique_name") + self.url: Optional[str] = payload.get("url") + + self._solution = { + "assistant_sid": assistant_sid, + "task_sid": task_sid, + "sid": sid or self.sid, + } + self._context: Optional[FieldContext] = None + + @property + def _proxy(self) -> "FieldContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: FieldContext for this FieldInstance + """ + if self._context is None: + self._context = FieldContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + sid=self._solution["sid"], + ) + return self._context + + def delete(self) -> bool: + """ + Deletes the FieldInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the FieldInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def fetch(self) -> "FieldInstance": + """ + Fetch the FieldInstance + + + :returns: The fetched FieldInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "FieldInstance": + """ + Asynchronous coroutine to fetch the FieldInstance + + + :returns: The fetched FieldInstance + """ + 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 FieldContext(InstanceContext): + def __init__(self, version: Version, assistant_sid: str, task_sid: str, sid: str): + """ + Initialize the FieldContext + + :param version: Version that contains the resource + :param assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the Task associated with the resource to fetch. + :param task_sid: The SID of the [Task](https://www.twilio.com/docs/autopilot/api/task) resource associated with the Field resource to fetch. + :param sid: The Twilio-provided string that uniquely identifies the Field resource to fetch. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + "task_sid": task_sid, + "sid": sid, + } + self._uri = "/Assistants/{assistant_sid}/Tasks/{task_sid}/Fields/{sid}".format( + **self._solution + ) + + def delete(self) -> bool: + """ + Deletes the FieldInstance + + + :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 FieldInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._version.delete_async( + method="DELETE", + uri=self._uri, + ) + + def fetch(self) -> FieldInstance: + """ + Fetch the FieldInstance + + + :returns: The fetched FieldInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return FieldInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + sid=self._solution["sid"], + ) + + async def fetch_async(self) -> FieldInstance: + """ + Asynchronous coroutine to fetch the FieldInstance + + + :returns: The fetched FieldInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return FieldInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_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 FieldPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> FieldInstance: + """ + Build an instance of FieldInstance + + :param payload: Payload response from the API + """ + return FieldInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class FieldList(ListResource): + def __init__(self, version: Version, assistant_sid: str, task_sid: str): + """ + Initialize the FieldList + + :param version: Version that contains the resource + :param assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the Task associated with the resources to read. + :param task_sid: The SID of the [Task](https://www.twilio.com/docs/autopilot/api/task) resource associated with the Field resources to read. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + "task_sid": task_sid, + } + self._uri = "/Assistants/{assistant_sid}/Tasks/{task_sid}/Fields".format( + **self._solution + ) + + def create(self, field_type: str, unique_name: str) -> FieldInstance: + """ + Create the FieldInstance + + :param field_type: The Field Type of the new field. Can be: a [Built-in Field Type](https://www.twilio.com/docs/autopilot/built-in-field-types), the `unique_name`, or the `sid` of a custom Field Type. + :param unique_name: An application-defined string that uniquely identifies the new resource. This value must be a unique string of no more than 64 characters. It can be used as an alternative to the `sid` in the URL path to address the resource. + + :returns: The created FieldInstance + """ + data = values.of( + { + "FieldType": field_type, + "UniqueName": unique_name, + } + ) + + payload = self._version.create( + method="POST", + uri=self._uri, + data=data, + ) + + return FieldInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + ) + + async def create_async(self, field_type: str, unique_name: str) -> FieldInstance: + """ + Asynchronously create the FieldInstance + + :param field_type: The Field Type of the new field. Can be: a [Built-in Field Type](https://www.twilio.com/docs/autopilot/built-in-field-types), the `unique_name`, or the `sid` of a custom Field Type. + :param unique_name: An application-defined string that uniquely identifies the new resource. This value must be a unique string of no more than 64 characters. It can be used as an alternative to the `sid` in the URL path to address the resource. + + :returns: The created FieldInstance + """ + data = values.of( + { + "FieldType": field_type, + "UniqueName": unique_name, + } + ) + + payload = await self._version.create_async( + method="POST", + uri=self._uri, + data=data, + ) + + return FieldInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + ) + + def stream( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[FieldInstance]: + """ + Streams FieldInstance 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[FieldInstance]: + """ + Asynchronously streams FieldInstance 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[FieldInstance]: + """ + Lists FieldInstance 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[FieldInstance]: + """ + Asynchronously lists FieldInstance 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, + ) -> FieldPage: + """ + Retrieve a single page of FieldInstance 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 FieldInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = self._version.page(method="GET", uri=self._uri, params=data) + return FieldPage(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, + ) -> FieldPage: + """ + Asynchronously retrieve a single page of FieldInstance 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 FieldInstance + """ + 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 FieldPage(self._version, response, self._solution) + + def get_page(self, target_url: str) -> FieldPage: + """ + Retrieve a specific page of FieldInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of FieldInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return FieldPage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> FieldPage: + """ + Asynchronously retrieve a specific page of FieldInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of FieldInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return FieldPage(self._version, response, self._solution) + + def get(self, sid: str) -> FieldContext: + """ + Constructs a FieldContext + + :param sid: The Twilio-provided string that uniquely identifies the Field resource to fetch. + """ + return FieldContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + sid=sid, + ) + + def __call__(self, sid: str) -> FieldContext: + """ + Constructs a FieldContext + + :param sid: The Twilio-provided string that uniquely identifies the Field resource to fetch. + """ + return FieldContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + sid=sid, + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/autopilot/v1/assistant/task/sample.py b/twilio/rest/autopilot/v1/assistant/task/sample.py new file mode 100644 index 0000000000..ce413aeaa1 --- /dev/null +++ b/twilio/rest/autopilot/v1/assistant/task/sample.py @@ -0,0 +1,697 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Autopilot + 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 SampleInstance(InstanceResource): + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Sample resource. + :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. + :ivar task_sid: The SID of the [Task](https://www.twilio.com/docs/autopilot/api/task) associated with the resource. + :ivar language: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the sample. For example: `en-US`. + :ivar assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the Task associated with the resource. + :ivar sid: The unique string that we created to identify the Sample resource. + :ivar tagged_text: The text example of how end users might express the task. The sample can contain [Field tag blocks](https://www.twilio.com/docs/autopilot/api/task-sample#field-tagging). + :ivar url: The absolute URL of the Sample resource. + :ivar source_channel: The communication channel from which the sample was captured. Can be: `voice`, `sms`, `chat`, `alexa`, `google-assistant`, `slack`, or null if not included. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + assistant_sid: str, + task_sid: str, + 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.task_sid: Optional[str] = payload.get("task_sid") + self.language: Optional[str] = payload.get("language") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.sid: Optional[str] = payload.get("sid") + self.tagged_text: Optional[str] = payload.get("tagged_text") + self.url: Optional[str] = payload.get("url") + self.source_channel: Optional[str] = payload.get("source_channel") + + self._solution = { + "assistant_sid": assistant_sid, + "task_sid": task_sid, + "sid": sid or self.sid, + } + self._context: Optional[SampleContext] = None + + @property + def _proxy(self) -> "SampleContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: SampleContext for this SampleInstance + """ + if self._context is None: + self._context = SampleContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + sid=self._solution["sid"], + ) + return self._context + + def delete(self) -> bool: + """ + Deletes the SampleInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the SampleInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def fetch(self) -> "SampleInstance": + """ + Fetch the SampleInstance + + + :returns: The fetched SampleInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "SampleInstance": + """ + Asynchronous coroutine to fetch the SampleInstance + + + :returns: The fetched SampleInstance + """ + return await self._proxy.fetch_async() + + def update( + self, + language: Union[str, object] = values.unset, + tagged_text: Union[str, object] = values.unset, + source_channel: Union[str, object] = values.unset, + ) -> "SampleInstance": + """ + Update the SampleInstance + + :param language: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the sample. For example: `en-US`. + :param tagged_text: The text example of how end users might express the task. The sample can contain [Field tag blocks](https://www.twilio.com/docs/autopilot/api/task-sample#field-tagging). + :param source_channel: The communication channel from which the sample was captured. Can be: `voice`, `sms`, `chat`, `alexa`, `google-assistant`, `slack`, or null if not included. + + :returns: The updated SampleInstance + """ + return self._proxy.update( + language=language, + tagged_text=tagged_text, + source_channel=source_channel, + ) + + async def update_async( + self, + language: Union[str, object] = values.unset, + tagged_text: Union[str, object] = values.unset, + source_channel: Union[str, object] = values.unset, + ) -> "SampleInstance": + """ + Asynchronous coroutine to update the SampleInstance + + :param language: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the sample. For example: `en-US`. + :param tagged_text: The text example of how end users might express the task. The sample can contain [Field tag blocks](https://www.twilio.com/docs/autopilot/api/task-sample#field-tagging). + :param source_channel: The communication channel from which the sample was captured. Can be: `voice`, `sms`, `chat`, `alexa`, `google-assistant`, `slack`, or null if not included. + + :returns: The updated SampleInstance + """ + return await self._proxy.update_async( + language=language, + tagged_text=tagged_text, + source_channel=source_channel, + ) + + 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 SampleContext(InstanceContext): + def __init__(self, version: Version, assistant_sid: str, task_sid: str, sid: str): + """ + Initialize the SampleContext + + :param version: Version that contains the resource + :param assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the Task associated with the resource to update. + :param task_sid: The SID of the [Task](https://www.twilio.com/docs/autopilot/api/task) associated with the Sample resource to update. + :param sid: The Twilio-provided string that uniquely identifies the Sample resource to update. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + "task_sid": task_sid, + "sid": sid, + } + self._uri = "/Assistants/{assistant_sid}/Tasks/{task_sid}/Samples/{sid}".format( + **self._solution + ) + + def delete(self) -> bool: + """ + Deletes the SampleInstance + + + :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 SampleInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._version.delete_async( + method="DELETE", + uri=self._uri, + ) + + def fetch(self) -> SampleInstance: + """ + Fetch the SampleInstance + + + :returns: The fetched SampleInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return SampleInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + sid=self._solution["sid"], + ) + + async def fetch_async(self) -> SampleInstance: + """ + Asynchronous coroutine to fetch the SampleInstance + + + :returns: The fetched SampleInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return SampleInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + sid=self._solution["sid"], + ) + + def update( + self, + language: Union[str, object] = values.unset, + tagged_text: Union[str, object] = values.unset, + source_channel: Union[str, object] = values.unset, + ) -> SampleInstance: + """ + Update the SampleInstance + + :param language: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the sample. For example: `en-US`. + :param tagged_text: The text example of how end users might express the task. The sample can contain [Field tag blocks](https://www.twilio.com/docs/autopilot/api/task-sample#field-tagging). + :param source_channel: The communication channel from which the sample was captured. Can be: `voice`, `sms`, `chat`, `alexa`, `google-assistant`, `slack`, or null if not included. + + :returns: The updated SampleInstance + """ + data = values.of( + { + "Language": language, + "TaggedText": tagged_text, + "SourceChannel": source_channel, + } + ) + + payload = self._version.update( + method="POST", + uri=self._uri, + data=data, + ) + + return SampleInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + sid=self._solution["sid"], + ) + + async def update_async( + self, + language: Union[str, object] = values.unset, + tagged_text: Union[str, object] = values.unset, + source_channel: Union[str, object] = values.unset, + ) -> SampleInstance: + """ + Asynchronous coroutine to update the SampleInstance + + :param language: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the sample. For example: `en-US`. + :param tagged_text: The text example of how end users might express the task. The sample can contain [Field tag blocks](https://www.twilio.com/docs/autopilot/api/task-sample#field-tagging). + :param source_channel: The communication channel from which the sample was captured. Can be: `voice`, `sms`, `chat`, `alexa`, `google-assistant`, `slack`, or null if not included. + + :returns: The updated SampleInstance + """ + data = values.of( + { + "Language": language, + "TaggedText": tagged_text, + "SourceChannel": source_channel, + } + ) + + payload = await self._version.update_async( + method="POST", + uri=self._uri, + data=data, + ) + + return SampleInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_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 SamplePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> SampleInstance: + """ + Build an instance of SampleInstance + + :param payload: Payload response from the API + """ + return SampleInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class SampleList(ListResource): + def __init__(self, version: Version, assistant_sid: str, task_sid: str): + """ + Initialize the SampleList + + :param version: Version that contains the resource + :param assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the Task associated with the resources to read. + :param task_sid: The SID of the [Task](https://www.twilio.com/docs/autopilot/api/task) associated with the Sample resources to read. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + "task_sid": task_sid, + } + self._uri = "/Assistants/{assistant_sid}/Tasks/{task_sid}/Samples".format( + **self._solution + ) + + def create( + self, + language: str, + tagged_text: str, + source_channel: Union[str, object] = values.unset, + ) -> SampleInstance: + """ + Create the SampleInstance + + :param language: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the new sample. For example: `en-US`. + :param tagged_text: The text example of how end users might express the task. The sample can contain [Field tag blocks](https://www.twilio.com/docs/autopilot/api/task-sample#field-tagging). + :param source_channel: The communication channel from which the new sample was captured. Can be: `voice`, `sms`, `chat`, `alexa`, `google-assistant`, `slack`, or null if not included. + + :returns: The created SampleInstance + """ + data = values.of( + { + "Language": language, + "TaggedText": tagged_text, + "SourceChannel": source_channel, + } + ) + + payload = self._version.create( + method="POST", + uri=self._uri, + data=data, + ) + + return SampleInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + ) + + async def create_async( + self, + language: str, + tagged_text: str, + source_channel: Union[str, object] = values.unset, + ) -> SampleInstance: + """ + Asynchronously create the SampleInstance + + :param language: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the new sample. For example: `en-US`. + :param tagged_text: The text example of how end users might express the task. The sample can contain [Field tag blocks](https://www.twilio.com/docs/autopilot/api/task-sample#field-tagging). + :param source_channel: The communication channel from which the new sample was captured. Can be: `voice`, `sms`, `chat`, `alexa`, `google-assistant`, `slack`, or null if not included. + + :returns: The created SampleInstance + """ + data = values.of( + { + "Language": language, + "TaggedText": tagged_text, + "SourceChannel": source_channel, + } + ) + + payload = await self._version.create_async( + method="POST", + uri=self._uri, + data=data, + ) + + return SampleInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + ) + + def stream( + self, + language: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[SampleInstance]: + """ + Streams SampleInstance 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 language: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the sample. For example: `en-US`. + :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(language=language, page_size=limits["page_size"]) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + language: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[SampleInstance]: + """ + Asynchronously streams SampleInstance 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 language: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the sample. For example: `en-US`. + :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(language=language, page_size=limits["page_size"]) + + return self._version.stream_async(page, limits["limit"]) + + def list( + self, + language: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[SampleInstance]: + """ + Lists SampleInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str language: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the sample. For example: `en-US`. + :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( + language=language, + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + language: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[SampleInstance]: + """ + Asynchronously lists SampleInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str language: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the sample. For example: `en-US`. + :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( + language=language, + limit=limit, + page_size=page_size, + ) + ] + + def page( + self, + language: 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, + ) -> SamplePage: + """ + Retrieve a single page of SampleInstance records from the API. + Request is executed immediately + + :param language: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the sample. For example: `en-US`. + :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 SampleInstance + """ + data = values.of( + { + "Language": language, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = self._version.page(method="GET", uri=self._uri, params=data) + return SamplePage(self._version, response, self._solution) + + async def page_async( + self, + language: 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, + ) -> SamplePage: + """ + Asynchronously retrieve a single page of SampleInstance records from the API. + Request is executed immediately + + :param language: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the sample. For example: `en-US`. + :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 SampleInstance + """ + data = values.of( + { + "Language": language, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = await self._version.page_async( + method="GET", uri=self._uri, params=data + ) + return SamplePage(self._version, response, self._solution) + + def get_page(self, target_url: str) -> SamplePage: + """ + Retrieve a specific page of SampleInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of SampleInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return SamplePage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> SamplePage: + """ + Asynchronously retrieve a specific page of SampleInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of SampleInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return SamplePage(self._version, response, self._solution) + + def get(self, sid: str) -> SampleContext: + """ + Constructs a SampleContext + + :param sid: The Twilio-provided string that uniquely identifies the Sample resource to update. + """ + return SampleContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + sid=sid, + ) + + def __call__(self, sid: str) -> SampleContext: + """ + Constructs a SampleContext + + :param sid: The Twilio-provided string that uniquely identifies the Sample resource to update. + """ + return SampleContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + sid=sid, + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/autopilot/v1/assistant/task/task_actions.py b/twilio/rest/autopilot/v1/assistant/task/task_actions.py new file mode 100644 index 0000000000..01d4efa2c1 --- /dev/null +++ b/twilio/rest/autopilot/v1/assistant/task/task_actions.py @@ -0,0 +1,301 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Autopilot + 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 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 TaskActionsInstance(InstanceResource): + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskActions resource. + :ivar assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the Task associated with the resource. + :ivar task_sid: The SID of the [Task](https://www.twilio.com/docs/autopilot/api/task) associated with the resource. + :ivar url: The absolute URL of the TaskActions resource. + :ivar data: The JSON string that specifies the [actions](https://www.twilio.com/docs/autopilot/actions) that instruct the Assistant on how to perform the task. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + assistant_sid: str, + task_sid: str, + ): + super().__init__(version) + + self.account_sid: Optional[str] = payload.get("account_sid") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.task_sid: Optional[str] = payload.get("task_sid") + self.url: Optional[str] = payload.get("url") + self.data: Optional[Dict[str, object]] = payload.get("data") + + self._solution = { + "assistant_sid": assistant_sid, + "task_sid": task_sid, + } + self._context: Optional[TaskActionsContext] = None + + @property + def _proxy(self) -> "TaskActionsContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: TaskActionsContext for this TaskActionsInstance + """ + if self._context is None: + self._context = TaskActionsContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + ) + return self._context + + def fetch(self) -> "TaskActionsInstance": + """ + Fetch the TaskActionsInstance + + + :returns: The fetched TaskActionsInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "TaskActionsInstance": + """ + Asynchronous coroutine to fetch the TaskActionsInstance + + + :returns: The fetched TaskActionsInstance + """ + return await self._proxy.fetch_async() + + def update( + self, actions: Union[object, object] = values.unset + ) -> "TaskActionsInstance": + """ + Update the TaskActionsInstance + + :param actions: The JSON string that specifies the [actions](https://www.twilio.com/docs/autopilot/actions) that instruct the Assistant on how to perform the task. + + :returns: The updated TaskActionsInstance + """ + return self._proxy.update( + actions=actions, + ) + + async def update_async( + self, actions: Union[object, object] = values.unset + ) -> "TaskActionsInstance": + """ + Asynchronous coroutine to update the TaskActionsInstance + + :param actions: The JSON string that specifies the [actions](https://www.twilio.com/docs/autopilot/actions) that instruct the Assistant on how to perform the task. + + :returns: The updated TaskActionsInstance + """ + return await self._proxy.update_async( + actions=actions, + ) + + 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 TaskActionsContext(InstanceContext): + def __init__(self, version: Version, assistant_sid: str, task_sid: str): + """ + Initialize the TaskActionsContext + + :param version: Version that contains the resource + :param assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the Task for which the task actions to update were defined. + :param task_sid: The SID of the [Task](https://www.twilio.com/docs/autopilot/api/task) for which the task actions to update were defined. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + "task_sid": task_sid, + } + self._uri = "/Assistants/{assistant_sid}/Tasks/{task_sid}/Actions".format( + **self._solution + ) + + def fetch(self) -> TaskActionsInstance: + """ + Fetch the TaskActionsInstance + + + :returns: The fetched TaskActionsInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return TaskActionsInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + ) + + async def fetch_async(self) -> TaskActionsInstance: + """ + Asynchronous coroutine to fetch the TaskActionsInstance + + + :returns: The fetched TaskActionsInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return TaskActionsInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + ) + + def update( + self, actions: Union[object, object] = values.unset + ) -> TaskActionsInstance: + """ + Update the TaskActionsInstance + + :param actions: The JSON string that specifies the [actions](https://www.twilio.com/docs/autopilot/actions) that instruct the Assistant on how to perform the task. + + :returns: The updated TaskActionsInstance + """ + data = values.of( + { + "Actions": serialize.object(actions), + } + ) + + payload = self._version.update( + method="POST", + uri=self._uri, + data=data, + ) + + return TaskActionsInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + ) + + async def update_async( + self, actions: Union[object, object] = values.unset + ) -> TaskActionsInstance: + """ + Asynchronous coroutine to update the TaskActionsInstance + + :param actions: The JSON string that specifies the [actions](https://www.twilio.com/docs/autopilot/actions) that instruct the Assistant on how to perform the task. + + :returns: The updated TaskActionsInstance + """ + data = values.of( + { + "Actions": serialize.object(actions), + } + ) + + payload = await self._version.update_async( + method="POST", + uri=self._uri, + data=data, + ) + + return TaskActionsInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_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 TaskActionsList(ListResource): + def __init__(self, version: Version, assistant_sid: str, task_sid: str): + """ + Initialize the TaskActionsList + + :param version: Version that contains the resource + :param assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the Task for which the task actions to fetch were defined. + :param task_sid: The SID of the [Task](https://www.twilio.com/docs/autopilot/api/task) for which the task actions to fetch were defined. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + "task_sid": task_sid, + } + + def get(self) -> TaskActionsContext: + """ + Constructs a TaskActionsContext + + """ + return TaskActionsContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + ) + + def __call__(self) -> TaskActionsContext: + """ + Constructs a TaskActionsContext + + """ + return TaskActionsContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/autopilot/v1/assistant/task/task_statistics.py b/twilio/rest/autopilot/v1/assistant/task/task_statistics.py new file mode 100644 index 0000000000..3d92b05cb9 --- /dev/null +++ b/twilio/rest/autopilot/v1/assistant/task/task_statistics.py @@ -0,0 +1,221 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Autopilot + 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 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 TaskStatisticsInstance(InstanceResource): + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskStatistics resource. + :ivar assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the Task associated with the resource. + :ivar task_sid: The SID of the [Task](https://www.twilio.com/docs/autopilot/api/task) for which the statistics were collected. + :ivar samples_count: The total number of [Samples](https://www.twilio.com/docs/autopilot/api/task-sample) associated with the Task. + :ivar fields_count: The total number of [Fields](https://www.twilio.com/docs/autopilot/api/task-field) associated with the Task. + :ivar url: The absolute URL of the TaskStatistics resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + assistant_sid: str, + task_sid: str, + ): + super().__init__(version) + + self.account_sid: Optional[str] = payload.get("account_sid") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.task_sid: Optional[str] = payload.get("task_sid") + self.samples_count: Optional[int] = deserialize.integer( + payload.get("samples_count") + ) + self.fields_count: Optional[int] = deserialize.integer( + payload.get("fields_count") + ) + self.url: Optional[str] = payload.get("url") + + self._solution = { + "assistant_sid": assistant_sid, + "task_sid": task_sid, + } + self._context: Optional[TaskStatisticsContext] = None + + @property + def _proxy(self) -> "TaskStatisticsContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: TaskStatisticsContext for this TaskStatisticsInstance + """ + if self._context is None: + self._context = TaskStatisticsContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + ) + return self._context + + def fetch(self) -> "TaskStatisticsInstance": + """ + Fetch the TaskStatisticsInstance + + + :returns: The fetched TaskStatisticsInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "TaskStatisticsInstance": + """ + Asynchronous coroutine to fetch the TaskStatisticsInstance + + + :returns: The fetched TaskStatisticsInstance + """ + 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 TaskStatisticsContext(InstanceContext): + def __init__(self, version: Version, assistant_sid: str, task_sid: str): + """ + Initialize the TaskStatisticsContext + + :param version: Version that contains the resource + :param assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource to fetch. + :param task_sid: The SID of the [Task](https://www.twilio.com/docs/autopilot/api/task) that is associated with the resource to fetch. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + "task_sid": task_sid, + } + self._uri = "/Assistants/{assistant_sid}/Tasks/{task_sid}/Statistics".format( + **self._solution + ) + + def fetch(self) -> TaskStatisticsInstance: + """ + Fetch the TaskStatisticsInstance + + + :returns: The fetched TaskStatisticsInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return TaskStatisticsInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + ) + + async def fetch_async(self) -> TaskStatisticsInstance: + """ + Asynchronous coroutine to fetch the TaskStatisticsInstance + + + :returns: The fetched TaskStatisticsInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return TaskStatisticsInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_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 TaskStatisticsList(ListResource): + def __init__(self, version: Version, assistant_sid: str, task_sid: str): + """ + Initialize the TaskStatisticsList + + :param version: Version that contains the resource + :param assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource to fetch. + :param task_sid: The SID of the [Task](https://www.twilio.com/docs/autopilot/api/task) that is associated with the resource to fetch. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + "task_sid": task_sid, + } + + def get(self) -> TaskStatisticsContext: + """ + Constructs a TaskStatisticsContext + + """ + return TaskStatisticsContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + ) + + def __call__(self) -> TaskStatisticsContext: + """ + Constructs a TaskStatisticsContext + + """ + return TaskStatisticsContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/autopilot/v1/assistant/webhook.py b/twilio/rest/autopilot/v1/assistant/webhook.py new file mode 100644 index 0000000000..8a3e3da2f6 --- /dev/null +++ b/twilio/rest/autopilot/v1/assistant/webhook.py @@ -0,0 +1,671 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Autopilot + 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 WebhookInstance(InstanceResource): + + """ + :ivar url: The absolute URL of the Webhook resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Webhook resource. + :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. + :ivar assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. + :ivar sid: The unique string that we created to identify the Webhook 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. + :ivar events: The list of space-separated events that this Webhook is subscribed to. + :ivar webhook_url: The URL associated with this Webhook. + :ivar webhook_method: The method used when calling the webhook's URL. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + assistant_sid: str, + sid: Optional[str] = None, + ): + super().__init__(version) + + 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.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.sid: Optional[str] = payload.get("sid") + self.unique_name: Optional[str] = payload.get("unique_name") + self.events: Optional[str] = payload.get("events") + self.webhook_url: Optional[str] = payload.get("webhook_url") + self.webhook_method: Optional[str] = payload.get("webhook_method") + + self._solution = { + "assistant_sid": assistant_sid, + "sid": sid or self.sid, + } + self._context: Optional[WebhookContext] = None + + @property + def _proxy(self) -> "WebhookContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: WebhookContext for this WebhookInstance + """ + if self._context is None: + self._context = WebhookContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + sid=self._solution["sid"], + ) + return self._context + + def delete(self) -> bool: + """ + Deletes the WebhookInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the WebhookInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def fetch(self) -> "WebhookInstance": + """ + Fetch the WebhookInstance + + + :returns: The fetched WebhookInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "WebhookInstance": + """ + Asynchronous coroutine to fetch the WebhookInstance + + + :returns: The fetched WebhookInstance + """ + return await self._proxy.fetch_async() + + def update( + self, + unique_name: Union[str, object] = values.unset, + events: Union[str, object] = values.unset, + webhook_url: Union[str, object] = values.unset, + webhook_method: Union[str, object] = values.unset, + ) -> "WebhookInstance": + """ + Update the WebhookInstance + + :param unique_name: An application-defined string that uniquely identifies the new resource. It can be used as an alternative to the `sid` in the URL path to address the resource. This value must be unique and 64 characters or less in length. + :param events: The list of space-separated events that this Webhook will subscribe to. + :param webhook_url: The URL associated with this Webhook. + :param webhook_method: The method to be used when calling the webhook's URL. + + :returns: The updated WebhookInstance + """ + return self._proxy.update( + unique_name=unique_name, + events=events, + webhook_url=webhook_url, + webhook_method=webhook_method, + ) + + async def update_async( + self, + unique_name: Union[str, object] = values.unset, + events: Union[str, object] = values.unset, + webhook_url: Union[str, object] = values.unset, + webhook_method: Union[str, object] = values.unset, + ) -> "WebhookInstance": + """ + Asynchronous coroutine to update the WebhookInstance + + :param unique_name: An application-defined string that uniquely identifies the new resource. It can be used as an alternative to the `sid` in the URL path to address the resource. This value must be unique and 64 characters or less in length. + :param events: The list of space-separated events that this Webhook will subscribe to. + :param webhook_url: The URL associated with this Webhook. + :param webhook_method: The method to be used when calling the webhook's URL. + + :returns: The updated WebhookInstance + """ + return await self._proxy.update_async( + unique_name=unique_name, + events=events, + webhook_url=webhook_url, + webhook_method=webhook_method, + ) + + 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 WebhookContext(InstanceContext): + def __init__(self, version: Version, assistant_sid: str, sid: str): + """ + Initialize the WebhookContext + + :param version: Version that contains the resource + :param assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource to update. + :param sid: The Twilio-provided string that uniquely identifies the Webhook resource to update. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + "sid": sid, + } + self._uri = "/Assistants/{assistant_sid}/Webhooks/{sid}".format( + **self._solution + ) + + def delete(self) -> bool: + """ + Deletes the WebhookInstance + + + :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 WebhookInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._version.delete_async( + method="DELETE", + uri=self._uri, + ) + + def fetch(self) -> WebhookInstance: + """ + Fetch the WebhookInstance + + + :returns: The fetched WebhookInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return WebhookInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + sid=self._solution["sid"], + ) + + async def fetch_async(self) -> WebhookInstance: + """ + Asynchronous coroutine to fetch the WebhookInstance + + + :returns: The fetched WebhookInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return WebhookInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + sid=self._solution["sid"], + ) + + def update( + self, + unique_name: Union[str, object] = values.unset, + events: Union[str, object] = values.unset, + webhook_url: Union[str, object] = values.unset, + webhook_method: Union[str, object] = values.unset, + ) -> WebhookInstance: + """ + Update the WebhookInstance + + :param unique_name: An application-defined string that uniquely identifies the new resource. It can be used as an alternative to the `sid` in the URL path to address the resource. This value must be unique and 64 characters or less in length. + :param events: The list of space-separated events that this Webhook will subscribe to. + :param webhook_url: The URL associated with this Webhook. + :param webhook_method: The method to be used when calling the webhook's URL. + + :returns: The updated WebhookInstance + """ + data = values.of( + { + "UniqueName": unique_name, + "Events": events, + "WebhookUrl": webhook_url, + "WebhookMethod": webhook_method, + } + ) + + payload = self._version.update( + method="POST", + uri=self._uri, + data=data, + ) + + return WebhookInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + sid=self._solution["sid"], + ) + + async def update_async( + self, + unique_name: Union[str, object] = values.unset, + events: Union[str, object] = values.unset, + webhook_url: Union[str, object] = values.unset, + webhook_method: Union[str, object] = values.unset, + ) -> WebhookInstance: + """ + Asynchronous coroutine to update the WebhookInstance + + :param unique_name: An application-defined string that uniquely identifies the new resource. It can be used as an alternative to the `sid` in the URL path to address the resource. This value must be unique and 64 characters or less in length. + :param events: The list of space-separated events that this Webhook will subscribe to. + :param webhook_url: The URL associated with this Webhook. + :param webhook_method: The method to be used when calling the webhook's URL. + + :returns: The updated WebhookInstance + """ + data = values.of( + { + "UniqueName": unique_name, + "Events": events, + "WebhookUrl": webhook_url, + "WebhookMethod": webhook_method, + } + ) + + payload = await self._version.update_async( + method="POST", + uri=self._uri, + data=data, + ) + + return WebhookInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_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 WebhookPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> WebhookInstance: + """ + Build an instance of WebhookInstance + + :param payload: Payload response from the API + """ + return WebhookInstance( + self._version, payload, assistant_sid=self._solution["assistant_sid"] + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class WebhookList(ListResource): + def __init__(self, version: Version, assistant_sid: str): + """ + Initialize the WebhookList + + :param version: Version that contains the resource + :param assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resources to read. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + } + self._uri = "/Assistants/{assistant_sid}/Webhooks".format(**self._solution) + + def create( + self, + unique_name: str, + events: str, + webhook_url: str, + webhook_method: Union[str, object] = values.unset, + ) -> WebhookInstance: + """ + Create the WebhookInstance + + :param unique_name: An application-defined string that uniquely identifies the new resource. It can be used as an alternative to the `sid` in the URL path to address the resource. This value must be unique and 64 characters or less in length. + :param events: The list of space-separated events that this Webhook will subscribe to. + :param webhook_url: The URL associated with this Webhook. + :param webhook_method: The method to be used when calling the webhook's URL. + + :returns: The created WebhookInstance + """ + data = values.of( + { + "UniqueName": unique_name, + "Events": events, + "WebhookUrl": webhook_url, + "WebhookMethod": webhook_method, + } + ) + + payload = self._version.create( + method="POST", + uri=self._uri, + data=data, + ) + + return WebhookInstance( + self._version, payload, assistant_sid=self._solution["assistant_sid"] + ) + + async def create_async( + self, + unique_name: str, + events: str, + webhook_url: str, + webhook_method: Union[str, object] = values.unset, + ) -> WebhookInstance: + """ + Asynchronously create the WebhookInstance + + :param unique_name: An application-defined string that uniquely identifies the new resource. It can be used as an alternative to the `sid` in the URL path to address the resource. This value must be unique and 64 characters or less in length. + :param events: The list of space-separated events that this Webhook will subscribe to. + :param webhook_url: The URL associated with this Webhook. + :param webhook_method: The method to be used when calling the webhook's URL. + + :returns: The created WebhookInstance + """ + data = values.of( + { + "UniqueName": unique_name, + "Events": events, + "WebhookUrl": webhook_url, + "WebhookMethod": webhook_method, + } + ) + + payload = await self._version.create_async( + method="POST", + uri=self._uri, + data=data, + ) + + return WebhookInstance( + self._version, payload, assistant_sid=self._solution["assistant_sid"] + ) + + def stream( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[WebhookInstance]: + """ + Streams WebhookInstance 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[WebhookInstance]: + """ + Asynchronously streams WebhookInstance 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[WebhookInstance]: + """ + Lists WebhookInstance 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[WebhookInstance]: + """ + Asynchronously lists WebhookInstance 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, + ) -> WebhookPage: + """ + Retrieve a single page of WebhookInstance 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 WebhookInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = self._version.page(method="GET", uri=self._uri, params=data) + return WebhookPage(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, + ) -> WebhookPage: + """ + Asynchronously retrieve a single page of WebhookInstance 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 WebhookInstance + """ + 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 WebhookPage(self._version, response, self._solution) + + def get_page(self, target_url: str) -> WebhookPage: + """ + Retrieve a specific page of WebhookInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of WebhookInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return WebhookPage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> WebhookPage: + """ + Asynchronously retrieve a specific page of WebhookInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of WebhookInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return WebhookPage(self._version, response, self._solution) + + def get(self, sid: str) -> WebhookContext: + """ + Constructs a WebhookContext + + :param sid: The Twilio-provided string that uniquely identifies the Webhook resource to update. + """ + return WebhookContext( + self._version, assistant_sid=self._solution["assistant_sid"], sid=sid + ) + + def __call__(self, sid: str) -> WebhookContext: + """ + Constructs a WebhookContext + + :param sid: The Twilio-provided string that uniquely identifies the Webhook resource to update. + """ + return WebhookContext( + self._version, assistant_sid=self._solution["assistant_sid"], sid=sid + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/autopilot/v1/restore_assistant.py b/twilio/rest/autopilot/v1/restore_assistant.py new file mode 100644 index 0000000000..aae8dd3f8f --- /dev/null +++ b/twilio/rest/autopilot/v1/restore_assistant.py @@ -0,0 +1,136 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Autopilot + 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_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class RestoreAssistantInstance(InstanceResource): + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Assistant resource. + :ivar sid: The unique string that we created to identify the Assistant resource. + :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. + :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. + :ivar friendly_name: The string that you assigned to describe the resource. It is not unique and can be up to 255 characters long. + :ivar needs_model_build: Whether model needs to be rebuilt. + :ivar latest_model_build_sid: Reserved. + :ivar log_queries: Whether queries should be logged and kept after training. Can be: `true` or `false` and defaults to `true`. If `true`, queries are stored for 30 days, and then deleted. If `false`, no queries are stored. + :ivar development_stage: A string describing the state of the assistant. + :ivar callback_url: Reserved. + :ivar callback_events: Reserved. + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): + 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.unique_name: Optional[str] = payload.get("unique_name") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.needs_model_build: Optional[bool] = payload.get("needs_model_build") + self.latest_model_build_sid: Optional[str] = payload.get( + "latest_model_build_sid" + ) + self.log_queries: Optional[bool] = payload.get("log_queries") + self.development_stage: Optional[str] = payload.get("development_stage") + self.callback_url: Optional[str] = payload.get("callback_url") + self.callback_events: Optional[str] = payload.get("callback_events") + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "" + + +class RestoreAssistantList(ListResource): + def __init__(self, version: Version): + """ + Initialize the RestoreAssistantList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/Assistants/Restore" + + def update(self, assistant: str) -> RestoreAssistantInstance: + """ + Update the RestoreAssistantInstance + + :param assistant: The Twilio-provided string that uniquely identifies the Assistant resource to restore. + + :returns: The created RestoreAssistantInstance + """ + data = values.of( + { + "Assistant": assistant, + } + ) + + payload = self._version.update( + method="POST", + uri=self._uri, + data=data, + ) + + return RestoreAssistantInstance(self._version, payload) + + async def update_async(self, assistant: str) -> RestoreAssistantInstance: + """ + Asynchronously update the RestoreAssistantInstance + + :param assistant: The Twilio-provided string that uniquely identifies the Assistant resource to restore. + + :returns: The created RestoreAssistantInstance + """ + data = values.of( + { + "Assistant": assistant, + } + ) + + payload = await self._version.update_async( + method="POST", + uri=self._uri, + data=data, + ) + + return RestoreAssistantInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/bulkexports/v1/export/export_custom_job.py b/twilio/rest/bulkexports/v1/export/export_custom_job.py index abb3015e42..2c571489d6 100644 --- a/twilio/rest/bulkexports/v1/export/export_custom_job.py +++ b/twilio/rest/bulkexports/v1/export/export_custom_job.py @@ -127,7 +127,6 @@ def create( :returns: The created ExportCustomJobInstance """ - data = values.of( { "StartDay": start_day, @@ -170,7 +169,6 @@ async def create_async( :returns: The created ExportCustomJobInstance """ - data = values.of( { "StartDay": start_day, diff --git a/twilio/rest/chat/v1/credential.py b/twilio/rest/chat/v1/credential.py index bf6350120a..ecdf1d58e2 100644 --- a/twilio/rest/chat/v1/credential.py +++ b/twilio/rest/chat/v1/credential.py @@ -405,7 +405,6 @@ def create( :returns: The created CredentialInstance """ - data = values.of( { "Type": type, @@ -449,7 +448,6 @@ async def create_async( :returns: The created CredentialInstance """ - data = values.of( { "Type": type, diff --git a/twilio/rest/chat/v1/service/__init__.py b/twilio/rest/chat/v1/service/__init__.py index be4e946817..f8a377057c 100644 --- a/twilio/rest/chat/v1/service/__init__.py +++ b/twilio/rest/chat/v1/service/__init__.py @@ -1062,7 +1062,6 @@ def create(self, friendly_name: str) -> ServiceInstance: :returns: The created ServiceInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -1085,7 +1084,6 @@ async def create_async(self, friendly_name: str) -> ServiceInstance: :returns: The created ServiceInstance """ - data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/chat/v1/service/channel/__init__.py b/twilio/rest/chat/v1/service/channel/__init__.py index 46223702b5..e04d95a433 100644 --- a/twilio/rest/chat/v1/service/channel/__init__.py +++ b/twilio/rest/chat/v1/service/channel/__init__.py @@ -472,7 +472,6 @@ def create( :returns: The created ChannelInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -509,7 +508,6 @@ async def create_async( :returns: The created ChannelInstance """ - data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/chat/v1/service/channel/invite.py b/twilio/rest/chat/v1/service/channel/invite.py index 3894abe546..e3dbbae07f 100644 --- a/twilio/rest/chat/v1/service/channel/invite.py +++ b/twilio/rest/chat/v1/service/channel/invite.py @@ -288,7 +288,6 @@ def create( :returns: The created InviteInstance """ - data = values.of( { "Identity": identity, @@ -320,7 +319,6 @@ async def create_async( :returns: The created InviteInstance """ - data = values.of( { "Identity": identity, diff --git a/twilio/rest/chat/v1/service/channel/member.py b/twilio/rest/chat/v1/service/channel/member.py index dc56780e72..62e3912bf9 100644 --- a/twilio/rest/chat/v1/service/channel/member.py +++ b/twilio/rest/chat/v1/service/channel/member.py @@ -398,7 +398,6 @@ def create( :returns: The created MemberInstance """ - data = values.of( { "Identity": identity, @@ -430,7 +429,6 @@ async def create_async( :returns: The created MemberInstance """ - data = values.of( { "Identity": identity, diff --git a/twilio/rest/chat/v1/service/channel/message.py b/twilio/rest/chat/v1/service/channel/message.py index 6fea6a1800..ad45b6eb59 100644 --- a/twilio/rest/chat/v1/service/channel/message.py +++ b/twilio/rest/chat/v1/service/channel/message.py @@ -405,7 +405,6 @@ def create( :returns: The created MessageInstance """ - data = values.of( { "Body": body, @@ -442,7 +441,6 @@ async def create_async( :returns: The created MessageInstance """ - data = values.of( { "Body": body, diff --git a/twilio/rest/chat/v1/service/role.py b/twilio/rest/chat/v1/service/role.py index 913969fa9c..e1a5e5cd53 100644 --- a/twilio/rest/chat/v1/service/role.py +++ b/twilio/rest/chat/v1/service/role.py @@ -350,7 +350,6 @@ def create( :returns: The created RoleInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -381,7 +380,6 @@ async def create_async( :returns: The created RoleInstance """ - data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/chat/v1/service/user/__init__.py b/twilio/rest/chat/v1/service/user/__init__.py index 316e773b0b..fd6e9d6c44 100644 --- a/twilio/rest/chat/v1/service/user/__init__.py +++ b/twilio/rest/chat/v1/service/user/__init__.py @@ -423,7 +423,6 @@ def create( :returns: The created UserInstance """ - data = values.of( { "Identity": identity, @@ -460,7 +459,6 @@ async def create_async( :returns: The created UserInstance """ - data = values.of( { "Identity": identity, diff --git a/twilio/rest/chat/v2/credential.py b/twilio/rest/chat/v2/credential.py index 1e49f78db3..4a3df30e93 100644 --- a/twilio/rest/chat/v2/credential.py +++ b/twilio/rest/chat/v2/credential.py @@ -405,7 +405,6 @@ def create( :returns: The created CredentialInstance """ - data = values.of( { "Type": type, @@ -449,7 +448,6 @@ async def create_async( :returns: The created CredentialInstance """ - data = values.of( { "Type": type, diff --git a/twilio/rest/chat/v2/service/__init__.py b/twilio/rest/chat/v2/service/__init__.py index 59d8b8a5f5..208805c7b7 100644 --- a/twilio/rest/chat/v2/service/__init__.py +++ b/twilio/rest/chat/v2/service/__init__.py @@ -823,7 +823,6 @@ def create(self, friendly_name: str) -> ServiceInstance: :returns: The created ServiceInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -846,7 +845,6 @@ async def create_async(self, friendly_name: str) -> ServiceInstance: :returns: The created ServiceInstance """ - data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/chat/v2/service/channel/__init__.py b/twilio/rest/chat/v2/service/channel/__init__.py index e785020790..82fc71f80b 100644 --- a/twilio/rest/chat/v2/service/channel/__init__.py +++ b/twilio/rest/chat/v2/service/channel/__init__.py @@ -604,7 +604,6 @@ def create( :returns: The created ChannelInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -621,7 +620,6 @@ def create( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) - payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -657,7 +655,6 @@ async def create_async( :returns: The created ChannelInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -674,7 +671,6 @@ async def create_async( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) - payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/chat/v2/service/channel/invite.py b/twilio/rest/chat/v2/service/channel/invite.py index bf4e7fbc5c..3b89e94f85 100644 --- a/twilio/rest/chat/v2/service/channel/invite.py +++ b/twilio/rest/chat/v2/service/channel/invite.py @@ -288,7 +288,6 @@ def create( :returns: The created InviteInstance """ - data = values.of( { "Identity": identity, @@ -320,7 +319,6 @@ async def create_async( :returns: The created InviteInstance """ - data = values.of( { "Identity": identity, diff --git a/twilio/rest/chat/v2/service/channel/member.py b/twilio/rest/chat/v2/service/channel/member.py index 54e2aa407c..aa03d8bac3 100644 --- a/twilio/rest/chat/v2/service/channel/member.py +++ b/twilio/rest/chat/v2/service/channel/member.py @@ -531,7 +531,6 @@ def create( :returns: The created MemberInstance """ - data = values.of( { "Identity": identity, @@ -550,7 +549,6 @@ def create( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) - payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -589,7 +587,6 @@ async def create_async( :returns: The created MemberInstance """ - data = values.of( { "Identity": identity, @@ -608,7 +605,6 @@ async def create_async( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) - payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/chat/v2/service/channel/message.py b/twilio/rest/chat/v2/service/channel/message.py index 3e1b289fd7..07f6a9dc90 100644 --- a/twilio/rest/chat/v2/service/channel/message.py +++ b/twilio/rest/chat/v2/service/channel/message.py @@ -535,7 +535,6 @@ def create( :returns: The created MessageInstance """ - data = values.of( { "From": from_, @@ -552,7 +551,6 @@ def create( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) - payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -591,7 +589,6 @@ async def create_async( :returns: The created MessageInstance """ - data = values.of( { "From": from_, @@ -608,7 +605,6 @@ async def create_async( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) - payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/chat/v2/service/channel/webhook.py b/twilio/rest/chat/v2/service/channel/webhook.py index e20ca22432..6e05e41742 100644 --- a/twilio/rest/chat/v2/service/channel/webhook.py +++ b/twilio/rest/chat/v2/service/channel/webhook.py @@ -466,7 +466,6 @@ def create( :returns: The created WebhookInstance """ - data = values.of( { "Type": type, @@ -519,7 +518,6 @@ async def create_async( :returns: The created WebhookInstance """ - data = values.of( { "Type": type, diff --git a/twilio/rest/chat/v2/service/role.py b/twilio/rest/chat/v2/service/role.py index 4d636c71f2..7f77ee6e4b 100644 --- a/twilio/rest/chat/v2/service/role.py +++ b/twilio/rest/chat/v2/service/role.py @@ -350,7 +350,6 @@ def create( :returns: The created RoleInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -381,7 +380,6 @@ async def create_async( :returns: The created RoleInstance """ - data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/chat/v2/service/user/__init__.py b/twilio/rest/chat/v2/service/user/__init__.py index 1c9e780d43..9977023e7f 100644 --- a/twilio/rest/chat/v2/service/user/__init__.py +++ b/twilio/rest/chat/v2/service/user/__init__.py @@ -476,7 +476,6 @@ def create( :returns: The created UserInstance """ - data = values.of( { "Identity": identity, @@ -490,7 +489,6 @@ def create( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) - payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -520,7 +518,6 @@ async def create_async( :returns: The created UserInstance """ - data = values.of( { "Identity": identity, @@ -534,7 +531,6 @@ async def create_async( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) - payload = await self._version.create_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 860d76fe33..b0eaaa0fad 100644 --- a/twilio/rest/content/v1/content/__init__.py +++ b/twilio/rest/content/v1/content/__init__.py @@ -34,7 +34,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 """ diff --git a/twilio/rest/content/v1/content_and_approvals.py b/twilio/rest/content/v1/content_and_approvals.py index f7bb8a53f9..914376ea0b 100644 --- a/twilio/rest/content/v1/content_and_approvals.py +++ b/twilio/rest/content/v1/content_and_approvals.py @@ -33,7 +33,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 73df905114..9a1370b98a 100644 --- a/twilio/rest/content/v1/legacy_content.py +++ b/twilio/rest/content/v1/legacy_content.py @@ -33,7 +33,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/conversations/v1/address_configuration.py b/twilio/rest/conversations/v1/address_configuration.py index 5cfc0b9c84..ccaf87dee6 100644 --- a/twilio/rest/conversations/v1/address_configuration.py +++ b/twilio/rest/conversations/v1/address_configuration.py @@ -498,7 +498,6 @@ def create( :returns: The created AddressConfigurationInstance """ - data = values.of( { "Type": type, @@ -563,7 +562,6 @@ async def create_async( :returns: The created AddressConfigurationInstance """ - data = values.of( { "Type": type, diff --git a/twilio/rest/conversations/v1/conversation/__init__.py b/twilio/rest/conversations/v1/conversation/__init__.py index e7ac784be1..9194b30934 100644 --- a/twilio/rest/conversations/v1/conversation/__init__.py +++ b/twilio/rest/conversations/v1/conversation/__init__.py @@ -617,7 +617,6 @@ def create( :returns: The created ConversationInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -638,7 +637,6 @@ def create( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) - payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -680,7 +678,6 @@ async def create_async( :returns: The created ConversationInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -701,7 +698,6 @@ async def create_async( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) - payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/conversations/v1/conversation/message/__init__.py b/twilio/rest/conversations/v1/conversation/message/__init__.py index 577ff64b46..3250a59dd8 100644 --- a/twilio/rest/conversations/v1/conversation/message/__init__.py +++ b/twilio/rest/conversations/v1/conversation/message/__init__.py @@ -50,7 +50,7 @@ class WebhookEnabledType(object): :ivar url: An absolute API resource API URL for this message. :ivar delivery: An object that contains the summary of delivery statuses for the message to non-chat participants. :ivar links: Contains an absolute API resource URL to access the delivery & read receipts of this message. - :ivar content_sid: The unique ID of the multi-channel [Rich Content](https://www.twilio.com/docs/content) template. + :ivar content_sid: The unique ID of the multi-channel [Rich Content](https://www.twilio.com/docs/content-api) template. """ def __init__( @@ -68,7 +68,7 @@ def __init__( self.index: Optional[int] = deserialize.integer(payload.get("index")) self.author: Optional[str] = payload.get("author") self.body: Optional[str] = payload.get("body") - self.media: Optional[List[Dict[str, object]]] = payload.get("media") + self.media: Optional[List[object]] = payload.get("media") self.attributes: Optional[str] = payload.get("attributes") self.participant_sid: Optional[str] = payload.get("participant_sid") self.date_created: Optional[datetime] = deserialize.iso8601_datetime( @@ -540,13 +540,12 @@ def create( :param date_updated: The date that this resource was last updated. `null` if the message has not been edited. :param attributes: A 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 media_sid: The Media SID to be attached to the new Message. - :param content_sid: The unique ID of the multi-channel [Rich Content](https://www.twilio.com/docs/content) template, required for template-generated messages. **Note** that if this field is set, `Body` and `MediaSid` parameters are ignored. + :param content_sid: The unique ID of the multi-channel [Rich Content](https://www.twilio.com/docs/content-api) template, required for template-generated messages. **Note** that if this field is set, `Body` and `MediaSid` parameters are ignored. :param content_variables: A structurally valid JSON string that contains values to resolve Rich Content template variables. :param subject: The subject of the message, can be up to 256 characters long. :returns: The created MessageInstance """ - data = values.of( { "Author": author, @@ -565,7 +564,6 @@ def create( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) - payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -599,13 +597,12 @@ async def create_async( :param date_updated: The date that this resource was last updated. `null` if the message has not been edited. :param attributes: A 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 media_sid: The Media SID to be attached to the new Message. - :param content_sid: The unique ID of the multi-channel [Rich Content](https://www.twilio.com/docs/content) template, required for template-generated messages. **Note** that if this field is set, `Body` and `MediaSid` parameters are ignored. + :param content_sid: The unique ID of the multi-channel [Rich Content](https://www.twilio.com/docs/content-api) template, required for template-generated messages. **Note** that if this field is set, `Body` and `MediaSid` parameters are ignored. :param content_variables: A structurally valid JSON string that contains values to resolve Rich Content template variables. :param subject: The subject of the message, can be up to 256 characters long. :returns: The created MessageInstance """ - data = values.of( { "Author": author, @@ -624,7 +621,6 @@ async def create_async( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) - payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/conversations/v1/conversation/participant.py b/twilio/rest/conversations/v1/conversation/participant.py index a05f4085d7..e9cb028ff3 100644 --- a/twilio/rest/conversations/v1/conversation/participant.py +++ b/twilio/rest/conversations/v1/conversation/participant.py @@ -549,7 +549,6 @@ def create( :returns: The created ParticipantInstance """ - data = values.of( { "Identity": identity, @@ -567,7 +566,6 @@ def create( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) - payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -605,7 +603,6 @@ async def create_async( :returns: The created ParticipantInstance """ - data = values.of( { "Identity": identity, @@ -623,7 +620,6 @@ async def create_async( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) - payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/conversations/v1/conversation/webhook.py b/twilio/rest/conversations/v1/conversation/webhook.py index ddd49ede23..8b7493388a 100644 --- a/twilio/rest/conversations/v1/conversation/webhook.py +++ b/twilio/rest/conversations/v1/conversation/webhook.py @@ -436,7 +436,6 @@ def create( :returns: The created WebhookInstance """ - data = values.of( { "Target": target, @@ -486,7 +485,6 @@ async def create_async( :returns: The created WebhookInstance """ - data = values.of( { "Target": target, diff --git a/twilio/rest/conversations/v1/credential.py b/twilio/rest/conversations/v1/credential.py index c8b680a9c4..0b6dfd8289 100644 --- a/twilio/rest/conversations/v1/credential.py +++ b/twilio/rest/conversations/v1/credential.py @@ -417,7 +417,6 @@ def create( :returns: The created CredentialInstance """ - data = values.of( { "Type": type, @@ -461,7 +460,6 @@ async def create_async( :returns: The created CredentialInstance """ - data = values.of( { "Type": type, diff --git a/twilio/rest/conversations/v1/role.py b/twilio/rest/conversations/v1/role.py index 61e10ffec0..fb7626ce0c 100644 --- a/twilio/rest/conversations/v1/role.py +++ b/twilio/rest/conversations/v1/role.py @@ -323,7 +323,6 @@ def create( :returns: The created RoleInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -352,7 +351,6 @@ async def create_async( :returns: The created RoleInstance """ - data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/conversations/v1/service/__init__.py b/twilio/rest/conversations/v1/service/__init__.py index 924df1fd27..ad4066710f 100644 --- a/twilio/rest/conversations/v1/service/__init__.py +++ b/twilio/rest/conversations/v1/service/__init__.py @@ -373,7 +373,6 @@ def create(self, friendly_name: str) -> ServiceInstance: :returns: The created ServiceInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -396,7 +395,6 @@ async def create_async(self, friendly_name: str) -> ServiceInstance: :returns: The created ServiceInstance """ - data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/conversations/v1/service/conversation/__init__.py b/twilio/rest/conversations/v1/service/conversation/__init__.py index 0fef1cffaf..3fe88d5564 100644 --- a/twilio/rest/conversations/v1/service/conversation/__init__.py +++ b/twilio/rest/conversations/v1/service/conversation/__init__.py @@ -653,7 +653,6 @@ def create( :returns: The created ConversationInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -674,7 +673,6 @@ def create( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) - payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -718,7 +716,6 @@ async def create_async( :returns: The created ConversationInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -739,7 +736,6 @@ async def create_async( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) - payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/conversations/v1/service/conversation/message/__init__.py b/twilio/rest/conversations/v1/service/conversation/message/__init__.py index e3c94e2ecd..3c42151531 100644 --- a/twilio/rest/conversations/v1/service/conversation/message/__init__.py +++ b/twilio/rest/conversations/v1/service/conversation/message/__init__.py @@ -51,7 +51,7 @@ class WebhookEnabledType(object): :ivar delivery: An object that contains the summary of delivery statuses for the message to non-chat participants. :ivar url: An absolute API resource URL for this message. :ivar links: Contains an absolute API resource URL to access the delivery & read receipts of this message. - :ivar content_sid: The unique ID of the multi-channel [Rich Content](https://www.twilio.com/docs/content) template. + :ivar content_sid: The unique ID of the multi-channel [Rich Content](https://www.twilio.com/docs/content-api) template. """ def __init__( @@ -71,7 +71,7 @@ def __init__( self.index: Optional[int] = deserialize.integer(payload.get("index")) self.author: Optional[str] = payload.get("author") self.body: Optional[str] = payload.get("body") - self.media: Optional[List[Dict[str, object]]] = payload.get("media") + self.media: Optional[List[object]] = payload.get("media") self.attributes: Optional[str] = payload.get("attributes") self.participant_sid: Optional[str] = payload.get("participant_sid") self.date_created: Optional[datetime] = deserialize.iso8601_datetime( @@ -559,13 +559,12 @@ def create( :param date_updated: The date that this resource was last updated. `null` if the message has not been edited. :param attributes: A 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 media_sid: The Media SID to be attached to the new Message. - :param content_sid: The unique ID of the multi-channel [Rich Content](https://www.twilio.com/docs/content) template, required for template-generated messages. **Note** that if this field is set, `Body` and `MediaSid` parameters are ignored. + :param content_sid: The unique ID of the multi-channel [Rich Content](https://www.twilio.com/docs/content-api) template, required for template-generated messages. **Note** that if this field is set, `Body` and `MediaSid` parameters are ignored. :param content_variables: A structurally valid JSON string that contains values to resolve Rich Content template variables. :param subject: The subject of the message, can be up to 256 characters long. :returns: The created MessageInstance """ - data = values.of( { "Author": author, @@ -584,7 +583,6 @@ def create( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) - payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -621,13 +619,12 @@ async def create_async( :param date_updated: The date that this resource was last updated. `null` if the message has not been edited. :param attributes: A 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 media_sid: The Media SID to be attached to the new Message. - :param content_sid: The unique ID of the multi-channel [Rich Content](https://www.twilio.com/docs/content) template, required for template-generated messages. **Note** that if this field is set, `Body` and `MediaSid` parameters are ignored. + :param content_sid: The unique ID of the multi-channel [Rich Content](https://www.twilio.com/docs/content-api) template, required for template-generated messages. **Note** that if this field is set, `Body` and `MediaSid` parameters are ignored. :param content_variables: A structurally valid JSON string that contains values to resolve Rich Content template variables. :param subject: The subject of the message, can be up to 256 characters long. :returns: The created MessageInstance """ - data = values.of( { "Author": author, @@ -646,7 +643,6 @@ async def create_async( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) - payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/conversations/v1/service/conversation/participant.py b/twilio/rest/conversations/v1/service/conversation/participant.py index cf4fba5fa4..70345aed67 100644 --- a/twilio/rest/conversations/v1/service/conversation/participant.py +++ b/twilio/rest/conversations/v1/service/conversation/participant.py @@ -567,7 +567,6 @@ def create( :returns: The created ParticipantInstance """ - data = values.of( { "Identity": identity, @@ -585,7 +584,6 @@ def create( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) - payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -626,7 +624,6 @@ async def create_async( :returns: The created ParticipantInstance """ - data = values.of( { "Identity": identity, @@ -644,7 +641,6 @@ async def create_async( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) - payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/conversations/v1/service/conversation/webhook.py b/twilio/rest/conversations/v1/service/conversation/webhook.py index 5dace89d67..88e848f351 100644 --- a/twilio/rest/conversations/v1/service/conversation/webhook.py +++ b/twilio/rest/conversations/v1/service/conversation/webhook.py @@ -454,7 +454,6 @@ def create( :returns: The created WebhookInstance """ - data = values.of( { "Target": target, @@ -507,7 +506,6 @@ async def create_async( :returns: The created WebhookInstance """ - data = values.of( { "Target": target, diff --git a/twilio/rest/conversations/v1/service/role.py b/twilio/rest/conversations/v1/service/role.py index 2adbfc131b..2ae2c16fb1 100644 --- a/twilio/rest/conversations/v1/service/role.py +++ b/twilio/rest/conversations/v1/service/role.py @@ -350,7 +350,6 @@ def create( :returns: The created RoleInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -381,7 +380,6 @@ async def create_async( :returns: The created RoleInstance """ - data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/conversations/v1/service/user/__init__.py b/twilio/rest/conversations/v1/service/user/__init__.py index 0f5e24b392..10747179bf 100644 --- a/twilio/rest/conversations/v1/service/user/__init__.py +++ b/twilio/rest/conversations/v1/service/user/__init__.py @@ -488,7 +488,6 @@ def create( :returns: The created UserInstance """ - data = values.of( { "Identity": identity, @@ -502,7 +501,6 @@ def create( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) - payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -532,7 +530,6 @@ async def create_async( :returns: The created UserInstance """ - data = values.of( { "Identity": identity, @@ -546,7 +543,6 @@ async def create_async( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) - payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/conversations/v1/user/__init__.py b/twilio/rest/conversations/v1/user/__init__.py index 6b922afa7b..72a285885e 100644 --- a/twilio/rest/conversations/v1/user/__init__.py +++ b/twilio/rest/conversations/v1/user/__init__.py @@ -458,7 +458,6 @@ def create( :returns: The created UserInstance """ - data = values.of( { "Identity": identity, @@ -472,7 +471,6 @@ def create( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) - payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -500,7 +498,6 @@ async def create_async( :returns: The created UserInstance """ - data = values.of( { "Identity": identity, @@ -514,7 +511,6 @@ async def create_async( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) - payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/events/v1/sink/__init__.py b/twilio/rest/events/v1/sink/__init__.py index 89289ede30..5a7626ad83 100644 --- a/twilio/rest/events/v1/sink/__init__.py +++ b/twilio/rest/events/v1/sink/__init__.py @@ -378,7 +378,6 @@ def create( :returns: The created SinkInstance """ - data = values.of( { "Description": description, @@ -410,7 +409,6 @@ async def create_async( :returns: The created SinkInstance """ - data = values.of( { "Description": description, diff --git a/twilio/rest/events/v1/sink/sink_validate.py b/twilio/rest/events/v1/sink/sink_validate.py index 792d8c4553..8539a1ef41 100644 --- a/twilio/rest/events/v1/sink/sink_validate.py +++ b/twilio/rest/events/v1/sink/sink_validate.py @@ -71,7 +71,6 @@ def create(self, test_id: str) -> SinkValidateInstance: :returns: The created SinkValidateInstance """ - data = values.of( { "TestId": test_id, @@ -94,7 +93,6 @@ async def create_async(self, test_id: str) -> SinkValidateInstance: :returns: The created SinkValidateInstance """ - data = values.of( { "TestId": test_id, diff --git a/twilio/rest/events/v1/subscription/__init__.py b/twilio/rest/events/v1/subscription/__init__.py index cbe79a985d..458177d487 100644 --- a/twilio/rest/events/v1/subscription/__init__.py +++ b/twilio/rest/events/v1/subscription/__init__.py @@ -364,7 +364,6 @@ def create( :returns: The created SubscriptionInstance """ - data = values.of( { "Description": description, @@ -393,7 +392,6 @@ async def create_async( :returns: The created SubscriptionInstance """ - data = values.of( { "Description": description, diff --git a/twilio/rest/events/v1/subscription/subscribed_event.py b/twilio/rest/events/v1/subscription/subscribed_event.py index f00df95b33..f45fe0b2e0 100644 --- a/twilio/rest/events/v1/subscription/subscribed_event.py +++ b/twilio/rest/events/v1/subscription/subscribed_event.py @@ -27,7 +27,7 @@ class SubscribedEventInstance(InstanceResource): """ :ivar account_sid: The unique SID identifier of the Account. :ivar type: Type of event being subscribed to. - :ivar schema_version: The schema version that the Subscription should use. + :ivar schema_version: The schema version that the subscription should use. :ivar subscription_sid: The unique SID identifier of the Subscription. :ivar url: The URL of this resource. """ @@ -113,7 +113,7 @@ def update( """ Update the SubscribedEventInstance - :param schema_version: The schema version that the Subscription should use. + :param schema_version: The schema version that the subscription should use. :returns: The updated SubscribedEventInstance """ @@ -127,7 +127,7 @@ async def update_async( """ Asynchronous coroutine to update the SubscribedEventInstance - :param schema_version: The schema version that the Subscription should use. + :param schema_version: The schema version that the subscription should use. :returns: The updated SubscribedEventInstance """ @@ -235,7 +235,7 @@ def update( """ Update the SubscribedEventInstance - :param schema_version: The schema version that the Subscription should use. + :param schema_version: The schema version that the subscription should use. :returns: The updated SubscribedEventInstance """ @@ -264,7 +264,7 @@ async def update_async( """ Asynchronous coroutine to update the SubscribedEventInstance - :param schema_version: The schema version that the Subscription should use. + :param schema_version: The schema version that the subscription should use. :returns: The updated SubscribedEventInstance """ @@ -343,11 +343,10 @@ def create( Create the SubscribedEventInstance :param type: Type of event being subscribed to. - :param schema_version: The schema version that the Subscription should use. + :param schema_version: The schema version that the subscription should use. :returns: The created SubscribedEventInstance """ - data = values.of( { "Type": type, @@ -372,11 +371,10 @@ async def create_async( Asynchronously create the SubscribedEventInstance :param type: Type of event being subscribed to. - :param schema_version: The schema version that the Subscription should use. + :param schema_version: The schema version that the subscription should use. :returns: The created SubscribedEventInstance """ - data = values.of( { "Type": type, diff --git a/twilio/rest/flex_api/v1/__init__.py b/twilio/rest/flex_api/v1/__init__.py index 59e697bd9e..64701c623f 100644 --- a/twilio/rest/flex_api/v1/__init__.py +++ b/twilio/rest/flex_api/v1/__init__.py @@ -40,7 +40,6 @@ ) from twilio.rest.flex_api.v1.insights_user_roles import InsightsUserRolesList from twilio.rest.flex_api.v1.interaction import InteractionList -from twilio.rest.flex_api.v1.provisioning_status import ProvisioningStatusList from twilio.rest.flex_api.v1.web_channel import WebChannelList @@ -75,7 +74,6 @@ def __init__(self, domain: Domain): self._insights_settings_comment: Optional[InsightsSettingsCommentList] = None self._insights_user_roles: Optional[InsightsUserRolesList] = None self._interaction: Optional[InteractionList] = None - self._provisioning_status: Optional[ProvisioningStatusList] = None self._web_channel: Optional[WebChannelList] = None @property @@ -172,12 +170,6 @@ def interaction(self) -> InteractionList: self._interaction = InteractionList(self) return self._interaction - @property - def provisioning_status(self) -> ProvisioningStatusList: - if self._provisioning_status is None: - self._provisioning_status = ProvisioningStatusList(self) - return self._provisioning_status - @property def web_channel(self) -> WebChannelList: if self._web_channel is None: diff --git a/twilio/rest/flex_api/v1/assessments.py b/twilio/rest/flex_api/v1/assessments.py index b6b2e626ad..06a335189c 100644 --- a/twilio/rest/flex_api/v1/assessments.py +++ b/twilio/rest/flex_api/v1/assessments.py @@ -307,7 +307,6 @@ def create( :returns: The created AssessmentsInstance """ - data = values.of( { "CategorySid": category_sid, @@ -327,7 +326,6 @@ def create( "Authorization": authorization, } ) - payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -365,7 +363,6 @@ async def create_async( :returns: The created AssessmentsInstance """ - data = values.of( { "CategorySid": category_sid, @@ -385,7 +382,6 @@ async def create_async( "Authorization": authorization, } ) - payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/flex_api/v1/channel.py b/twilio/rest/flex_api/v1/channel.py index a9151604eb..cf2d765879 100644 --- a/twilio/rest/flex_api/v1/channel.py +++ b/twilio/rest/flex_api/v1/channel.py @@ -267,7 +267,6 @@ def create( :returns: The created ChannelInstance """ - data = values.of( { "FlexFlowSid": flex_flow_sid, @@ -320,7 +319,6 @@ async def create_async( :returns: The created ChannelInstance """ - data = values.of( { "FlexFlowSid": flex_flow_sid, diff --git a/twilio/rest/flex_api/v1/configuration.py b/twilio/rest/flex_api/v1/configuration.py index ef00fbfeee..d46150795a 100644 --- a/twilio/rest/flex_api/v1/configuration.py +++ b/twilio/rest/flex_api/v1/configuration.py @@ -76,7 +76,6 @@ class Status(object): :ivar flex_ui_status_report: Configurable parameters for Flex UI Status report. :ivar agent_conv_end_methods: Agent conversation end methods. :ivar citrix_voice_vdi: Citrix voice vdi configuration and settings. - :ivar offline_config: Presence and presence ttl configuration """ def __init__(self, version: Version, payload: Dict[str, Any]): @@ -100,10 +99,10 @@ def __init__(self, version: Version, payload: Dict[str, Any]): self.taskrouter_target_taskqueue_sid: Optional[str] = payload.get( "taskrouter_target_taskqueue_sid" ) - self.taskrouter_taskqueues: Optional[List[Dict[str, object]]] = payload.get( + self.taskrouter_taskqueues: Optional[List[object]] = payload.get( "taskrouter_taskqueues" ) - self.taskrouter_skills: Optional[List[Dict[str, object]]] = payload.get( + self.taskrouter_skills: Optional[List[object]] = payload.get( "taskrouter_skills" ) self.taskrouter_worker_channels: Optional[Dict[str, object]] = payload.get( @@ -152,9 +151,7 @@ def __init__(self, version: Version, payload: Dict[str, Any]): self.plugin_service_attributes: Optional[Dict[str, object]] = payload.get( "plugin_service_attributes" ) - self.integrations: Optional[List[Dict[str, object]]] = payload.get( - "integrations" - ) + self.integrations: Optional[List[object]] = payload.get("integrations") self.outbound_call_flows: Optional[Dict[str, object]] = payload.get( "outbound_call_flows" ) @@ -174,9 +171,7 @@ def __init__(self, version: Version, payload: Dict[str, Any]): "flex_insights_drilldown" ) self.flex_url: Optional[str] = payload.get("flex_url") - self.channel_configs: Optional[List[Dict[str, object]]] = payload.get( - "channel_configs" - ) + self.channel_configs: Optional[List[object]] = payload.get("channel_configs") self.debugger_integration: Optional[Dict[str, object]] = payload.get( "debugger_integration" ) @@ -189,7 +184,6 @@ def __init__(self, version: Version, payload: Dict[str, Any]): self.citrix_voice_vdi: Optional[Dict[str, object]] = payload.get( "citrix_voice_vdi" ) - self.offline_config: Optional[Dict[str, object]] = payload.get("offline_config") self._context: Optional[ConfigurationContext] = None diff --git a/twilio/rest/flex_api/v1/flex_flow.py b/twilio/rest/flex_api/v1/flex_flow.py index ba4dc4ec60..45402a43b6 100644 --- a/twilio/rest/flex_api/v1/flex_flow.py +++ b/twilio/rest/flex_api/v1/flex_flow.py @@ -591,7 +591,6 @@ def create( :returns: The created FlexFlowInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -667,7 +666,6 @@ async def create_async( :returns: The created FlexFlowInstance """ - data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/flex_api/v1/insights_assessments_comment.py b/twilio/rest/flex_api/v1/insights_assessments_comment.py index 2d5fd3a431..05b2dfb3e7 100644 --- a/twilio/rest/flex_api/v1/insights_assessments_comment.py +++ b/twilio/rest/flex_api/v1/insights_assessments_comment.py @@ -120,7 +120,6 @@ def create( :returns: The created InsightsAssessmentsCommentInstance """ - data = values.of( { "CategoryId": category_id, @@ -136,7 +135,6 @@ def create( "Authorization": authorization, } ) - payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -166,7 +164,6 @@ async def create_async( :returns: The created InsightsAssessmentsCommentInstance """ - data = values.of( { "CategoryId": category_id, @@ -182,7 +179,6 @@ async def create_async( "Authorization": authorization, } ) - payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/flex_api/v1/insights_conversations.py b/twilio/rest/flex_api/v1/insights_conversations.py index 205f43c39b..204d9807f1 100644 --- a/twilio/rest/flex_api/v1/insights_conversations.py +++ b/twilio/rest/flex_api/v1/insights_conversations.py @@ -39,7 +39,7 @@ def __init__(self, version: Version, payload: Dict[str, Any]): self.segment_count: Optional[int] = deserialize.integer( payload.get("segment_count") ) - self.segments: Optional[List[Dict[str, object]]] = payload.get("segments") + self.segments: Optional[List[object]] = payload.get("segments") def __repr__(self) -> str: """ diff --git a/twilio/rest/flex_api/v1/insights_questionnaires.py b/twilio/rest/flex_api/v1/insights_questionnaires.py index f4fedcbe33..d65c33aaf4 100644 --- a/twilio/rest/flex_api/v1/insights_questionnaires.py +++ b/twilio/rest/flex_api/v1/insights_questionnaires.py @@ -47,7 +47,7 @@ def __init__( self.name: Optional[str] = payload.get("name") self.description: Optional[str] = payload.get("description") self.active: Optional[bool] = payload.get("active") - self.questions: Optional[List[Dict[str, object]]] = payload.get("questions") + self.questions: Optional[List[object]] = payload.get("questions") self.url: Optional[str] = payload.get("url") self._solution = { @@ -441,7 +441,6 @@ def create( :returns: The created InsightsQuestionnairesInstance """ - data = values.of( { "Name": name, @@ -455,7 +454,6 @@ def create( "Authorization": authorization, } ) - payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -481,7 +479,6 @@ async def create_async( :returns: The created InsightsQuestionnairesInstance """ - data = values.of( { "Name": name, @@ -495,7 +492,6 @@ async def create_async( "Authorization": authorization, } ) - payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/flex_api/v1/insights_questionnaires_category.py b/twilio/rest/flex_api/v1/insights_questionnaires_category.py index 659e10ec6b..74a05e68b3 100644 --- a/twilio/rest/flex_api/v1/insights_questionnaires_category.py +++ b/twilio/rest/flex_api/v1/insights_questionnaires_category.py @@ -303,7 +303,6 @@ def create( :returns: The created InsightsQuestionnairesCategoryInstance """ - data = values.of( { "Name": name, @@ -314,7 +313,6 @@ def create( "Authorization": authorization, } ) - payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -332,7 +330,6 @@ async def create_async( :returns: The created InsightsQuestionnairesCategoryInstance """ - data = values.of( { "Name": name, @@ -343,7 +340,6 @@ async def create_async( "Authorization": authorization, } ) - payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/flex_api/v1/insights_questionnaires_question.py b/twilio/rest/flex_api/v1/insights_questionnaires_question.py index b8d1fe4251..78739bbcbb 100644 --- a/twilio/rest/flex_api/v1/insights_questionnaires_question.py +++ b/twilio/rest/flex_api/v1/insights_questionnaires_question.py @@ -381,7 +381,6 @@ def create( :returns: The created InsightsQuestionnairesQuestionInstance """ - data = values.of( { "CategorySid": category_sid, @@ -396,7 +395,6 @@ def create( "Authorization": authorization, } ) - payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -424,7 +422,6 @@ async def create_async( :returns: The created InsightsQuestionnairesQuestionInstance """ - data = values.of( { "CategorySid": category_sid, @@ -439,7 +436,6 @@ async def create_async( "Authorization": authorization, } ) - payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) 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 46762d48af..4a38d3b137 100644 --- a/twilio/rest/flex_api/v1/insights_settings_answer_sets.py +++ b/twilio/rest/flex_api/v1/insights_settings_answer_sets.py @@ -13,8 +13,7 @@ """ -from typing import Any, Dict, Optional, Union -from twilio.base import values +from typing import Any, Dict, Optional from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -64,43 +63,23 @@ def __init__(self, version: Version): self._uri = "/Insights/QualityManagement/Settings/AnswerSets" - def fetch( - self, authorization: Union[str, object] = values.unset - ) -> InsightsSettingsAnswerSetsInstance: + def fetch(self) -> InsightsSettingsAnswerSetsInstance: """ Asynchronously fetch the InsightsSettingsAnswerSetsInstance - :param authorization: The Authorization HTTP request header :returns: The fetched InsightsSettingsAnswerSetsInstance """ - headers = values.of( - { - "Authorization": authorization, - } - ) - - payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) + payload = self._version.fetch(method="GET", uri=self._uri) return InsightsSettingsAnswerSetsInstance(self._version, payload) - async def fetch_async( - self, authorization: Union[str, object] = values.unset - ) -> InsightsSettingsAnswerSetsInstance: + async def fetch_async(self) -> InsightsSettingsAnswerSetsInstance: """ Asynchronously fetch the InsightsSettingsAnswerSetsInstance - :param authorization: The Authorization HTTP request header :returns: The fetched InsightsSettingsAnswerSetsInstance """ - headers = values.of( - { - "Authorization": authorization, - } - ) - - payload = await self._version.fetch_async( - method="GET", uri=self._uri, headers=headers - ) + payload = await self._version.fetch_async(method="GET", uri=self._uri) return InsightsSettingsAnswerSetsInstance(self._version, payload) diff --git a/twilio/rest/flex_api/v1/insights_settings_comment.py b/twilio/rest/flex_api/v1/insights_settings_comment.py index 92b135e85e..681dc5800d 100644 --- a/twilio/rest/flex_api/v1/insights_settings_comment.py +++ b/twilio/rest/flex_api/v1/insights_settings_comment.py @@ -13,8 +13,7 @@ """ -from typing import Any, Dict, Optional, Union -from twilio.base import values +from typing import Any, Dict, Optional from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -58,43 +57,23 @@ def __init__(self, version: Version): self._uri = "/Insights/QualityManagement/Settings/CommentTags" - def fetch( - self, authorization: Union[str, object] = values.unset - ) -> InsightsSettingsCommentInstance: + def fetch(self) -> InsightsSettingsCommentInstance: """ Asynchronously fetch the InsightsSettingsCommentInstance - :param authorization: The Authorization HTTP request header :returns: The fetched InsightsSettingsCommentInstance """ - headers = values.of( - { - "Authorization": authorization, - } - ) - - payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) + payload = self._version.fetch(method="GET", uri=self._uri) return InsightsSettingsCommentInstance(self._version, payload) - async def fetch_async( - self, authorization: Union[str, object] = values.unset - ) -> InsightsSettingsCommentInstance: + async def fetch_async(self) -> InsightsSettingsCommentInstance: """ Asynchronously fetch the InsightsSettingsCommentInstance - :param authorization: The Authorization HTTP request header :returns: The fetched InsightsSettingsCommentInstance """ - headers = values.of( - { - "Authorization": authorization, - } - ) - - payload = await self._version.fetch_async( - method="GET", uri=self._uri, headers=headers - ) + payload = await self._version.fetch_async(method="GET", uri=self._uri) return InsightsSettingsCommentInstance(self._version, payload) diff --git a/twilio/rest/flex_api/v1/interaction/__init__.py b/twilio/rest/flex_api/v1/interaction/__init__.py index 7d81b3f019..40fe054fdf 100644 --- a/twilio/rest/flex_api/v1/interaction/__init__.py +++ b/twilio/rest/flex_api/v1/interaction/__init__.py @@ -210,7 +210,6 @@ def create( :returns: The created InteractionInstance """ - data = values.of( { "Channel": serialize.object(channel), @@ -242,7 +241,6 @@ async def create_async( :returns: The created InteractionInstance """ - data = values.of( { "Channel": serialize.object(channel), 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 899c78593a..b585176ec9 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 @@ -116,7 +116,6 @@ def create(self, routing: object) -> InteractionChannelInviteInstance: :returns: The created InteractionChannelInviteInstance """ - data = values.of( { "Routing": serialize.object(routing), @@ -144,7 +143,6 @@ async def create_async(self, routing: object) -> InteractionChannelInviteInstanc :returns: The created InteractionChannelInviteInstance """ - data = values.of( { "Routing": serialize.object(routing), 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 6aa291d80b..761516f9fa 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 @@ -279,7 +279,6 @@ def create( :returns: The created InteractionChannelParticipantInstance """ - data = values.of( { "Type": type, @@ -313,7 +312,6 @@ async def create_async( :returns: The created InteractionChannelParticipantInstance """ - data = values.of( { "Type": type, diff --git a/twilio/rest/flex_api/v1/web_channel.py b/twilio/rest/flex_api/v1/web_channel.py index 79910f9326..436c0be8b2 100644 --- a/twilio/rest/flex_api/v1/web_channel.py +++ b/twilio/rest/flex_api/v1/web_channel.py @@ -349,7 +349,6 @@ def create( :returns: The created WebChannelInstance """ - data = values.of( { "FlexFlowSid": flex_flow_sid, @@ -390,7 +389,6 @@ async def create_async( :returns: The created WebChannelInstance """ - data = values.of( { "FlexFlowSid": flex_flow_sid, diff --git a/twilio/rest/flex_api/v2/web_channels.py b/twilio/rest/flex_api/v2/web_channels.py index 56c0fc2188..b8953bd651 100644 --- a/twilio/rest/flex_api/v2/web_channels.py +++ b/twilio/rest/flex_api/v2/web_channels.py @@ -73,7 +73,6 @@ def create( :returns: The created WebChannelsInstance """ - data = values.of( { "AddressSid": address_sid, @@ -108,7 +107,6 @@ async def create_async( :returns: The created WebChannelsInstance """ - data = values.of( { "AddressSid": address_sid, diff --git a/twilio/rest/insights/v1/call/annotation.py b/twilio/rest/insights/v1/call/annotation.py index a282dcbba0..acb2567549 100644 --- a/twilio/rest/insights/v1/call/annotation.py +++ b/twilio/rest/insights/v1/call/annotation.py @@ -45,7 +45,7 @@ class ConnectivityIssue(object): :ivar call_score: Specifies the Call Score, if available. This is of type integer. Use a range of 1-5 to indicate the call experience score, with the following mapping as a reference for rating the call [5: Excellent, 4: Good, 3 : Fair, 2 : Poor, 1: Bad]. :ivar comment: Specifies any comments pertaining to the call. Twilio does not treat this field as PII, so no PII should be included in comments. :ivar incident: Incident or support ticket associated with this call. The `incident` property is of type string with a maximum character limit of 100. Twilio does not treat this field as PII, so no PII should be included in `incident`. - :ivar url: + :ivar url: The URL of this resource. """ def __init__(self, version: Version, payload: Dict[str, Any], call_sid: str): diff --git a/twilio/rest/intelligence/v2/service.py b/twilio/rest/intelligence/v2/service.py index 870f102000..ae63037ed0 100644 --- a/twilio/rest/intelligence/v2/service.py +++ b/twilio/rest/intelligence/v2/service.py @@ -34,7 +34,7 @@ class HttpMethod(object): :ivar auto_redaction: Instructs the Speech Recognition service to automatically redact PII from all transcripts made on this service. :ivar 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. :ivar auto_transcribe: Instructs the Speech Recognition service to automatically transcribe all recordings made on the account. - :ivar 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. + :ivar data_logging: Data logging allows Twilio to improve the quality of the speech recognition through using customer data to refine its speech recognition models. :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. @@ -148,7 +148,7 @@ def update( :param if_match: The If-Match HTTP request header :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 data_logging: Data logging allows Twilio to improve the quality of the speech recognition through using customer data to refine its speech recognition models. :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. @@ -190,7 +190,7 @@ async def update_async( :param if_match: The If-Match HTTP request header :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 data_logging: Data logging allows Twilio to improve the quality of the speech recognition through using customer data to refine its speech recognition models. :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. @@ -320,7 +320,7 @@ def update( :param if_match: The If-Match HTTP request header :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 data_logging: Data logging allows Twilio to improve the quality of the speech recognition through using customer data to refine its speech recognition models. :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. @@ -374,7 +374,7 @@ async def update_async( :param if_match: The If-Match HTTP request header :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 data_logging: Data logging allows Twilio to improve the quality of the speech recognition through using customer data to refine its speech recognition models. :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. @@ -467,7 +467,7 @@ def create( :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_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 data_logging: Data logging allows Twilio to improve the quality of the speech recognition through using customer data to refine its speech recognition models. :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 auto_redaction: Instructs the Speech Recognition service to automatically redact PII from all transcripts made on this service. @@ -477,7 +477,6 @@ def create( :returns: The created ServiceInstance """ - data = values.of( { "UniqueName": unique_name, @@ -517,7 +516,7 @@ async def create_async( :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_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 data_logging: Data logging allows Twilio to improve the quality of the speech recognition through using customer data to refine its speech recognition models. :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 auto_redaction: Instructs the Speech Recognition service to automatically redact PII from all transcripts made on this service. @@ -527,7 +526,6 @@ async def create_async( :returns: The created ServiceInstance """ - data = values.of( { "UniqueName": unique_name, diff --git a/twilio/rest/intelligence/v2/transcript/__init__.py b/twilio/rest/intelligence/v2/transcript/__init__.py index 3a113434a5..7b479526cb 100644 --- a/twilio/rest/intelligence/v2/transcript/__init__.py +++ b/twilio/rest/intelligence/v2/transcript/__init__.py @@ -42,7 +42,7 @@ class Status(object): :ivar date_updated: The date that this Transcript was updated, given in ISO 8601 format. :ivar status: :ivar channel: Media Channel describing Transcript Source and Participant Mapping - :ivar 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. + :ivar data_logging: Data logging allows Twilio to improve the quality of the speech recognition through using customer data to refine its speech recognition models. :ivar language_code: The default language code of the audio. :ivar customer_key: :ivar media_start_time: The date that this Transcript's media was started, given in ISO 8601 format. @@ -341,7 +341,6 @@ def create( :returns: The created TranscriptInstance """ - data = values.of( { "ServiceSid": service_sid, @@ -376,7 +375,6 @@ async def create_async( :returns: The created TranscriptInstance """ - data = values.of( { "ServiceSid": service_sid, diff --git a/twilio/rest/intelligence/v2/transcript/operator_result.py b/twilio/rest/intelligence/v2/transcript/operator_result.py index 3a381333cf..662828ce51 100644 --- a/twilio/rest/intelligence/v2/transcript/operator_result.py +++ b/twilio/rest/intelligence/v2/transcript/operator_result.py @@ -43,7 +43,6 @@ class OperatorType(object): :ivar predicted_probability: Percentage of 'matching' class needed to consider a sentence matches. :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 transcript_sid: A 34 character string that uniquely identifies this Transcript. :ivar url: The URL of this resource. """ @@ -67,7 +66,7 @@ def __init__( payload.get("match_probability") ) self.normalized_result: Optional[str] = payload.get("normalized_result") - self.utterance_results: Optional[List[Dict[str, object]]] = payload.get( + self.utterance_results: Optional[List[object]] = payload.get( "utterance_results" ) self.utterance_match: Optional[bool] = payload.get("utterance_match") @@ -81,9 +80,6 @@ def __init__( self.extract_results: Optional[Dict[str, object]] = payload.get( "extract_results" ) - self.text_generation_results: Optional[Dict[str, object]] = payload.get( - "text_generation_results" - ) self.transcript_sid: Optional[str] = payload.get("transcript_sid") self.url: Optional[str] = payload.get("url") diff --git a/twilio/rest/ip_messaging/v1/credential.py b/twilio/rest/ip_messaging/v1/credential.py index f13fd814f2..6a193aa1f4 100644 --- a/twilio/rest/ip_messaging/v1/credential.py +++ b/twilio/rest/ip_messaging/v1/credential.py @@ -405,7 +405,6 @@ def create( :returns: The created CredentialInstance """ - data = values.of( { "Type": type, @@ -449,7 +448,6 @@ async def create_async( :returns: The created CredentialInstance """ - data = values.of( { "Type": type, diff --git a/twilio/rest/ip_messaging/v1/service/__init__.py b/twilio/rest/ip_messaging/v1/service/__init__.py index 4a2d139391..c07b4cc252 100644 --- a/twilio/rest/ip_messaging/v1/service/__init__.py +++ b/twilio/rest/ip_messaging/v1/service/__init__.py @@ -1062,7 +1062,6 @@ def create(self, friendly_name: str) -> ServiceInstance: :returns: The created ServiceInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -1085,7 +1084,6 @@ async def create_async(self, friendly_name: str) -> ServiceInstance: :returns: The created ServiceInstance """ - data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/ip_messaging/v1/service/channel/__init__.py b/twilio/rest/ip_messaging/v1/service/channel/__init__.py index c525b08065..32961bcff0 100644 --- a/twilio/rest/ip_messaging/v1/service/channel/__init__.py +++ b/twilio/rest/ip_messaging/v1/service/channel/__init__.py @@ -472,7 +472,6 @@ def create( :returns: The created ChannelInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -509,7 +508,6 @@ async def create_async( :returns: The created ChannelInstance """ - data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/ip_messaging/v1/service/channel/invite.py b/twilio/rest/ip_messaging/v1/service/channel/invite.py index 0ccb06dfef..476e89f4c2 100644 --- a/twilio/rest/ip_messaging/v1/service/channel/invite.py +++ b/twilio/rest/ip_messaging/v1/service/channel/invite.py @@ -288,7 +288,6 @@ def create( :returns: The created InviteInstance """ - data = values.of( { "Identity": identity, @@ -320,7 +319,6 @@ async def create_async( :returns: The created InviteInstance """ - data = values.of( { "Identity": identity, diff --git a/twilio/rest/ip_messaging/v1/service/channel/member.py b/twilio/rest/ip_messaging/v1/service/channel/member.py index 0c6742f683..2414e72c93 100644 --- a/twilio/rest/ip_messaging/v1/service/channel/member.py +++ b/twilio/rest/ip_messaging/v1/service/channel/member.py @@ -398,7 +398,6 @@ def create( :returns: The created MemberInstance """ - data = values.of( { "Identity": identity, @@ -430,7 +429,6 @@ async def create_async( :returns: The created MemberInstance """ - data = values.of( { "Identity": identity, diff --git a/twilio/rest/ip_messaging/v1/service/channel/message.py b/twilio/rest/ip_messaging/v1/service/channel/message.py index 462cb94cf0..e562faafb6 100644 --- a/twilio/rest/ip_messaging/v1/service/channel/message.py +++ b/twilio/rest/ip_messaging/v1/service/channel/message.py @@ -405,7 +405,6 @@ def create( :returns: The created MessageInstance """ - data = values.of( { "Body": body, @@ -442,7 +441,6 @@ async def create_async( :returns: The created MessageInstance """ - data = values.of( { "Body": body, diff --git a/twilio/rest/ip_messaging/v1/service/role.py b/twilio/rest/ip_messaging/v1/service/role.py index 6767e23160..e637e2c900 100644 --- a/twilio/rest/ip_messaging/v1/service/role.py +++ b/twilio/rest/ip_messaging/v1/service/role.py @@ -350,7 +350,6 @@ def create( :returns: The created RoleInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -381,7 +380,6 @@ async def create_async( :returns: The created RoleInstance """ - data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/ip_messaging/v1/service/user/__init__.py b/twilio/rest/ip_messaging/v1/service/user/__init__.py index ffcd24e782..e19eb82be6 100644 --- a/twilio/rest/ip_messaging/v1/service/user/__init__.py +++ b/twilio/rest/ip_messaging/v1/service/user/__init__.py @@ -423,7 +423,6 @@ def create( :returns: The created UserInstance """ - data = values.of( { "Identity": identity, @@ -460,7 +459,6 @@ async def create_async( :returns: The created UserInstance """ - data = values.of( { "Identity": identity, diff --git a/twilio/rest/ip_messaging/v2/credential.py b/twilio/rest/ip_messaging/v2/credential.py index ab21588e34..3d72b3a0d6 100644 --- a/twilio/rest/ip_messaging/v2/credential.py +++ b/twilio/rest/ip_messaging/v2/credential.py @@ -405,7 +405,6 @@ def create( :returns: The created CredentialInstance """ - data = values.of( { "Type": type, @@ -449,7 +448,6 @@ async def create_async( :returns: The created CredentialInstance """ - data = values.of( { "Type": type, diff --git a/twilio/rest/ip_messaging/v2/service/__init__.py b/twilio/rest/ip_messaging/v2/service/__init__.py index 4e96b3b2d6..b94def1fa6 100644 --- a/twilio/rest/ip_messaging/v2/service/__init__.py +++ b/twilio/rest/ip_messaging/v2/service/__init__.py @@ -823,7 +823,6 @@ def create(self, friendly_name: str) -> ServiceInstance: :returns: The created ServiceInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -846,7 +845,6 @@ async def create_async(self, friendly_name: str) -> ServiceInstance: :returns: The created ServiceInstance """ - data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/ip_messaging/v2/service/channel/__init__.py b/twilio/rest/ip_messaging/v2/service/channel/__init__.py index 6f306290f3..6e62c31093 100644 --- a/twilio/rest/ip_messaging/v2/service/channel/__init__.py +++ b/twilio/rest/ip_messaging/v2/service/channel/__init__.py @@ -604,7 +604,6 @@ def create( :returns: The created ChannelInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -621,7 +620,6 @@ def create( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) - payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -657,7 +655,6 @@ async def create_async( :returns: The created ChannelInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -674,7 +671,6 @@ async def create_async( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) - payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/ip_messaging/v2/service/channel/invite.py b/twilio/rest/ip_messaging/v2/service/channel/invite.py index 71ef25df61..aeb07b7b92 100644 --- a/twilio/rest/ip_messaging/v2/service/channel/invite.py +++ b/twilio/rest/ip_messaging/v2/service/channel/invite.py @@ -288,7 +288,6 @@ def create( :returns: The created InviteInstance """ - data = values.of( { "Identity": identity, @@ -320,7 +319,6 @@ async def create_async( :returns: The created InviteInstance """ - data = values.of( { "Identity": identity, diff --git a/twilio/rest/ip_messaging/v2/service/channel/member.py b/twilio/rest/ip_messaging/v2/service/channel/member.py index 6b3aa44f67..823c37b6df 100644 --- a/twilio/rest/ip_messaging/v2/service/channel/member.py +++ b/twilio/rest/ip_messaging/v2/service/channel/member.py @@ -531,7 +531,6 @@ def create( :returns: The created MemberInstance """ - data = values.of( { "Identity": identity, @@ -550,7 +549,6 @@ def create( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) - payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -589,7 +587,6 @@ async def create_async( :returns: The created MemberInstance """ - data = values.of( { "Identity": identity, @@ -608,7 +605,6 @@ async def create_async( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) - payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/ip_messaging/v2/service/channel/message.py b/twilio/rest/ip_messaging/v2/service/channel/message.py index 64c4ba977e..c2401c53f9 100644 --- a/twilio/rest/ip_messaging/v2/service/channel/message.py +++ b/twilio/rest/ip_messaging/v2/service/channel/message.py @@ -535,7 +535,6 @@ def create( :returns: The created MessageInstance """ - data = values.of( { "From": from_, @@ -552,7 +551,6 @@ def create( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) - payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -591,7 +589,6 @@ async def create_async( :returns: The created MessageInstance """ - data = values.of( { "From": from_, @@ -608,7 +605,6 @@ async def create_async( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) - payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/ip_messaging/v2/service/channel/webhook.py b/twilio/rest/ip_messaging/v2/service/channel/webhook.py index c5c2879b20..077bbfa8e4 100644 --- a/twilio/rest/ip_messaging/v2/service/channel/webhook.py +++ b/twilio/rest/ip_messaging/v2/service/channel/webhook.py @@ -466,7 +466,6 @@ def create( :returns: The created WebhookInstance """ - data = values.of( { "Type": type, @@ -519,7 +518,6 @@ async def create_async( :returns: The created WebhookInstance """ - data = values.of( { "Type": type, diff --git a/twilio/rest/ip_messaging/v2/service/role.py b/twilio/rest/ip_messaging/v2/service/role.py index 2a39101b37..c8e3b95611 100644 --- a/twilio/rest/ip_messaging/v2/service/role.py +++ b/twilio/rest/ip_messaging/v2/service/role.py @@ -350,7 +350,6 @@ def create( :returns: The created RoleInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -381,7 +380,6 @@ async def create_async( :returns: The created RoleInstance """ - data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/ip_messaging/v2/service/user/__init__.py b/twilio/rest/ip_messaging/v2/service/user/__init__.py index 5b632c125e..1f11793877 100644 --- a/twilio/rest/ip_messaging/v2/service/user/__init__.py +++ b/twilio/rest/ip_messaging/v2/service/user/__init__.py @@ -476,7 +476,6 @@ def create( :returns: The created UserInstance """ - data = values.of( { "Identity": identity, @@ -490,7 +489,6 @@ def create( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) - payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -520,7 +518,6 @@ async def create_async( :returns: The created UserInstance """ - data = values.of( { "Identity": identity, @@ -534,7 +531,6 @@ async def create_async( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) - payload = await self._version.create_async( method="POST", uri=self._uri, data=data, headers=headers ) diff --git a/twilio/rest/media/v1/media_processor.py b/twilio/rest/media/v1/media_processor.py index da4a3b0c93..16ac32aa2f 100644 --- a/twilio/rest/media/v1/media_processor.py +++ b/twilio/rest/media/v1/media_processor.py @@ -316,7 +316,6 @@ def create( :returns: The created MediaProcessorInstance """ - data = values.of( { "Extension": extension, @@ -357,7 +356,6 @@ async def create_async( :returns: The created MediaProcessorInstance """ - data = values.of( { "Extension": extension, diff --git a/twilio/rest/media/v1/player_streamer/__init__.py b/twilio/rest/media/v1/player_streamer/__init__.py index 1d91e86a44..6bc535cdfa 100644 --- a/twilio/rest/media/v1/player_streamer/__init__.py +++ b/twilio/rest/media/v1/player_streamer/__init__.py @@ -343,7 +343,6 @@ def create( :returns: The created PlayerStreamerInstance """ - data = values.of( { "Video": video, @@ -378,7 +377,6 @@ async def create_async( :returns: The created PlayerStreamerInstance """ - data = values.of( { "Video": video, diff --git a/twilio/rest/messaging/v1/brand_registration/__init__.py b/twilio/rest/messaging/v1/brand_registration/__init__.py index de54a2f2a8..68a669e3ce 100644 --- a/twilio/rest/messaging/v1/brand_registration/__init__.py +++ b/twilio/rest/messaging/v1/brand_registration/__init__.py @@ -373,7 +373,6 @@ def create( :returns: The created BrandRegistrationInstance """ - data = values.of( { "CustomerProfileBundleSid": customer_profile_bundle_sid, @@ -411,7 +410,6 @@ async def create_async( :returns: The created BrandRegistrationInstance """ - data = values.of( { "CustomerProfileBundleSid": customer_profile_bundle_sid, diff --git a/twilio/rest/messaging/v1/brand_registration/brand_vetting.py b/twilio/rest/messaging/v1/brand_registration/brand_vetting.py index cc00fbc9ed..2fff9ebbed 100644 --- a/twilio/rest/messaging/v1/brand_registration/brand_vetting.py +++ b/twilio/rest/messaging/v1/brand_registration/brand_vetting.py @@ -240,7 +240,6 @@ def create( :returns: The created BrandVettingInstance """ - data = values.of( { "VettingProvider": vetting_provider, @@ -271,7 +270,6 @@ async def create_async( :returns: The created BrandVettingInstance """ - data = values.of( { "VettingProvider": vetting_provider, diff --git a/twilio/rest/messaging/v1/external_campaign.py b/twilio/rest/messaging/v1/external_campaign.py index ce232e9cf9..53af9869d3 100644 --- a/twilio/rest/messaging/v1/external_campaign.py +++ b/twilio/rest/messaging/v1/external_campaign.py @@ -76,7 +76,6 @@ def create( :returns: The created ExternalCampaignInstance """ - data = values.of( { "CampaignId": campaign_id, @@ -103,7 +102,6 @@ async def create_async( :returns: The created ExternalCampaignInstance """ - data = values.of( { "CampaignId": campaign_id, diff --git a/twilio/rest/messaging/v1/service/__init__.py b/twilio/rest/messaging/v1/service/__init__.py index 4d23155880..d1772d7d76 100644 --- a/twilio/rest/messaging/v1/service/__init__.py +++ b/twilio/rest/messaging/v1/service/__init__.py @@ -724,7 +724,6 @@ def create( :returns: The created ServiceInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -797,7 +796,6 @@ async def create_async( :returns: The created ServiceInstance """ - data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/messaging/v1/service/alpha_sender.py b/twilio/rest/messaging/v1/service/alpha_sender.py index 9dca85f801..92d81e9fc4 100644 --- a/twilio/rest/messaging/v1/service/alpha_sender.py +++ b/twilio/rest/messaging/v1/service/alpha_sender.py @@ -265,7 +265,6 @@ def create(self, alpha_sender: str) -> AlphaSenderInstance: :returns: The created AlphaSenderInstance """ - data = values.of( { "AlphaSender": alpha_sender, @@ -290,7 +289,6 @@ async def create_async(self, alpha_sender: str) -> AlphaSenderInstance: :returns: The created AlphaSenderInstance """ - data = values.of( { "AlphaSender": alpha_sender, diff --git a/twilio/rest/messaging/v1/service/channel_sender.py b/twilio/rest/messaging/v1/service/channel_sender.py index 17a147dd16..579c6d39fd 100644 --- a/twilio/rest/messaging/v1/service/channel_sender.py +++ b/twilio/rest/messaging/v1/service/channel_sender.py @@ -34,7 +34,7 @@ class ChannelSenderInstance(InstanceResource): :ivar country_code: The 2-character [ISO Country Code](https://www.iso.org/iso-3166-country-codes.html) of the number. :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 ChannelSender resource. + :ivar url: """ def __init__( diff --git a/twilio/rest/messaging/v1/service/phone_number.py b/twilio/rest/messaging/v1/service/phone_number.py index daafa6d788..c01c76a3b7 100644 --- a/twilio/rest/messaging/v1/service/phone_number.py +++ b/twilio/rest/messaging/v1/service/phone_number.py @@ -267,7 +267,6 @@ def create(self, phone_number_sid: str) -> PhoneNumberInstance: :returns: The created PhoneNumberInstance """ - data = values.of( { "PhoneNumberSid": phone_number_sid, @@ -292,7 +291,6 @@ async def create_async(self, phone_number_sid: str) -> PhoneNumberInstance: :returns: The created PhoneNumberInstance """ - data = values.of( { "PhoneNumberSid": phone_number_sid, diff --git a/twilio/rest/messaging/v1/service/short_code.py b/twilio/rest/messaging/v1/service/short_code.py index dbc24cea3f..104f03f6ec 100644 --- a/twilio/rest/messaging/v1/service/short_code.py +++ b/twilio/rest/messaging/v1/service/short_code.py @@ -265,7 +265,6 @@ def create(self, short_code_sid: str) -> ShortCodeInstance: :returns: The created ShortCodeInstance """ - data = values.of( { "ShortCodeSid": short_code_sid, @@ -290,7 +289,6 @@ async def create_async(self, short_code_sid: str) -> ShortCodeInstance: :returns: The created ShortCodeInstance """ - data = values.of( { "ShortCodeSid": short_code_sid, 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 5e89c8384a..7ccb534319 100644 --- a/twilio/rest/messaging/v1/service/us_app_to_person.py +++ b/twilio/rest/messaging/v1/service/us_app_to_person.py @@ -96,7 +96,7 @@ def __init__( ) self.url: Optional[str] = payload.get("url") self.mock: Optional[bool] = payload.get("mock") - self.errors: Optional[List[Dict[str, object]]] = payload.get("errors") + self.errors: Optional[List[object]] = payload.get("errors") self._solution = { "messaging_service_sid": messaging_service_sid, @@ -336,7 +336,6 @@ def create( :returns: The created UsAppToPersonInstance """ - data = values.of( { "BrandRegistrationSid": brand_registration_sid, @@ -402,7 +401,6 @@ async def create_async( :returns: The created UsAppToPersonInstance """ - data = values.of( { "BrandRegistrationSid": brand_registration_sid, 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 60b8757038..0c25e6892c 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 @@ -13,8 +13,7 @@ """ -from typing import Any, Dict, List, Optional, Union -from twilio.base import values +from typing import Any, Dict, List, Optional from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -32,7 +31,7 @@ def __init__( ): super().__init__(version) - self.us_app_to_person_usecases: Optional[List[Dict[str, object]]] = payload.get( + self.us_app_to_person_usecases: Optional[List[object]] = payload.get( "us_app_to_person_usecases" ) @@ -71,22 +70,13 @@ def __init__(self, version: Version, messaging_service_sid: str): ) ) - def fetch( - self, brand_registration_sid: Union[str, object] = values.unset - ) -> UsAppToPersonUsecaseInstance: + def fetch(self) -> UsAppToPersonUsecaseInstance: """ Asynchronously fetch the UsAppToPersonUsecaseInstance - :param brand_registration_sid: The unique string to identify the A2P brand. :returns: The fetched UsAppToPersonUsecaseInstance """ - - params = values.of( - { - "BrandRegistrationSid": brand_registration_sid, - } - ) - payload = self._version.fetch(method="GET", uri=self._uri, params=params) + payload = self._version.fetch(method="GET", uri=self._uri) return UsAppToPersonUsecaseInstance( self._version, @@ -94,24 +84,13 @@ def fetch( messaging_service_sid=self._solution["messaging_service_sid"], ) - async def fetch_async( - self, brand_registration_sid: Union[str, object] = values.unset - ) -> UsAppToPersonUsecaseInstance: + async def fetch_async(self) -> UsAppToPersonUsecaseInstance: """ Asynchronously fetch the UsAppToPersonUsecaseInstance - :param brand_registration_sid: The unique string to identify the A2P brand. :returns: The fetched UsAppToPersonUsecaseInstance """ - - params = values.of( - { - "BrandRegistrationSid": brand_registration_sid, - } - ) - payload = await self._version.fetch_async( - method="GET", uri=self._uri, params=params - ) + payload = await self._version.fetch_async(method="GET", uri=self._uri) return UsAppToPersonUsecaseInstance( self._version, diff --git a/twilio/rest/messaging/v1/tollfree_verification.py b/twilio/rest/messaging/v1/tollfree_verification.py index 83c0df1a49..47b73d7da6 100644 --- a/twilio/rest/messaging/v1/tollfree_verification.py +++ b/twilio/rest/messaging/v1/tollfree_verification.py @@ -71,7 +71,6 @@ class Status(object): :ivar rejection_reason: The rejection reason given when a Tollfree Verification has been rejected. :ivar error_code: The error code given when a Tollfree Verification has been rejected. :ivar edit_expiration: The date and time when the ability to edit a rejected verification expires. - :ivar edit_allowed: If a rejected verification is allowed to be edited/resubmitted. Some rejection reasons allow editing and some do not. :ivar resource_links: The URLs of the documents associated with the Tollfree Verification resource. :ivar external_reference_id: An optional external reference ID supplied by customer and echoed back on status retrieval. """ @@ -146,7 +145,6 @@ def __init__( self.edit_expiration: Optional[datetime] = deserialize.iso8601_datetime( payload.get("edit_expiration") ) - self.edit_allowed: Optional[bool] = payload.get("edit_allowed") self.resource_links: Optional[Dict[str, object]] = payload.get("resource_links") self.external_reference_id: Optional[str] = payload.get("external_reference_id") @@ -170,24 +168,6 @@ def _proxy(self) -> "TollfreeVerificationContext": ) return self._context - def delete(self) -> bool: - """ - Deletes the TollfreeVerificationInstance - - - :returns: True if delete succeeds, False otherwise - """ - return self._proxy.delete() - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the TollfreeVerificationInstance - - - :returns: True if delete succeeds, False otherwise - """ - return await self._proxy.delete_async() - def fetch(self) -> "TollfreeVerificationInstance": """ Fetch the TollfreeVerificationInstance @@ -230,7 +210,6 @@ def update( 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, - edit_reason: Union[str, object] = values.unset, ) -> "TollfreeVerificationInstance": """ Update the TollfreeVerificationInstance @@ -255,7 +234,6 @@ def update( :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 edit_reason: Describe why the verification is being edited. If the verification was rejected because of a technical issue, such as the website being down, and the issue has been resolved this parameter should be set to something similar to 'Website fixed'. :returns: The updated TollfreeVerificationInstance """ @@ -280,7 +258,6 @@ def update( business_contact_last_name=business_contact_last_name, business_contact_email=business_contact_email, business_contact_phone=business_contact_phone, - edit_reason=edit_reason, ) async def update_async( @@ -307,7 +284,6 @@ async def update_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, - edit_reason: Union[str, object] = values.unset, ) -> "TollfreeVerificationInstance": """ Asynchronous coroutine to update the TollfreeVerificationInstance @@ -332,7 +308,6 @@ async def update_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 edit_reason: Describe why the verification is being edited. If the verification was rejected because of a technical issue, such as the website being down, and the issue has been resolved this parameter should be set to something similar to 'Website fixed'. :returns: The updated TollfreeVerificationInstance """ @@ -357,7 +332,6 @@ async def update_async( business_contact_last_name=business_contact_last_name, business_contact_email=business_contact_email, business_contact_phone=business_contact_phone, - edit_reason=edit_reason, ) def __repr__(self) -> str: @@ -386,30 +360,6 @@ def __init__(self, version: Version, sid: str): } self._uri = "/Tollfree/Verifications/{sid}".format(**self._solution) - def delete(self) -> bool: - """ - Deletes the TollfreeVerificationInstance - - - :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 TollfreeVerificationInstance - - - :returns: True if delete succeeds, False otherwise - """ - return await self._version.delete_async( - method="DELETE", - uri=self._uri, - ) - def fetch(self) -> TollfreeVerificationInstance: """ Fetch the TollfreeVerificationInstance @@ -472,7 +422,6 @@ def update( 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, - edit_reason: Union[str, object] = values.unset, ) -> TollfreeVerificationInstance: """ Update the TollfreeVerificationInstance @@ -497,7 +446,6 @@ def update( :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 edit_reason: Describe why the verification is being edited. If the verification was rejected because of a technical issue, such as the website being down, and the issue has been resolved this parameter should be set to something similar to 'Website fixed'. :returns: The updated TollfreeVerificationInstance """ @@ -523,7 +471,6 @@ def update( "BusinessContactLastName": business_contact_last_name, "BusinessContactEmail": business_contact_email, "BusinessContactPhone": business_contact_phone, - "EditReason": edit_reason, } ) @@ -561,7 +508,6 @@ async def update_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, - edit_reason: Union[str, object] = values.unset, ) -> TollfreeVerificationInstance: """ Asynchronous coroutine to update the TollfreeVerificationInstance @@ -586,7 +532,6 @@ async def update_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 edit_reason: Describe why the verification is being edited. If the verification was rejected because of a technical issue, such as the website being down, and the issue has been resolved this parameter should be set to something similar to 'Website fixed'. :returns: The updated TollfreeVerificationInstance """ @@ -612,7 +557,6 @@ async def update_async( "BusinessContactLastName": business_contact_last_name, "BusinessContactEmail": business_contact_email, "BusinessContactPhone": business_contact_phone, - "EditReason": edit_reason, } ) @@ -721,7 +665,6 @@ def create( :returns: The created TollfreeVerificationInstance """ - data = values.of( { "BusinessName": business_name, @@ -813,7 +756,6 @@ async def create_async( :returns: The created TollfreeVerificationInstance """ - data = values.of( { "BusinessName": business_name, diff --git a/twilio/rest/messaging/v1/usecase.py b/twilio/rest/messaging/v1/usecase.py index 3fb46b4a2b..ba65e8b106 100644 --- a/twilio/rest/messaging/v1/usecase.py +++ b/twilio/rest/messaging/v1/usecase.py @@ -29,7 +29,7 @@ class UsecaseInstance(InstanceResource): def __init__(self, version: Version, payload: Dict[str, Any]): super().__init__(version) - self.usecases: Optional[List[Dict[str, object]]] = payload.get("usecases") + self.usecases: Optional[List[object]] = payload.get("usecases") def __repr__(self) -> str: """ @@ -57,10 +57,8 @@ def fetch(self) -> UsecaseInstance: """ Asynchronously fetch the UsecaseInstance - :returns: The fetched UsecaseInstance """ - payload = self._version.fetch(method="GET", uri=self._uri) return UsecaseInstance(self._version, payload) @@ -69,10 +67,8 @@ async def fetch_async(self) -> UsecaseInstance: """ Asynchronously fetch the UsecaseInstance - :returns: The fetched UsecaseInstance """ - payload = await self._version.fetch_async(method="GET", uri=self._uri) return UsecaseInstance(self._version, payload) diff --git a/twilio/rest/microvisor/v1/account_config.py b/twilio/rest/microvisor/v1/account_config.py index 459a95f25f..7d8119a3de 100644 --- a/twilio/rest/microvisor/v1/account_config.py +++ b/twilio/rest/microvisor/v1/account_config.py @@ -305,7 +305,6 @@ def create(self, key: str, value: str) -> AccountConfigInstance: :returns: The created AccountConfigInstance """ - data = values.of( { "Key": key, @@ -330,7 +329,6 @@ async def create_async(self, key: str, value: str) -> AccountConfigInstance: :returns: The created AccountConfigInstance """ - data = values.of( { "Key": key, diff --git a/twilio/rest/microvisor/v1/account_secret.py b/twilio/rest/microvisor/v1/account_secret.py index eacd4fa526..a7fc4f8969 100644 --- a/twilio/rest/microvisor/v1/account_secret.py +++ b/twilio/rest/microvisor/v1/account_secret.py @@ -303,7 +303,6 @@ def create(self, key: str, value: str) -> AccountSecretInstance: :returns: The created AccountSecretInstance """ - data = values.of( { "Key": key, @@ -328,7 +327,6 @@ async def create_async(self, key: str, value: str) -> AccountSecretInstance: :returns: The created AccountSecretInstance """ - data = values.of( { "Key": key, diff --git a/twilio/rest/microvisor/v1/device/device_config.py b/twilio/rest/microvisor/v1/device/device_config.py index 54424e800b..a954727bf0 100644 --- a/twilio/rest/microvisor/v1/device/device_config.py +++ b/twilio/rest/microvisor/v1/device/device_config.py @@ -334,7 +334,6 @@ def create(self, key: str, value: str) -> DeviceConfigInstance: :returns: The created DeviceConfigInstance """ - data = values.of( { "Key": key, @@ -361,7 +360,6 @@ async def create_async(self, key: str, value: str) -> DeviceConfigInstance: :returns: The created DeviceConfigInstance """ - data = values.of( { "Key": key, diff --git a/twilio/rest/microvisor/v1/device/device_secret.py b/twilio/rest/microvisor/v1/device/device_secret.py index 124fe0e483..7f2ee0eeb0 100644 --- a/twilio/rest/microvisor/v1/device/device_secret.py +++ b/twilio/rest/microvisor/v1/device/device_secret.py @@ -332,7 +332,6 @@ def create(self, key: str, value: str) -> DeviceSecretInstance: :returns: The created DeviceSecretInstance """ - data = values.of( { "Key": key, @@ -359,7 +358,6 @@ async def create_async(self, key: str, value: str) -> DeviceSecretInstance: :returns: The created DeviceSecretInstance """ - data = values.of( { "Key": key, diff --git a/twilio/rest/notify/v1/credential.py b/twilio/rest/notify/v1/credential.py index 61f1abd801..2b1efcf82a 100644 --- a/twilio/rest/notify/v1/credential.py +++ b/twilio/rest/notify/v1/credential.py @@ -405,7 +405,6 @@ def create( :returns: The created CredentialInstance """ - data = values.of( { "Type": type, @@ -449,7 +448,6 @@ async def create_async( :returns: The created CredentialInstance """ - data = values.of( { "Type": type, diff --git a/twilio/rest/notify/v1/service/__init__.py b/twilio/rest/notify/v1/service/__init__.py index 6aa94b6b54..fa07045470 100644 --- a/twilio/rest/notify/v1/service/__init__.py +++ b/twilio/rest/notify/v1/service/__init__.py @@ -36,7 +36,7 @@ class ServiceInstance(InstanceResource): :ivar apn_credential_sid: The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for APN Bindings. :ivar gcm_credential_sid: The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for GCM Bindings. :ivar fcm_credential_sid: The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for FCM Bindings. - :ivar messaging_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/sms/quickstart#messaging-services) to use for SMS Bindings. In order to send SMS notifications this parameter has to be set. + :ivar messaging_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/sms/send-messages#messaging-services) to use for SMS Bindings. In order to send SMS notifications this parameter has to be set. :ivar facebook_messenger_page_id: Deprecated. :ivar default_apn_notification_protocol_version: The protocol version to use for sending APNS notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. :ivar default_gcm_notification_protocol_version: The protocol version to use for sending GCM notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. @@ -171,7 +171,7 @@ def update( :param friendly_name: A descriptive string that you create to describe the resource. It can be up to 64 characters long. :param apn_credential_sid: The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for APN Bindings. :param gcm_credential_sid: The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for GCM Bindings. - :param messaging_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/sms/quickstart#messaging-services) to use for SMS Bindings. This parameter must be set in order to send SMS notifications. + :param messaging_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/sms/send-messages#messaging-services) to use for SMS Bindings. This parameter must be set in order to send SMS notifications. :param facebook_messenger_page_id: Deprecated. :param default_apn_notification_protocol_version: The protocol version to use for sending APNS notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. :param default_gcm_notification_protocol_version: The protocol version to use for sending GCM notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. @@ -225,7 +225,7 @@ async def update_async( :param friendly_name: A descriptive string that you create to describe the resource. It can be up to 64 characters long. :param apn_credential_sid: The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for APN Bindings. :param gcm_credential_sid: The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for GCM Bindings. - :param messaging_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/sms/quickstart#messaging-services) to use for SMS Bindings. This parameter must be set in order to send SMS notifications. + :param messaging_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/sms/send-messages#messaging-services) to use for SMS Bindings. This parameter must be set in order to send SMS notifications. :param facebook_messenger_page_id: Deprecated. :param default_apn_notification_protocol_version: The protocol version to use for sending APNS notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. :param default_gcm_notification_protocol_version: The protocol version to use for sending GCM notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. @@ -384,7 +384,7 @@ def update( :param friendly_name: A descriptive string that you create to describe the resource. It can be up to 64 characters long. :param apn_credential_sid: The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for APN Bindings. :param gcm_credential_sid: The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for GCM Bindings. - :param messaging_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/sms/quickstart#messaging-services) to use for SMS Bindings. This parameter must be set in order to send SMS notifications. + :param messaging_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/sms/send-messages#messaging-services) to use for SMS Bindings. This parameter must be set in order to send SMS notifications. :param facebook_messenger_page_id: Deprecated. :param default_apn_notification_protocol_version: The protocol version to use for sending APNS notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. :param default_gcm_notification_protocol_version: The protocol version to use for sending GCM notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. @@ -448,7 +448,7 @@ async def update_async( :param friendly_name: A descriptive string that you create to describe the resource. It can be up to 64 characters long. :param apn_credential_sid: The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for APN Bindings. :param gcm_credential_sid: The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for GCM Bindings. - :param messaging_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/sms/quickstart#messaging-services) to use for SMS Bindings. This parameter must be set in order to send SMS notifications. + :param messaging_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/sms/send-messages#messaging-services) to use for SMS Bindings. This parameter must be set in order to send SMS notifications. :param facebook_messenger_page_id: Deprecated. :param default_apn_notification_protocol_version: The protocol version to use for sending APNS notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. :param default_gcm_notification_protocol_version: The protocol version to use for sending GCM notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. @@ -576,7 +576,7 @@ def create( :param friendly_name: A descriptive string that you create to describe the resource. It can be up to 64 characters long. :param apn_credential_sid: The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for APN Bindings. :param gcm_credential_sid: The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for GCM Bindings. - :param messaging_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/sms/quickstart#messaging-services) to use for SMS Bindings. This parameter must be set in order to send SMS notifications. + :param messaging_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/sms/send-messages#messaging-services) to use for SMS Bindings. This parameter must be set in order to send SMS notifications. :param facebook_messenger_page_id: Deprecated. :param default_apn_notification_protocol_version: The protocol version to use for sending APNS notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. :param default_gcm_notification_protocol_version: The protocol version to use for sending GCM notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. @@ -590,7 +590,6 @@ def create( :returns: The created ServiceInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -641,7 +640,7 @@ async def create_async( :param friendly_name: A descriptive string that you create to describe the resource. It can be up to 64 characters long. :param apn_credential_sid: The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for APN Bindings. :param gcm_credential_sid: The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for GCM Bindings. - :param messaging_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/sms/quickstart#messaging-services) to use for SMS Bindings. This parameter must be set in order to send SMS notifications. + :param messaging_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/sms/send-messages#messaging-services) to use for SMS Bindings. This parameter must be set in order to send SMS notifications. :param facebook_messenger_page_id: Deprecated. :param default_apn_notification_protocol_version: The protocol version to use for sending APNS notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. :param default_gcm_notification_protocol_version: The protocol version to use for sending GCM notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. @@ -655,7 +654,6 @@ async def create_async( :returns: The created ServiceInstance """ - data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/notify/v1/service/binding.py b/twilio/rest/notify/v1/service/binding.py index 1bcb36d247..dba36be720 100644 --- a/twilio/rest/notify/v1/service/binding.py +++ b/twilio/rest/notify/v1/service/binding.py @@ -299,7 +299,6 @@ def create( :returns: The created BindingInstance """ - data = values.of( { "Identity": identity, @@ -345,7 +344,6 @@ async def create_async( :returns: The created BindingInstance """ - data = values.of( { "Identity": identity, diff --git a/twilio/rest/notify/v1/service/notification.py b/twilio/rest/notify/v1/service/notification.py index b2c1326606..980dbe633c 100644 --- a/twilio/rest/notify/v1/service/notification.py +++ b/twilio/rest/notify/v1/service/notification.py @@ -144,7 +144,7 @@ def create( :param data: The custom key-value pairs of the notification's payload. For FCM and GCM, this value translates to `data` in the FCM and GCM payloads. FCM and GCM [reserve certain keys](https://firebase.google.com/docs/cloud-messaging/http-server-ref) that cannot be used in those channels. For APNS, attributes of `data` are inserted into the APNS payload as custom properties outside of the `aps` dictionary. In all channels, we reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed and are rejected as 400 Bad request with no delivery attempted. For SMS, this parameter is not supported and is omitted from deliveries to those channels. :param apn: The APNS-specific payload that overrides corresponding attributes in the generic payload for APNS Bindings. This property maps to the APNS `Payload` item, therefore the `aps` key must be used to change standard attributes. Adds custom key-value pairs to the root of the dictionary. See the [APNS documentation](https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html) for more details. We reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed. :param gcm: The GCM-specific payload that overrides corresponding attributes in the generic payload for GCM Bindings. This property maps to the root JSON dictionary. See the [GCM documentation](https://firebase.google.com/docs/cloud-messaging/http-server-ref) for more details. Target parameters `to`, `registration_ids`, and `notification_key` are not allowed. We reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed. GCM also [reserves certain keys](https://firebase.google.com/docs/cloud-messaging/http-server-ref). - :param sms: The SMS-specific payload that overrides corresponding attributes in the generic payload for SMS Bindings. Each attribute in this value maps to the corresponding `form` parameter of the Twilio [Message](https://www.twilio.com/docs/sms/quickstart) resource. These parameters of the Message resource are supported in snake case format: `body`, `media_urls`, `status_callback`, and `max_price`. The `status_callback` parameter overrides the corresponding parameter in the messaging service, if configured. The `media_urls` property expects a JSON array. + :param sms: The SMS-specific payload that overrides corresponding attributes in the generic payload for SMS Bindings. Each attribute in this value maps to the corresponding `form` parameter of the Twilio [Message](https://www.twilio.com/docs/sms/send-messages) resource. These parameters of the Message resource are supported in snake case format: `body`, `media_urls`, `status_callback`, and `max_price`. The `status_callback` parameter overrides the corresponding parameter in the messaging service, if configured. The `media_urls` property expects a JSON array. :param facebook_messenger: Deprecated. :param fcm: The FCM-specific payload that overrides corresponding attributes in the generic payload for FCM Bindings. This property maps to the root JSON dictionary. See the [FCM documentation](https://firebase.google.com/docs/cloud-messaging/http-server-ref#downstream) for more details. Target parameters `to`, `registration_ids`, `condition`, and `notification_key` are not allowed in this parameter. We reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed. FCM also [reserves certain keys](https://firebase.google.com/docs/cloud-messaging/http-server-ref), which cannot be used in that channel. :param segment: The Segment resource is deprecated. Use the `tag` parameter, instead. @@ -156,7 +156,6 @@ def create( :returns: The created NotificationInstance """ - data = values.of( { "Body": body, @@ -223,7 +222,7 @@ async def create_async( :param data: The custom key-value pairs of the notification's payload. For FCM and GCM, this value translates to `data` in the FCM and GCM payloads. FCM and GCM [reserve certain keys](https://firebase.google.com/docs/cloud-messaging/http-server-ref) that cannot be used in those channels. For APNS, attributes of `data` are inserted into the APNS payload as custom properties outside of the `aps` dictionary. In all channels, we reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed and are rejected as 400 Bad request with no delivery attempted. For SMS, this parameter is not supported and is omitted from deliveries to those channels. :param apn: The APNS-specific payload that overrides corresponding attributes in the generic payload for APNS Bindings. This property maps to the APNS `Payload` item, therefore the `aps` key must be used to change standard attributes. Adds custom key-value pairs to the root of the dictionary. See the [APNS documentation](https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html) for more details. We reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed. :param gcm: The GCM-specific payload that overrides corresponding attributes in the generic payload for GCM Bindings. This property maps to the root JSON dictionary. See the [GCM documentation](https://firebase.google.com/docs/cloud-messaging/http-server-ref) for more details. Target parameters `to`, `registration_ids`, and `notification_key` are not allowed. We reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed. GCM also [reserves certain keys](https://firebase.google.com/docs/cloud-messaging/http-server-ref). - :param sms: The SMS-specific payload that overrides corresponding attributes in the generic payload for SMS Bindings. Each attribute in this value maps to the corresponding `form` parameter of the Twilio [Message](https://www.twilio.com/docs/sms/quickstart) resource. These parameters of the Message resource are supported in snake case format: `body`, `media_urls`, `status_callback`, and `max_price`. The `status_callback` parameter overrides the corresponding parameter in the messaging service, if configured. The `media_urls` property expects a JSON array. + :param sms: The SMS-specific payload that overrides corresponding attributes in the generic payload for SMS Bindings. Each attribute in this value maps to the corresponding `form` parameter of the Twilio [Message](https://www.twilio.com/docs/sms/send-messages) resource. These parameters of the Message resource are supported in snake case format: `body`, `media_urls`, `status_callback`, and `max_price`. The `status_callback` parameter overrides the corresponding parameter in the messaging service, if configured. The `media_urls` property expects a JSON array. :param facebook_messenger: Deprecated. :param fcm: The FCM-specific payload that overrides corresponding attributes in the generic payload for FCM Bindings. This property maps to the root JSON dictionary. See the [FCM documentation](https://firebase.google.com/docs/cloud-messaging/http-server-ref#downstream) for more details. Target parameters `to`, `registration_ids`, `condition`, and `notification_key` are not allowed in this parameter. We reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed. FCM also [reserves certain keys](https://firebase.google.com/docs/cloud-messaging/http-server-ref), which cannot be used in that channel. :param segment: The Segment resource is deprecated. Use the `tag` parameter, instead. @@ -235,7 +234,6 @@ async def create_async( :returns: The created NotificationInstance """ - data = values.of( { "Body": body, diff --git a/twilio/rest/numbers/v1/__init__.py b/twilio/rest/numbers/v1/__init__.py index a9285ae496..e7ee222a47 100644 --- a/twilio/rest/numbers/v1/__init__.py +++ b/twilio/rest/numbers/v1/__init__.py @@ -17,7 +17,6 @@ from twilio.base.domain import Domain from twilio.rest.numbers.v1.bulk_eligibility import BulkEligibilityList from twilio.rest.numbers.v1.porting_bulk_portability import PortingBulkPortabilityList -from twilio.rest.numbers.v1.porting_port_in_fetch import PortingPortInFetchList from twilio.rest.numbers.v1.porting_portability import PortingPortabilityList @@ -31,7 +30,6 @@ def __init__(self, domain: Domain): super().__init__(domain, "v1") self._bulk_eligibilities: Optional[BulkEligibilityList] = None self._porting_bulk_portabilities: Optional[PortingBulkPortabilityList] = None - self._porting_port_ins: Optional[PortingPortInFetchList] = None self._porting_portabilities: Optional[PortingPortabilityList] = None @property @@ -46,12 +44,6 @@ def porting_bulk_portabilities(self) -> PortingBulkPortabilityList: self._porting_bulk_portabilities = PortingBulkPortabilityList(self) return self._porting_bulk_portabilities - @property - def porting_port_ins(self) -> PortingPortInFetchList: - if self._porting_port_ins is None: - self._porting_port_ins = PortingPortInFetchList(self) - return self._porting_port_ins - @property def porting_portabilities(self) -> PortingPortabilityList: if self._porting_portabilities is None: diff --git a/twilio/rest/numbers/v1/bulk_eligibility.py b/twilio/rest/numbers/v1/bulk_eligibility.py index 29790371d8..805f6b1bdc 100644 --- a/twilio/rest/numbers/v1/bulk_eligibility.py +++ b/twilio/rest/numbers/v1/bulk_eligibility.py @@ -44,7 +44,7 @@ def __init__( self.request_id: Optional[str] = payload.get("request_id") self.url: Optional[str] = payload.get("url") - self.results: Optional[List[Dict[str, object]]] = payload.get("results") + self.results: Optional[List[object]] = payload.get("results") self.friendly_name: Optional[str] = payload.get("friendly_name") self.status: Optional[str] = payload.get("status") self.date_created: Optional[datetime] = deserialize.iso8601_datetime( diff --git a/twilio/rest/numbers/v1/porting_bulk_portability.py b/twilio/rest/numbers/v1/porting_bulk_portability.py index a6c037edb0..3abc24b6e7 100644 --- a/twilio/rest/numbers/v1/porting_bulk_portability.py +++ b/twilio/rest/numbers/v1/porting_bulk_portability.py @@ -48,9 +48,7 @@ def __init__( 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.phone_numbers: Optional[List[object]] = payload.get("phone_numbers") self.url: Optional[str] = payload.get("url") self._solution = { @@ -185,7 +183,6 @@ def create(self, phone_numbers: List[str]) -> PortingBulkPortabilityInstance: :returns: The created PortingBulkPortabilityInstance """ - data = values.of( { "PhoneNumbers": serialize.map(phone_numbers, lambda e: e), @@ -210,7 +207,6 @@ async def create_async( :returns: The created PortingBulkPortabilityInstance """ - data = values.of( { "PhoneNumbers": serialize.map(phone_numbers, lambda e: e), 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 b905c10e42..0000000000 --- a/twilio/rest/numbers/v1/porting_port_in_fetch.py +++ /dev/null @@ -1,219 +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 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.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/v2/authorization_document/__init__.py b/twilio/rest/numbers/v2/authorization_document/__init__.py index c40d44421d..f8ac50dcca 100644 --- a/twilio/rest/numbers/v2/authorization_document/__init__.py +++ b/twilio/rest/numbers/v2/authorization_document/__init__.py @@ -297,7 +297,6 @@ def create( :returns: The created AuthorizationDocumentInstance """ - data = values.of( { "AddressSid": address_sid, @@ -340,7 +339,6 @@ async def create_async( :returns: The created AuthorizationDocumentInstance """ - data = values.of( { "AddressSid": address_sid, diff --git a/twilio/rest/numbers/v2/bulk_hosted_number_order.py b/twilio/rest/numbers/v2/bulk_hosted_number_order.py index 6017d7efa4..57e8723e7d 100644 --- a/twilio/rest/numbers/v2/bulk_hosted_number_order.py +++ b/twilio/rest/numbers/v2/bulk_hosted_number_order.py @@ -64,7 +64,7 @@ def __init__( self.total_count: Optional[int] = deserialize.integer( payload.get("total_count") ) - self.results: Optional[List[Dict[str, object]]] = payload.get("results") + self.results: Optional[List[object]] = payload.get("results") self._solution = { "bulk_hosting_sid": bulk_hosting_sid or self.bulk_hosting_sid, diff --git a/twilio/rest/numbers/v2/hosted_number_order.py b/twilio/rest/numbers/v2/hosted_number_order.py index 81cd7e451b..813b9b4826 100644 --- a/twilio/rest/numbers/v2/hosted_number_order.py +++ b/twilio/rest/numbers/v2/hosted_number_order.py @@ -315,7 +315,6 @@ def create( :returns: The created HostedNumberOrderInstance """ - data = values.of( { "PhoneNumber": phone_number, @@ -386,7 +385,6 @@ async def create_async( :returns: The created HostedNumberOrderInstance """ - data = values.of( { "PhoneNumber": phone_number, diff --git a/twilio/rest/numbers/v2/regulatory_compliance/bundle/__init__.py b/twilio/rest/numbers/v2/regulatory_compliance/bundle/__init__.py index 69f95458da..ff7b1d7c01 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/bundle/__init__.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/bundle/__init__.py @@ -499,7 +499,6 @@ def create( :returns: The created BundleInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -543,7 +542,6 @@ async def create_async( :returns: The created BundleInstance """ - data = values.of( { "FriendlyName": friendly_name, 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 eb88f7c9bf..5a0cf036b9 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/bundle/bundle_copy.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/bundle/bundle_copy.py @@ -128,7 +128,6 @@ def create( :returns: The created BundleCopyInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -155,7 +154,6 @@ async def create_async( :returns: The created BundleCopyInstance """ - data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/numbers/v2/regulatory_compliance/bundle/evaluation.py b/twilio/rest/numbers/v2/regulatory_compliance/bundle/evaluation.py index e4c74ec92a..53ad9d7694 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/bundle/evaluation.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/bundle/evaluation.py @@ -53,7 +53,7 @@ def __init__( self.regulation_sid: Optional[str] = payload.get("regulation_sid") self.bundle_sid: Optional[str] = payload.get("bundle_sid") self.status: Optional["EvaluationInstance.Status"] = payload.get("status") - self.results: Optional[List[Dict[str, object]]] = payload.get("results") + self.results: Optional[List[object]] = payload.get("results") self.date_created: Optional[datetime] = deserialize.iso8601_datetime( payload.get("date_created") ) 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 4d2998ff64..f5f36206bf 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/bundle/item_assignment.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/bundle/item_assignment.py @@ -263,7 +263,6 @@ def create(self, object_sid: str) -> ItemAssignmentInstance: :returns: The created ItemAssignmentInstance """ - data = values.of( { "ObjectSid": object_sid, @@ -288,7 +287,6 @@ async def create_async(self, object_sid: str) -> ItemAssignmentInstance: :returns: The created ItemAssignmentInstance """ - data = values.of( { "ObjectSid": object_sid, 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 91d5f18a12..e8ab99ad71 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/bundle/replace_items.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/bundle/replace_items.py @@ -105,7 +105,6 @@ def create(self, from_bundle_sid: str) -> ReplaceItemsInstance: :returns: The created ReplaceItemsInstance """ - data = values.of( { "FromBundleSid": from_bundle_sid, @@ -130,7 +129,6 @@ async def create_async(self, from_bundle_sid: str) -> ReplaceItemsInstance: :returns: The created ReplaceItemsInstance """ - data = values.of( { "FromBundleSid": from_bundle_sid, diff --git a/twilio/rest/numbers/v2/regulatory_compliance/end_user.py b/twilio/rest/numbers/v2/regulatory_compliance/end_user.py index b717cd420e..f9bc9d270f 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/end_user.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/end_user.py @@ -348,7 +348,6 @@ def create( :returns: The created EndUserInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -380,7 +379,6 @@ async def create_async( :returns: The created EndUserInstance """ - data = values.of( { "FriendlyName": friendly_name, 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 e114558132..0a762cea38 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/end_user_type.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/end_user_type.py @@ -40,7 +40,7 @@ def __init__( self.sid: Optional[str] = payload.get("sid") self.friendly_name: Optional[str] = payload.get("friendly_name") self.machine_name: Optional[str] = payload.get("machine_name") - self.fields: Optional[List[Dict[str, object]]] = payload.get("fields") + self.fields: Optional[List[object]] = payload.get("fields") self.url: Optional[str] = payload.get("url") self._solution = { diff --git a/twilio/rest/numbers/v2/regulatory_compliance/supporting_document.py b/twilio/rest/numbers/v2/regulatory_compliance/supporting_document.py index 6a4636198b..e619ecdc26 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/supporting_document.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/supporting_document.py @@ -366,7 +366,6 @@ def create( :returns: The created SupportingDocumentInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -398,7 +397,6 @@ async def create_async( :returns: The created SupportingDocumentInstance """ - data = values.of( { "FriendlyName": friendly_name, 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 811ae1d83e..65c097b994 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/supporting_document_type.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/supporting_document_type.py @@ -40,7 +40,7 @@ def __init__( self.sid: Optional[str] = payload.get("sid") self.friendly_name: Optional[str] = payload.get("friendly_name") self.machine_name: Optional[str] = payload.get("machine_name") - self.fields: Optional[List[Dict[str, object]]] = payload.get("fields") + self.fields: Optional[List[object]] = payload.get("fields") self.url: Optional[str] = payload.get("url") self._solution = { diff --git a/twilio/rest/oauth/OauthBase.py b/twilio/rest/oauth/OauthBase.py new file mode 100644 index 0000000000..3df051d0fc --- /dev/null +++ b/twilio/rest/oauth/OauthBase.py @@ -0,0 +1,43 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +from typing import Optional + +from twilio.base.domain import Domain +from twilio.rest import Client +from twilio.rest.oauth.v1 import V1 + + +class OauthBase(Domain): + def __init__(self, twilio: Client): + """ + Initialize the Oauth Domain + + :returns: Domain for Oauth + """ + super().__init__(twilio, "https://oauth.twilio.com") + self._v1: Optional[V1] = None + + @property + def v1(self) -> V1: + """ + :returns: Versions v1 of Oauth + """ + 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/oauth/v1/__init__.py b/twilio/rest/oauth/v1/__init__.py new file mode 100644 index 0000000000..36aaa90ff3 --- /dev/null +++ b/twilio/rest/oauth/v1/__init__.py @@ -0,0 +1,74 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Oauth + 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.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 V1(Version): + def __init__(self, domain: Domain): + """ + Initialize the V1 version of Oauth + + :param domain: The Twilio.oauth domain + """ + super().__init__(domain, "v1") + self._device_code: Optional[DeviceCodeList] = None + self._oauth: Optional[OauthList] = None + self._openid_discovery: Optional[OpenidDiscoveryList] = None + self._token: Optional[TokenList] = None + self._user_info: Optional[UserInfoList] = None + + @property + def device_code(self) -> DeviceCodeList: + if self._device_code is None: + self._device_code = DeviceCodeList(self) + return self._device_code + + @property + def oauth(self) -> OauthList: + if self._oauth is None: + self._oauth = OauthList(self) + return self._oauth + + @property + def openid_discovery(self) -> OpenidDiscoveryList: + if self._openid_discovery is None: + self._openid_discovery = OpenidDiscoveryList(self) + return self._openid_discovery + + @property + def token(self) -> TokenList: + if self._token is None: + self._token = TokenList(self) + return self._token + + @property + def user_info(self) -> UserInfoList: + if self._user_info is None: + self._user_info = UserInfoList(self) + return self._user_info + + def __repr__(self) -> str: + """ + Provide a friendly representation + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/oauth/v1/device_code.py b/twilio/rest/oauth/v1/device_code.py new file mode 100644 index 0000000000..ed0998ee94 --- /dev/null +++ b/twilio/rest/oauth/v1/device_code.py @@ -0,0 +1,137 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Oauth + 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 deserialize, serialize, values + +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class DeviceCodeInstance(InstanceResource): + + """ + :ivar device_code: The device verification code. + :ivar user_code: The verification code which end user uses to verify authorization request. + :ivar verification_uri: The URI that the end user visits to verify authorization request. + :ivar verification_uri_complete: The URI with user_code that the end-user alternatively visits to verify authorization request. + :ivar expires_in: The expiration time of the device_code and user_code in seconds. + :ivar interval: The minimum amount of time in seconds that the client should wait between polling requests to the token endpoint. + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) + + self.device_code: Optional[str] = payload.get("device_code") + self.user_code: Optional[str] = payload.get("user_code") + self.verification_uri: Optional[str] = payload.get("verification_uri") + self.verification_uri_complete: Optional[str] = payload.get( + "verification_uri_complete" + ) + self.expires_in: Optional[int] = payload.get("expires_in") + self.interval: Optional[int] = deserialize.integer(payload.get("interval")) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "" + + +class DeviceCodeList(ListResource): + def __init__(self, version: Version): + """ + Initialize the DeviceCodeList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/device/code" + + def create( + self, + client_sid: str, + scopes: List[str], + audiences: Union[List[str], object] = values.unset, + ) -> DeviceCodeInstance: + """ + Create the DeviceCodeInstance + + :param client_sid: A 34 character string that uniquely identifies this OAuth App. + :param scopes: An Array of scopes for authorization request + :param audiences: An array of intended audiences for token requests + + :returns: The created DeviceCodeInstance + """ + data = values.of( + { + "ClientSid": client_sid, + "Scopes": serialize.map(scopes, lambda e: e), + "Audiences": serialize.map(audiences, lambda e: e), + } + ) + + payload = self._version.create( + method="POST", + uri=self._uri, + data=data, + ) + + return DeviceCodeInstance(self._version, payload) + + async def create_async( + self, + client_sid: str, + scopes: List[str], + audiences: Union[List[str], object] = values.unset, + ) -> DeviceCodeInstance: + """ + Asynchronously create the DeviceCodeInstance + + :param client_sid: A 34 character string that uniquely identifies this OAuth App. + :param scopes: An Array of scopes for authorization request + :param audiences: An array of intended audiences for token requests + + :returns: The created DeviceCodeInstance + """ + data = values.of( + { + "ClientSid": client_sid, + "Scopes": serialize.map(scopes, lambda e: e), + "Audiences": serialize.map(audiences, lambda e: e), + } + ) + + payload = await self._version.create_async( + method="POST", + uri=self._uri, + data=data, + ) + + return DeviceCodeInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/oauth/v1/oauth.py b/twilio/rest/oauth/v1/oauth.py new file mode 100644 index 0000000000..3765b65180 --- /dev/null +++ b/twilio/rest/oauth/v1/oauth.py @@ -0,0 +1,167 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Oauth + 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 OauthInstance(InstanceResource): + + """ + :ivar keys: A collection of certificates where are signed Twilio-issued tokens. + :ivar url: + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) + + self.keys: Optional[Dict[str, object]] = payload.get("keys") + self.url: Optional[str] = payload.get("url") + + self._context: Optional[OauthContext] = None + + @property + def _proxy(self) -> "OauthContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: OauthContext for this OauthInstance + """ + if self._context is None: + self._context = OauthContext( + self._version, + ) + return self._context + + def fetch(self) -> "OauthInstance": + """ + Fetch the OauthInstance + + + :returns: The fetched OauthInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "OauthInstance": + """ + Asynchronous coroutine to fetch the OauthInstance + + + :returns: The fetched OauthInstance + """ + return await self._proxy.fetch_async() + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "" + + +class OauthContext(InstanceContext): + def __init__(self, version: Version): + """ + Initialize the OauthContext + + :param version: Version that contains the resource + """ + super().__init__(version) + + self._uri = "/certs" + + def fetch(self) -> OauthInstance: + """ + Fetch the OauthInstance + + + :returns: The fetched OauthInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return OauthInstance( + self._version, + payload, + ) + + async def fetch_async(self) -> OauthInstance: + """ + Asynchronous coroutine to fetch the OauthInstance + + + :returns: The fetched OauthInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return OauthInstance( + self._version, + payload, + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "" + + +class OauthList(ListResource): + def __init__(self, version: Version): + """ + Initialize the OauthList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + def get(self) -> OauthContext: + """ + Constructs a OauthContext + + """ + return OauthContext(self._version) + + def __call__(self) -> OauthContext: + """ + Constructs a OauthContext + + """ + return OauthContext(self._version) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/oauth/v1/openid_discovery.py b/twilio/rest/oauth/v1/openid_discovery.py new file mode 100644 index 0000000000..00a551a2fe --- /dev/null +++ b/twilio/rest/oauth/v1/openid_discovery.py @@ -0,0 +1,199 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Oauth + 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 OpenidDiscoveryInstance(InstanceResource): + + """ + :ivar issuer: The URL of the party that will create the token and sign it with its private key. + :ivar authorization_endpoint: The endpoint that validates all authorization requests. + :ivar device_authorization_endpoint: The endpoint that validates all device code related authorization requests. + :ivar token_endpoint: The URL of the token endpoint. After a client has received an authorization code, that code is presented to the token endpoint and exchanged for an identity token, an access token, and a refresh token. + :ivar userinfo_endpoint: The URL of the user info endpoint, which returns user profile information to a client. Keep in mind that the user info endpoint returns only the information that has been requested. + :ivar revocation_endpoint: The endpoint used to revoke access or refresh tokens issued by the authorization server. + :ivar jwk_uri: The URL of your JSON Web Key Set. This set is a collection of JSON Web Keys, a standard method for representing cryptographic keys in a JSON structure. + :ivar response_type_supported: A collection of response type supported by authorization server. + :ivar subject_type_supported: A collection of subject by authorization server. + :ivar id_token_signing_alg_values_supported: A collection of JWS signing algorithms supported by authorization server to sign identity token. + :ivar scopes_supported: A collection of scopes supported by authorization server for identity token + :ivar claims_supported: A collection of claims supported by authorization server for identity token + :ivar url: + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) + + self.issuer: Optional[str] = payload.get("issuer") + self.authorization_endpoint: Optional[str] = payload.get( + "authorization_endpoint" + ) + self.device_authorization_endpoint: Optional[str] = payload.get( + "device_authorization_endpoint" + ) + self.token_endpoint: Optional[str] = payload.get("token_endpoint") + self.userinfo_endpoint: Optional[str] = payload.get("userinfo_endpoint") + self.revocation_endpoint: Optional[str] = payload.get("revocation_endpoint") + self.jwk_uri: Optional[str] = payload.get("jwk_uri") + self.response_type_supported: Optional[List[str]] = payload.get( + "response_type_supported" + ) + self.subject_type_supported: Optional[List[str]] = payload.get( + "subject_type_supported" + ) + self.id_token_signing_alg_values_supported: Optional[List[str]] = payload.get( + "id_token_signing_alg_values_supported" + ) + self.scopes_supported: Optional[List[str]] = payload.get("scopes_supported") + self.claims_supported: Optional[List[str]] = payload.get("claims_supported") + self.url: Optional[str] = payload.get("url") + + self._context: Optional[OpenidDiscoveryContext] = None + + @property + def _proxy(self) -> "OpenidDiscoveryContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: OpenidDiscoveryContext for this OpenidDiscoveryInstance + """ + if self._context is None: + self._context = OpenidDiscoveryContext( + self._version, + ) + return self._context + + def fetch(self) -> "OpenidDiscoveryInstance": + """ + Fetch the OpenidDiscoveryInstance + + + :returns: The fetched OpenidDiscoveryInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "OpenidDiscoveryInstance": + """ + Asynchronous coroutine to fetch the OpenidDiscoveryInstance + + + :returns: The fetched OpenidDiscoveryInstance + """ + return await self._proxy.fetch_async() + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "" + + +class OpenidDiscoveryContext(InstanceContext): + def __init__(self, version: Version): + """ + Initialize the OpenidDiscoveryContext + + :param version: Version that contains the resource + """ + super().__init__(version) + + self._uri = "/.well-known/openid-configuration" + + def fetch(self) -> OpenidDiscoveryInstance: + """ + Fetch the OpenidDiscoveryInstance + + + :returns: The fetched OpenidDiscoveryInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return OpenidDiscoveryInstance( + self._version, + payload, + ) + + async def fetch_async(self) -> OpenidDiscoveryInstance: + """ + Asynchronous coroutine to fetch the OpenidDiscoveryInstance + + + :returns: The fetched OpenidDiscoveryInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return OpenidDiscoveryInstance( + self._version, + payload, + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "" + + +class OpenidDiscoveryList(ListResource): + def __init__(self, version: Version): + """ + Initialize the OpenidDiscoveryList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + def get(self) -> OpenidDiscoveryContext: + """ + Constructs a OpenidDiscoveryContext + + """ + return OpenidDiscoveryContext(self._version) + + def __call__(self) -> OpenidDiscoveryContext: + """ + Constructs a OpenidDiscoveryContext + + """ + return OpenidDiscoveryContext(self._version) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/oauth/v1/token.py b/twilio/rest/oauth/v1/token.py new file mode 100644 index 0000000000..d236731a9f --- /dev/null +++ b/twilio/rest/oauth/v1/token.py @@ -0,0 +1,168 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Oauth + 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_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: + :ivar refresh_token_expires_at: The date and time in GMT when the refresh token expires in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar access_token_expires_at: The date and time in GMT when the refresh token expires in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + """ + + 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.refresh_token_expires_at: Optional[ + datetime + ] = deserialize.iso8601_datetime(payload.get("refresh_token_expires_at")) + self.access_token_expires_at: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("access_token_expires_at") + ) + + 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_sid: str, + client_secret: Union[str, object] = values.unset, + code: Union[str, object] = values.unset, + code_verifier: Union[str, object] = values.unset, + device_code: Union[str, object] = values.unset, + refresh_token: Union[str, object] = values.unset, + device_id: 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_sid: 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 code_verifier: A code which is generation cryptographically. + :param device_code: JWT token related to the device code grant type. + :param refresh_token: JWT token related to the refresh token grant type. + :param device_id: The Id of the device associated with the token (refresh token). + + :returns: The created TokenInstance + """ + data = values.of( + { + "GrantType": grant_type, + "ClientSid": client_sid, + "ClientSecret": client_secret, + "Code": code, + "CodeVerifier": code_verifier, + "DeviceCode": device_code, + "RefreshToken": refresh_token, + "DeviceId": device_id, + } + ) + + payload = self._version.create( + method="POST", + uri=self._uri, + data=data, + ) + + return TokenInstance(self._version, payload) + + async def create_async( + self, + grant_type: str, + client_sid: str, + client_secret: Union[str, object] = values.unset, + code: Union[str, object] = values.unset, + code_verifier: Union[str, object] = values.unset, + device_code: Union[str, object] = values.unset, + refresh_token: Union[str, object] = values.unset, + device_id: 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_sid: 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 code_verifier: A code which is generation cryptographically. + :param device_code: JWT token related to the device code grant type. + :param refresh_token: JWT token related to the refresh token grant type. + :param device_id: The Id of the device associated with the token (refresh token). + + :returns: The created TokenInstance + """ + data = values.of( + { + "GrantType": grant_type, + "ClientSid": client_sid, + "ClientSecret": client_secret, + "Code": code, + "CodeVerifier": code_verifier, + "DeviceCode": device_code, + "RefreshToken": refresh_token, + "DeviceId": device_id, + } + ) + + payload = await self._version.create_async( + method="POST", + uri=self._uri, + data=data, + ) + + return TokenInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/flex_api/v1/provisioning_status.py b/twilio/rest/oauth/v1/user_info.py similarity index 54% rename from twilio/rest/flex_api/v1/provisioning_status.py rename to twilio/rest/oauth/v1/user_info.py index 7b00927e0e..f7b7f0f5df 100644 --- a/twilio/rest/flex_api/v1/provisioning_status.py +++ b/twilio/rest/oauth/v1/user_info.py @@ -4,7 +4,7 @@ | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - Twilio - Flex + Twilio - Oauth This is the public Twilio REST API. NOTE: This class is auto generated by OpenAPI Generator. @@ -20,57 +20,58 @@ from twilio.base.version import Version -class ProvisioningStatusInstance(InstanceResource): - class Status(object): - ACTIVE = "active" - IN_PROGRESS = "in-progress" - NOT_CONFIGURED = "not-configured" - FAILED = "failed" +class UserInfoInstance(InstanceResource): """ - :ivar status: - :ivar url: The absolute URL of the resource. + :ivar user_sid: The URL of the party that will create the token and sign it with its private key. + :ivar first_name: The first name of the end-user. + :ivar last_name: The last name of the end-user. + :ivar friendly_name: The friendly name of the end-user. + :ivar email: The end-user's preferred email address. + :ivar url: """ def __init__(self, version: Version, payload: Dict[str, Any]): super().__init__(version) - self.status: Optional["ProvisioningStatusInstance.Status"] = payload.get( - "status" - ) + self.user_sid: Optional[str] = payload.get("user_sid") + self.first_name: Optional[str] = payload.get("first_name") + self.last_name: Optional[str] = payload.get("last_name") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.email: Optional[str] = payload.get("email") self.url: Optional[str] = payload.get("url") - self._context: Optional[ProvisioningStatusContext] = None + self._context: Optional[UserInfoContext] = None @property - def _proxy(self) -> "ProvisioningStatusContext": + def _proxy(self) -> "UserInfoContext": """ Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context - :returns: ProvisioningStatusContext for this ProvisioningStatusInstance + :returns: UserInfoContext for this UserInfoInstance """ if self._context is None: - self._context = ProvisioningStatusContext( + self._context = UserInfoContext( self._version, ) return self._context - def fetch(self) -> "ProvisioningStatusInstance": + def fetch(self) -> "UserInfoInstance": """ - Fetch the ProvisioningStatusInstance + Fetch the UserInfoInstance - :returns: The fetched ProvisioningStatusInstance + :returns: The fetched UserInfoInstance """ return self._proxy.fetch() - async def fetch_async(self) -> "ProvisioningStatusInstance": + async def fetch_async(self) -> "UserInfoInstance": """ - Asynchronous coroutine to fetch the ProvisioningStatusInstance + Asynchronous coroutine to fetch the UserInfoInstance - :returns: The fetched ProvisioningStatusInstance + :returns: The fetched UserInfoInstance """ return await self._proxy.fetch_async() @@ -81,26 +82,26 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" -class ProvisioningStatusContext(InstanceContext): +class UserInfoContext(InstanceContext): def __init__(self, version: Version): """ - Initialize the ProvisioningStatusContext + Initialize the UserInfoContext :param version: Version that contains the resource """ super().__init__(version) - self._uri = "/account/provision/status" + self._uri = "/userinfo" - def fetch(self) -> ProvisioningStatusInstance: + def fetch(self) -> UserInfoInstance: """ - Fetch the ProvisioningStatusInstance + Fetch the UserInfoInstance - :returns: The fetched ProvisioningStatusInstance + :returns: The fetched UserInfoInstance """ payload = self._version.fetch( @@ -108,17 +109,17 @@ def fetch(self) -> ProvisioningStatusInstance: uri=self._uri, ) - return ProvisioningStatusInstance( + return UserInfoInstance( self._version, payload, ) - async def fetch_async(self) -> ProvisioningStatusInstance: + async def fetch_async(self) -> UserInfoInstance: """ - Asynchronous coroutine to fetch the ProvisioningStatusInstance + Asynchronous coroutine to fetch the UserInfoInstance - :returns: The fetched ProvisioningStatusInstance + :returns: The fetched UserInfoInstance """ payload = await self._version.fetch_async( @@ -126,7 +127,7 @@ async def fetch_async(self) -> ProvisioningStatusInstance: uri=self._uri, ) - return ProvisioningStatusInstance( + return UserInfoInstance( self._version, payload, ) @@ -138,32 +139,32 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" -class ProvisioningStatusList(ListResource): +class UserInfoList(ListResource): def __init__(self, version: Version): """ - Initialize the ProvisioningStatusList + Initialize the UserInfoList :param version: Version that contains the resource """ super().__init__(version) - def get(self) -> ProvisioningStatusContext: + def get(self) -> UserInfoContext: """ - Constructs a ProvisioningStatusContext + Constructs a UserInfoContext """ - return ProvisioningStatusContext(self._version) + return UserInfoContext(self._version) - def __call__(self) -> ProvisioningStatusContext: + def __call__(self) -> UserInfoContext: """ - Constructs a ProvisioningStatusContext + Constructs a UserInfoContext """ - return ProvisioningStatusContext(self._version) + return UserInfoContext(self._version) def __repr__(self) -> str: """ @@ -171,4 +172,4 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" diff --git a/twilio/rest/preview/PreviewBase.py b/twilio/rest/preview/PreviewBase.py index 4f59124968..73d5aac4bd 100644 --- a/twilio/rest/preview/PreviewBase.py +++ b/twilio/rest/preview/PreviewBase.py @@ -17,6 +17,7 @@ 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.understand import Understand from twilio.rest.preview.wireless import Wireless @@ -32,6 +33,7 @@ def __init__(self, twilio: Client): self._hosted_numbers: Optional[HostedNumbers] = None self._sync: Optional[Sync] = None self._marketplace: Optional[Marketplace] = None + self._understand: Optional[Understand] = None self._wireless: Optional[Wireless] = None @property @@ -70,6 +72,15 @@ def marketplace(self) -> Marketplace: self._marketplace = Marketplace(self) return self._marketplace + @property + def understand(self) -> Understand: + """ + :returns: Versions understand of Preview + """ + if self._understand is None: + self._understand = Understand(self) + return self._understand + @property def wireless(self) -> Wireless: """ diff --git a/twilio/rest/preview/deployed_devices/fleet/__init__.py b/twilio/rest/preview/deployed_devices/fleet/__init__.py index b943e670cc..cb0c45498a 100644 --- a/twilio/rest/preview/deployed_devices/fleet/__init__.py +++ b/twilio/rest/preview/deployed_devices/fleet/__init__.py @@ -427,7 +427,6 @@ def create(self, friendly_name: Union[str, object] = values.unset) -> FleetInsta :returns: The created FleetInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -452,7 +451,6 @@ async def create_async( :returns: The created FleetInstance """ - data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/preview/deployed_devices/fleet/certificate.py b/twilio/rest/preview/deployed_devices/fleet/certificate.py index f0304d709f..a6654de67e 100644 --- a/twilio/rest/preview/deployed_devices/fleet/certificate.py +++ b/twilio/rest/preview/deployed_devices/fleet/certificate.py @@ -374,7 +374,6 @@ def create( :returns: The created CertificateInstance """ - data = values.of( { "CertificateData": certificate_data, @@ -408,7 +407,6 @@ async def create_async( :returns: The created CertificateInstance """ - data = values.of( { "CertificateData": certificate_data, diff --git a/twilio/rest/preview/deployed_devices/fleet/deployment.py b/twilio/rest/preview/deployed_devices/fleet/deployment.py index 91272fc308..5dbda65c66 100644 --- a/twilio/rest/preview/deployed_devices/fleet/deployment.py +++ b/twilio/rest/preview/deployed_devices/fleet/deployment.py @@ -370,7 +370,6 @@ def create( :returns: The created DeploymentInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -401,7 +400,6 @@ async def create_async( :returns: The created DeploymentInstance """ - data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/preview/deployed_devices/fleet/device.py b/twilio/rest/preview/deployed_devices/fleet/device.py index 1a992941a2..afaa0fce2a 100644 --- a/twilio/rest/preview/deployed_devices/fleet/device.py +++ b/twilio/rest/preview/deployed_devices/fleet/device.py @@ -410,7 +410,6 @@ def create( :returns: The created DeviceInstance """ - data = values.of( { "UniqueName": unique_name, @@ -450,7 +449,6 @@ async def create_async( :returns: The created DeviceInstance """ - data = values.of( { "UniqueName": unique_name, diff --git a/twilio/rest/preview/deployed_devices/fleet/key.py b/twilio/rest/preview/deployed_devices/fleet/key.py index e98d8dd696..9bcfd8fb0f 100644 --- a/twilio/rest/preview/deployed_devices/fleet/key.py +++ b/twilio/rest/preview/deployed_devices/fleet/key.py @@ -372,7 +372,6 @@ def create( :returns: The created KeyInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -403,7 +402,6 @@ async def create_async( :returns: The created KeyInstance """ - data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/preview/hosted_numbers/authorization_document/__init__.py b/twilio/rest/preview/hosted_numbers/authorization_document/__init__.py index 5ea74ff51e..1cab771279 100644 --- a/twilio/rest/preview/hosted_numbers/authorization_document/__init__.py +++ b/twilio/rest/preview/hosted_numbers/authorization_document/__init__.py @@ -417,7 +417,6 @@ def create( :returns: The created AuthorizationDocumentInstance """ - data = values.of( { "HostedNumberOrderSids": serialize.map( @@ -460,7 +459,6 @@ async def create_async( :returns: The created AuthorizationDocumentInstance """ - data = values.of( { "HostedNumberOrderSids": serialize.map( diff --git a/twilio/rest/preview/hosted_numbers/hosted_number_order.py b/twilio/rest/preview/hosted_numbers/hosted_number_order.py index 8a50a45374..3927202489 100644 --- a/twilio/rest/preview/hosted_numbers/hosted_number_order.py +++ b/twilio/rest/preview/hosted_numbers/hosted_number_order.py @@ -543,7 +543,6 @@ def create( :returns: The created HostedNumberOrderInstance """ - data = values.of( { "PhoneNumber": phone_number, @@ -619,7 +618,6 @@ async def create_async( :returns: The created HostedNumberOrderInstance """ - data = values.of( { "PhoneNumber": phone_number, diff --git a/twilio/rest/preview/marketplace/installed_add_on/__init__.py b/twilio/rest/preview/marketplace/installed_add_on/__init__.py index e9a7e8cd7d..87d0926728 100644 --- a/twilio/rest/preview/marketplace/installed_add_on/__init__.py +++ b/twilio/rest/preview/marketplace/installed_add_on/__init__.py @@ -375,7 +375,6 @@ def create( :returns: The created InstalledAddOnInstance """ - data = values.of( { "AvailableAddOnSid": available_add_on_sid, @@ -410,7 +409,6 @@ async def create_async( :returns: The created InstalledAddOnInstance """ - data = values.of( { "AvailableAddOnSid": available_add_on_sid, diff --git a/twilio/rest/preview/sync/service/__init__.py b/twilio/rest/preview/sync/service/__init__.py index b3a962fa6f..c9f33d19bf 100644 --- a/twilio/rest/preview/sync/service/__init__.py +++ b/twilio/rest/preview/sync/service/__init__.py @@ -441,7 +441,6 @@ def create( :returns: The created ServiceInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -476,7 +475,6 @@ async def create_async( :returns: The created ServiceInstance """ - data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/preview/sync/service/document/__init__.py b/twilio/rest/preview/sync/service/document/__init__.py index 660aee9b18..ebd08889f9 100644 --- a/twilio/rest/preview/sync/service/document/__init__.py +++ b/twilio/rest/preview/sync/service/document/__init__.py @@ -397,7 +397,6 @@ def create( :returns: The created DocumentInstance """ - data = values.of( { "UniqueName": unique_name, @@ -428,7 +427,6 @@ async def create_async( :returns: The created DocumentInstance """ - data = values.of( { "UniqueName": unique_name, diff --git a/twilio/rest/preview/sync/service/sync_list/__init__.py b/twilio/rest/preview/sync/service/sync_list/__init__.py index 7dfc743963..d3cd34c547 100644 --- a/twilio/rest/preview/sync/service/sync_list/__init__.py +++ b/twilio/rest/preview/sync/service/sync_list/__init__.py @@ -316,7 +316,6 @@ def create( :returns: The created SyncListInstance """ - data = values.of( { "UniqueName": unique_name, @@ -343,7 +342,6 @@ async def create_async( :returns: The created SyncListInstance """ - data = values.of( { "UniqueName": unique_name, 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 d795075fea..592f84a3c4 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 @@ -406,7 +406,6 @@ def create(self, data: object) -> SyncListItemInstance: :returns: The created SyncListItemInstance """ - data = values.of( { "Data": serialize.object(data), @@ -434,7 +433,6 @@ async def create_async(self, data: object) -> SyncListItemInstance: :returns: The created SyncListItemInstance """ - data = values.of( { "Data": serialize.object(data), diff --git a/twilio/rest/preview/sync/service/sync_map/__init__.py b/twilio/rest/preview/sync/service/sync_map/__init__.py index cc5907cf80..47235fd80c 100644 --- a/twilio/rest/preview/sync/service/sync_map/__init__.py +++ b/twilio/rest/preview/sync/service/sync_map/__init__.py @@ -314,7 +314,6 @@ def create(self, unique_name: Union[str, object] = values.unset) -> SyncMapInsta :returns: The created SyncMapInstance """ - data = values.of( { "UniqueName": unique_name, @@ -341,7 +340,6 @@ async def create_async( :returns: The created SyncMapInstance """ - data = values.of( { "UniqueName": unique_name, 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 20240d1ef9..ef42e77d38 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 @@ -407,7 +407,6 @@ def create(self, key: str, data: object) -> SyncMapItemInstance: :returns: The created SyncMapItemInstance """ - data = values.of( { "Key": key, @@ -437,7 +436,6 @@ async def create_async(self, key: str, data: object) -> SyncMapItemInstance: :returns: The created SyncMapItemInstance """ - data = values.of( { "Key": key, diff --git a/twilio/rest/preview/understand/__init__.py b/twilio/rest/preview/understand/__init__.py new file mode 100644 index 0000000000..da659fd3a6 --- /dev/null +++ b/twilio/rest/preview/understand/__init__.py @@ -0,0 +1,42 @@ +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.understand.assistant import AssistantList + + +class Understand(Version): + def __init__(self, domain: Domain): + """ + Initialize the Understand version of Preview + + :param domain: The Twilio.preview domain + """ + super().__init__(domain, "understand") + self._assistants: Optional[AssistantList] = None + + @property + def assistants(self) -> AssistantList: + if self._assistants is None: + self._assistants = AssistantList(self) + return self._assistants + + def __repr__(self) -> str: + """ + Provide a friendly representation + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/preview/understand/assistant/__init__.py b/twilio/rest/preview/understand/assistant/__init__.py new file mode 100644 index 0000000000..27970ca4da --- /dev/null +++ b/twilio/rest/preview/understand/assistant/__init__.py @@ -0,0 +1,887 @@ +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.understand.assistant.assistant_fallback_actions import ( + AssistantFallbackActionsList, +) +from twilio.rest.preview.understand.assistant.assistant_initiation_actions import ( + AssistantInitiationActionsList, +) +from twilio.rest.preview.understand.assistant.dialogue import DialogueList +from twilio.rest.preview.understand.assistant.field_type import FieldTypeList +from twilio.rest.preview.understand.assistant.model_build import ModelBuildList +from twilio.rest.preview.understand.assistant.query import QueryList +from twilio.rest.preview.understand.assistant.style_sheet import StyleSheetList +from twilio.rest.preview.understand.assistant.task import TaskList + + +class AssistantInstance(InstanceResource): + + """ + :ivar account_sid: The unique ID of the Account that created this Assistant. + :ivar date_created: The date that this resource was created + :ivar date_updated: The date that this resource was last updated + :ivar friendly_name: A text description for the Assistant. It is non-unique and can up to 255 characters long. + :ivar latest_model_build_sid: The unique ID (Sid) of the latest model build. Null if no model has been built. + :ivar links: + :ivar log_queries: A boolean that specifies whether queries should be logged for 30 days further training. If false, no queries will be stored, if true, queries will be stored for 30 days and deleted thereafter. + :ivar sid: A 34 character string that uniquely identifies this resource. + :ivar unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. You can use the unique name in the URL path. Unique up to 64 characters long. + :ivar url: + :ivar callback_url: A user-provided URL to send event callbacks to. + :ivar callback_events: Space-separated list of callback events that will trigger callbacks. + """ + + 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.friendly_name: Optional[str] = payload.get("friendly_name") + self.latest_model_build_sid: Optional[str] = payload.get( + "latest_model_build_sid" + ) + self.links: Optional[Dict[str, object]] = payload.get("links") + self.log_queries: Optional[bool] = payload.get("log_queries") + self.sid: Optional[str] = payload.get("sid") + self.unique_name: Optional[str] = payload.get("unique_name") + self.url: Optional[str] = payload.get("url") + self.callback_url: Optional[str] = payload.get("callback_url") + self.callback_events: Optional[str] = payload.get("callback_events") + + self._solution = { + "sid": sid or self.sid, + } + 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, + sid=self._solution["sid"], + ) + 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, + friendly_name: Union[str, object] = values.unset, + log_queries: Union[bool, object] = values.unset, + unique_name: Union[str, object] = values.unset, + callback_url: Union[str, object] = values.unset, + callback_events: Union[str, object] = values.unset, + fallback_actions: Union[object, object] = values.unset, + initiation_actions: Union[object, object] = values.unset, + style_sheet: Union[object, object] = values.unset, + ) -> "AssistantInstance": + """ + Update the AssistantInstance + + :param friendly_name: A text description for the Assistant. It is non-unique and can up to 255 characters long. + :param log_queries: A boolean that specifies whether queries should be logged for 30 days further training. If false, no queries will be stored, if true, queries will be stored for 30 days and deleted thereafter. Defaults to true if no value is provided. + :param unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. + :param callback_url: A user-provided URL to send event callbacks to. + :param callback_events: Space-separated list of callback events that will trigger callbacks. + :param fallback_actions: The JSON actions to be executed when the user's input is not recognized as matching any Task. + :param initiation_actions: The JSON actions to be executed on inbound phone calls when the Assistant has to say something first. + :param style_sheet: The JSON object that holds the style sheet for the assistant + + :returns: The updated AssistantInstance + """ + return self._proxy.update( + friendly_name=friendly_name, + log_queries=log_queries, + unique_name=unique_name, + callback_url=callback_url, + callback_events=callback_events, + fallback_actions=fallback_actions, + initiation_actions=initiation_actions, + style_sheet=style_sheet, + ) + + async def update_async( + self, + friendly_name: Union[str, object] = values.unset, + log_queries: Union[bool, object] = values.unset, + unique_name: Union[str, object] = values.unset, + callback_url: Union[str, object] = values.unset, + callback_events: Union[str, object] = values.unset, + fallback_actions: Union[object, object] = values.unset, + initiation_actions: Union[object, object] = values.unset, + style_sheet: Union[object, object] = values.unset, + ) -> "AssistantInstance": + """ + Asynchronous coroutine to update the AssistantInstance + + :param friendly_name: A text description for the Assistant. It is non-unique and can up to 255 characters long. + :param log_queries: A boolean that specifies whether queries should be logged for 30 days further training. If false, no queries will be stored, if true, queries will be stored for 30 days and deleted thereafter. Defaults to true if no value is provided. + :param unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. + :param callback_url: A user-provided URL to send event callbacks to. + :param callback_events: Space-separated list of callback events that will trigger callbacks. + :param fallback_actions: The JSON actions to be executed when the user's input is not recognized as matching any Task. + :param initiation_actions: The JSON actions to be executed on inbound phone calls when the Assistant has to say something first. + :param style_sheet: The JSON object that holds the style sheet for the assistant + + :returns: The updated AssistantInstance + """ + return await self._proxy.update_async( + friendly_name=friendly_name, + log_queries=log_queries, + unique_name=unique_name, + callback_url=callback_url, + callback_events=callback_events, + fallback_actions=fallback_actions, + initiation_actions=initiation_actions, + style_sheet=style_sheet, + ) + + @property + def assistant_fallback_actions(self) -> AssistantFallbackActionsList: + """ + Access the assistant_fallback_actions + """ + return self._proxy.assistant_fallback_actions + + @property + def assistant_initiation_actions(self) -> AssistantInitiationActionsList: + """ + Access the assistant_initiation_actions + """ + return self._proxy.assistant_initiation_actions + + @property + def dialogues(self) -> DialogueList: + """ + Access the dialogues + """ + return self._proxy.dialogues + + @property + def field_types(self) -> FieldTypeList: + """ + Access the field_types + """ + return self._proxy.field_types + + @property + def model_builds(self) -> ModelBuildList: + """ + Access the model_builds + """ + return self._proxy.model_builds + + @property + def queries(self) -> QueryList: + """ + Access the queries + """ + return self._proxy.queries + + @property + def style_sheet(self) -> StyleSheetList: + """ + Access the style_sheet + """ + return self._proxy.style_sheet + + @property + def tasks(self) -> TaskList: + """ + Access the tasks + """ + return self._proxy.tasks + + 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, sid: str): + """ + Initialize the AssistantContext + + :param version: Version that contains the resource + :param sid: A 34 character string that uniquely identifies this resource. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "sid": sid, + } + self._uri = "/Assistants/{sid}".format(**self._solution) + + self._assistant_fallback_actions: Optional[AssistantFallbackActionsList] = None + self._assistant_initiation_actions: Optional[ + AssistantInitiationActionsList + ] = None + self._dialogues: Optional[DialogueList] = None + self._field_types: Optional[FieldTypeList] = None + self._model_builds: Optional[ModelBuildList] = None + self._queries: Optional[QueryList] = None + self._style_sheet: Optional[StyleSheetList] = None + self._tasks: Optional[TaskList] = 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, + sid=self._solution["sid"], + ) + + 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, + sid=self._solution["sid"], + ) + + def update( + self, + friendly_name: Union[str, object] = values.unset, + log_queries: Union[bool, object] = values.unset, + unique_name: Union[str, object] = values.unset, + callback_url: Union[str, object] = values.unset, + callback_events: Union[str, object] = values.unset, + fallback_actions: Union[object, object] = values.unset, + initiation_actions: Union[object, object] = values.unset, + style_sheet: Union[object, object] = values.unset, + ) -> AssistantInstance: + """ + Update the AssistantInstance + + :param friendly_name: A text description for the Assistant. It is non-unique and can up to 255 characters long. + :param log_queries: A boolean that specifies whether queries should be logged for 30 days further training. If false, no queries will be stored, if true, queries will be stored for 30 days and deleted thereafter. Defaults to true if no value is provided. + :param unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. + :param callback_url: A user-provided URL to send event callbacks to. + :param callback_events: Space-separated list of callback events that will trigger callbacks. + :param fallback_actions: The JSON actions to be executed when the user's input is not recognized as matching any Task. + :param initiation_actions: The JSON actions to be executed on inbound phone calls when the Assistant has to say something first. + :param style_sheet: The JSON object that holds the style sheet for the assistant + + :returns: The updated AssistantInstance + """ + data = values.of( + { + "FriendlyName": friendly_name, + "LogQueries": log_queries, + "UniqueName": unique_name, + "CallbackUrl": callback_url, + "CallbackEvents": callback_events, + "FallbackActions": serialize.object(fallback_actions), + "InitiationActions": serialize.object(initiation_actions), + "StyleSheet": serialize.object(style_sheet), + } + ) + + payload = self._version.update( + method="POST", + uri=self._uri, + data=data, + ) + + return AssistantInstance(self._version, payload, sid=self._solution["sid"]) + + async def update_async( + self, + friendly_name: Union[str, object] = values.unset, + log_queries: Union[bool, object] = values.unset, + unique_name: Union[str, object] = values.unset, + callback_url: Union[str, object] = values.unset, + callback_events: Union[str, object] = values.unset, + fallback_actions: Union[object, object] = values.unset, + initiation_actions: Union[object, object] = values.unset, + style_sheet: Union[object, object] = values.unset, + ) -> AssistantInstance: + """ + Asynchronous coroutine to update the AssistantInstance + + :param friendly_name: A text description for the Assistant. It is non-unique and can up to 255 characters long. + :param log_queries: A boolean that specifies whether queries should be logged for 30 days further training. If false, no queries will be stored, if true, queries will be stored for 30 days and deleted thereafter. Defaults to true if no value is provided. + :param unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. + :param callback_url: A user-provided URL to send event callbacks to. + :param callback_events: Space-separated list of callback events that will trigger callbacks. + :param fallback_actions: The JSON actions to be executed when the user's input is not recognized as matching any Task. + :param initiation_actions: The JSON actions to be executed on inbound phone calls when the Assistant has to say something first. + :param style_sheet: The JSON object that holds the style sheet for the assistant + + :returns: The updated AssistantInstance + """ + data = values.of( + { + "FriendlyName": friendly_name, + "LogQueries": log_queries, + "UniqueName": unique_name, + "CallbackUrl": callback_url, + "CallbackEvents": callback_events, + "FallbackActions": serialize.object(fallback_actions), + "InitiationActions": serialize.object(initiation_actions), + "StyleSheet": serialize.object(style_sheet), + } + ) + + payload = await self._version.update_async( + method="POST", + uri=self._uri, + data=data, + ) + + return AssistantInstance(self._version, payload, sid=self._solution["sid"]) + + @property + def assistant_fallback_actions(self) -> AssistantFallbackActionsList: + """ + Access the assistant_fallback_actions + """ + if self._assistant_fallback_actions is None: + self._assistant_fallback_actions = AssistantFallbackActionsList( + self._version, + self._solution["sid"], + ) + return self._assistant_fallback_actions + + @property + def assistant_initiation_actions(self) -> AssistantInitiationActionsList: + """ + Access the assistant_initiation_actions + """ + if self._assistant_initiation_actions is None: + self._assistant_initiation_actions = AssistantInitiationActionsList( + self._version, + self._solution["sid"], + ) + return self._assistant_initiation_actions + + @property + def dialogues(self) -> DialogueList: + """ + Access the dialogues + """ + if self._dialogues is None: + self._dialogues = DialogueList( + self._version, + self._solution["sid"], + ) + return self._dialogues + + @property + def field_types(self) -> FieldTypeList: + """ + Access the field_types + """ + if self._field_types is None: + self._field_types = FieldTypeList( + self._version, + self._solution["sid"], + ) + return self._field_types + + @property + def model_builds(self) -> ModelBuildList: + """ + Access the model_builds + """ + if self._model_builds is None: + self._model_builds = ModelBuildList( + self._version, + self._solution["sid"], + ) + return self._model_builds + + @property + def queries(self) -> QueryList: + """ + Access the queries + """ + if self._queries is None: + self._queries = QueryList( + self._version, + self._solution["sid"], + ) + return self._queries + + @property + def style_sheet(self) -> StyleSheetList: + """ + Access the style_sheet + """ + if self._style_sheet is None: + self._style_sheet = StyleSheetList( + self._version, + self._solution["sid"], + ) + return self._style_sheet + + @property + def tasks(self) -> TaskList: + """ + Access the tasks + """ + if self._tasks is None: + self._tasks = TaskList( + self._version, + self._solution["sid"], + ) + return self._tasks + + 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): + def __init__(self, version: Version): + """ + Initialize the AssistantList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/Assistants" + + def create( + self, + friendly_name: Union[str, object] = values.unset, + log_queries: Union[bool, object] = values.unset, + unique_name: Union[str, object] = values.unset, + callback_url: Union[str, object] = values.unset, + callback_events: Union[str, object] = values.unset, + fallback_actions: Union[object, object] = values.unset, + initiation_actions: Union[object, object] = values.unset, + style_sheet: Union[object, object] = values.unset, + ) -> AssistantInstance: + """ + Create the AssistantInstance + + :param friendly_name: A text description for the Assistant. It is non-unique and can up to 255 characters long. + :param log_queries: A boolean that specifies whether queries should be logged for 30 days further training. If false, no queries will be stored, if true, queries will be stored for 30 days and deleted thereafter. Defaults to true if no value is provided. + :param unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. + :param callback_url: A user-provided URL to send event callbacks to. + :param callback_events: Space-separated list of callback events that will trigger callbacks. + :param fallback_actions: The JSON actions to be executed when the user's input is not recognized as matching any Task. + :param initiation_actions: The JSON actions to be executed on inbound phone calls when the Assistant has to say something first. + :param style_sheet: The JSON object that holds the style sheet for the assistant + + :returns: The created AssistantInstance + """ + data = values.of( + { + "FriendlyName": friendly_name, + "LogQueries": log_queries, + "UniqueName": unique_name, + "CallbackUrl": callback_url, + "CallbackEvents": callback_events, + "FallbackActions": serialize.object(fallback_actions), + "InitiationActions": serialize.object(initiation_actions), + "StyleSheet": serialize.object(style_sheet), + } + ) + + payload = self._version.create( + method="POST", + uri=self._uri, + data=data, + ) + + return AssistantInstance(self._version, payload) + + async def create_async( + self, + friendly_name: Union[str, object] = values.unset, + log_queries: Union[bool, object] = values.unset, + unique_name: Union[str, object] = values.unset, + callback_url: Union[str, object] = values.unset, + callback_events: Union[str, object] = values.unset, + fallback_actions: Union[object, object] = values.unset, + initiation_actions: Union[object, object] = values.unset, + style_sheet: Union[object, object] = values.unset, + ) -> AssistantInstance: + """ + Asynchronously create the AssistantInstance + + :param friendly_name: A text description for the Assistant. It is non-unique and can up to 255 characters long. + :param log_queries: A boolean that specifies whether queries should be logged for 30 days further training. If false, no queries will be stored, if true, queries will be stored for 30 days and deleted thereafter. Defaults to true if no value is provided. + :param unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. + :param callback_url: A user-provided URL to send event callbacks to. + :param callback_events: Space-separated list of callback events that will trigger callbacks. + :param fallback_actions: The JSON actions to be executed when the user's input is not recognized as matching any Task. + :param initiation_actions: The JSON actions to be executed on inbound phone calls when the Assistant has to say something first. + :param style_sheet: The JSON object that holds the style sheet for the assistant + + :returns: The created AssistantInstance + """ + data = values.of( + { + "FriendlyName": friendly_name, + "LogQueries": log_queries, + "UniqueName": unique_name, + "CallbackUrl": callback_url, + "CallbackEvents": callback_events, + "FallbackActions": serialize.object(fallback_actions), + "InitiationActions": serialize.object(initiation_actions), + "StyleSheet": serialize.object(style_sheet), + } + ) + + payload = await self._version.create_async( + method="POST", + uri=self._uri, + data=data, + ) + + 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, sid: str) -> AssistantContext: + """ + Constructs a AssistantContext + + :param sid: A 34 character string that uniquely identifies this resource. + """ + return AssistantContext(self._version, sid=sid) + + def __call__(self, sid: str) -> AssistantContext: + """ + Constructs a AssistantContext + + :param sid: A 34 character string that uniquely identifies this resource. + """ + return AssistantContext(self._version, sid=sid) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/preview/understand/assistant/assistant_fallback_actions.py b/twilio/rest/preview/understand/assistant/assistant_fallback_actions.py new file mode 100644 index 0000000000..84e964de0e --- /dev/null +++ b/twilio/rest/preview/understand/assistant/assistant_fallback_actions.py @@ -0,0 +1,279 @@ +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, 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 + + +class AssistantFallbackActionsInstance(InstanceResource): + + """ + :ivar account_sid: + :ivar assistant_sid: + :ivar url: + :ivar data: + """ + + def __init__(self, version: Version, payload: Dict[str, Any], assistant_sid: str): + super().__init__(version) + + self.account_sid: Optional[str] = payload.get("account_sid") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.url: Optional[str] = payload.get("url") + self.data: Optional[Dict[str, object]] = payload.get("data") + + self._solution = { + "assistant_sid": assistant_sid, + } + self._context: Optional[AssistantFallbackActionsContext] = None + + @property + def _proxy(self) -> "AssistantFallbackActionsContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: AssistantFallbackActionsContext for this AssistantFallbackActionsInstance + """ + if self._context is None: + self._context = AssistantFallbackActionsContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + ) + return self._context + + def fetch(self) -> "AssistantFallbackActionsInstance": + """ + Fetch the AssistantFallbackActionsInstance + + + :returns: The fetched AssistantFallbackActionsInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "AssistantFallbackActionsInstance": + """ + Asynchronous coroutine to fetch the AssistantFallbackActionsInstance + + + :returns: The fetched AssistantFallbackActionsInstance + """ + return await self._proxy.fetch_async() + + def update( + self, fallback_actions: Union[object, object] = values.unset + ) -> "AssistantFallbackActionsInstance": + """ + Update the AssistantFallbackActionsInstance + + :param fallback_actions: + + :returns: The updated AssistantFallbackActionsInstance + """ + return self._proxy.update( + fallback_actions=fallback_actions, + ) + + async def update_async( + self, fallback_actions: Union[object, object] = values.unset + ) -> "AssistantFallbackActionsInstance": + """ + Asynchronous coroutine to update the AssistantFallbackActionsInstance + + :param fallback_actions: + + :returns: The updated AssistantFallbackActionsInstance + """ + return await self._proxy.update_async( + fallback_actions=fallback_actions, + ) + + 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 AssistantFallbackActionsContext(InstanceContext): + def __init__(self, version: Version, assistant_sid: str): + """ + Initialize the AssistantFallbackActionsContext + + :param version: Version that contains the resource + :param assistant_sid: + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + } + self._uri = "/Assistants/{assistant_sid}/FallbackActions".format( + **self._solution + ) + + def fetch(self) -> AssistantFallbackActionsInstance: + """ + Fetch the AssistantFallbackActionsInstance + + + :returns: The fetched AssistantFallbackActionsInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return AssistantFallbackActionsInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + ) + + async def fetch_async(self) -> AssistantFallbackActionsInstance: + """ + Asynchronous coroutine to fetch the AssistantFallbackActionsInstance + + + :returns: The fetched AssistantFallbackActionsInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return AssistantFallbackActionsInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + ) + + def update( + self, fallback_actions: Union[object, object] = values.unset + ) -> AssistantFallbackActionsInstance: + """ + Update the AssistantFallbackActionsInstance + + :param fallback_actions: + + :returns: The updated AssistantFallbackActionsInstance + """ + data = values.of( + { + "FallbackActions": serialize.object(fallback_actions), + } + ) + + payload = self._version.update( + method="POST", + uri=self._uri, + data=data, + ) + + return AssistantFallbackActionsInstance( + self._version, payload, assistant_sid=self._solution["assistant_sid"] + ) + + async def update_async( + self, fallback_actions: Union[object, object] = values.unset + ) -> AssistantFallbackActionsInstance: + """ + Asynchronous coroutine to update the AssistantFallbackActionsInstance + + :param fallback_actions: + + :returns: The updated AssistantFallbackActionsInstance + """ + data = values.of( + { + "FallbackActions": serialize.object(fallback_actions), + } + ) + + payload = await self._version.update_async( + method="POST", + uri=self._uri, + data=data, + ) + + return AssistantFallbackActionsInstance( + self._version, payload, assistant_sid=self._solution["assistant_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 AssistantFallbackActionsList(ListResource): + def __init__(self, version: Version, assistant_sid: str): + """ + Initialize the AssistantFallbackActionsList + + :param version: Version that contains the resource + :param assistant_sid: + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + } + + def get(self) -> AssistantFallbackActionsContext: + """ + Constructs a AssistantFallbackActionsContext + + """ + return AssistantFallbackActionsContext( + self._version, assistant_sid=self._solution["assistant_sid"] + ) + + def __call__(self) -> AssistantFallbackActionsContext: + """ + Constructs a AssistantFallbackActionsContext + + """ + return AssistantFallbackActionsContext( + self._version, assistant_sid=self._solution["assistant_sid"] + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/preview/understand/assistant/assistant_initiation_actions.py b/twilio/rest/preview/understand/assistant/assistant_initiation_actions.py new file mode 100644 index 0000000000..544154f658 --- /dev/null +++ b/twilio/rest/preview/understand/assistant/assistant_initiation_actions.py @@ -0,0 +1,283 @@ +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, 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 + + +class AssistantInitiationActionsInstance(InstanceResource): + + """ + :ivar account_sid: + :ivar assistant_sid: + :ivar url: + :ivar data: + """ + + def __init__(self, version: Version, payload: Dict[str, Any], assistant_sid: str): + super().__init__(version) + + self.account_sid: Optional[str] = payload.get("account_sid") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.url: Optional[str] = payload.get("url") + self.data: Optional[Dict[str, object]] = payload.get("data") + + self._solution = { + "assistant_sid": assistant_sid, + } + self._context: Optional[AssistantInitiationActionsContext] = None + + @property + def _proxy(self) -> "AssistantInitiationActionsContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: AssistantInitiationActionsContext for this AssistantInitiationActionsInstance + """ + if self._context is None: + self._context = AssistantInitiationActionsContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + ) + return self._context + + def fetch(self) -> "AssistantInitiationActionsInstance": + """ + Fetch the AssistantInitiationActionsInstance + + + :returns: The fetched AssistantInitiationActionsInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "AssistantInitiationActionsInstance": + """ + Asynchronous coroutine to fetch the AssistantInitiationActionsInstance + + + :returns: The fetched AssistantInitiationActionsInstance + """ + return await self._proxy.fetch_async() + + def update( + self, initiation_actions: Union[object, object] = values.unset + ) -> "AssistantInitiationActionsInstance": + """ + Update the AssistantInitiationActionsInstance + + :param initiation_actions: + + :returns: The updated AssistantInitiationActionsInstance + """ + return self._proxy.update( + initiation_actions=initiation_actions, + ) + + async def update_async( + self, initiation_actions: Union[object, object] = values.unset + ) -> "AssistantInitiationActionsInstance": + """ + Asynchronous coroutine to update the AssistantInitiationActionsInstance + + :param initiation_actions: + + :returns: The updated AssistantInitiationActionsInstance + """ + return await self._proxy.update_async( + initiation_actions=initiation_actions, + ) + + 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 AssistantInitiationActionsContext(InstanceContext): + def __init__(self, version: Version, assistant_sid: str): + """ + Initialize the AssistantInitiationActionsContext + + :param version: Version that contains the resource + :param assistant_sid: + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + } + self._uri = "/Assistants/{assistant_sid}/InitiationActions".format( + **self._solution + ) + + def fetch(self) -> AssistantInitiationActionsInstance: + """ + Fetch the AssistantInitiationActionsInstance + + + :returns: The fetched AssistantInitiationActionsInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return AssistantInitiationActionsInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + ) + + async def fetch_async(self) -> AssistantInitiationActionsInstance: + """ + Asynchronous coroutine to fetch the AssistantInitiationActionsInstance + + + :returns: The fetched AssistantInitiationActionsInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return AssistantInitiationActionsInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + ) + + def update( + self, initiation_actions: Union[object, object] = values.unset + ) -> AssistantInitiationActionsInstance: + """ + Update the AssistantInitiationActionsInstance + + :param initiation_actions: + + :returns: The updated AssistantInitiationActionsInstance + """ + data = values.of( + { + "InitiationActions": serialize.object(initiation_actions), + } + ) + + payload = self._version.update( + method="POST", + uri=self._uri, + data=data, + ) + + return AssistantInitiationActionsInstance( + self._version, payload, assistant_sid=self._solution["assistant_sid"] + ) + + async def update_async( + self, initiation_actions: Union[object, object] = values.unset + ) -> AssistantInitiationActionsInstance: + """ + Asynchronous coroutine to update the AssistantInitiationActionsInstance + + :param initiation_actions: + + :returns: The updated AssistantInitiationActionsInstance + """ + data = values.of( + { + "InitiationActions": serialize.object(initiation_actions), + } + ) + + payload = await self._version.update_async( + method="POST", + uri=self._uri, + data=data, + ) + + return AssistantInitiationActionsInstance( + self._version, payload, assistant_sid=self._solution["assistant_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 AssistantInitiationActionsList(ListResource): + def __init__(self, version: Version, assistant_sid: str): + """ + Initialize the AssistantInitiationActionsList + + :param version: Version that contains the resource + :param assistant_sid: + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + } + + def get(self) -> AssistantInitiationActionsContext: + """ + Constructs a AssistantInitiationActionsContext + + """ + return AssistantInitiationActionsContext( + self._version, assistant_sid=self._solution["assistant_sid"] + ) + + def __call__(self) -> AssistantInitiationActionsContext: + """ + Constructs a AssistantInitiationActionsContext + + """ + return AssistantInitiationActionsContext( + self._version, assistant_sid=self._solution["assistant_sid"] + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/preview/understand/assistant/dialogue.py b/twilio/rest/preview/understand/assistant/dialogue.py new file mode 100644 index 0000000000..57b0016ec2 --- /dev/null +++ b/twilio/rest/preview/understand/assistant/dialogue.py @@ -0,0 +1,210 @@ +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, 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 DialogueInstance(InstanceResource): + + """ + :ivar account_sid: The unique ID of the Account that created this Field. + :ivar assistant_sid: The unique ID of the parent Assistant. + :ivar sid: The unique ID of the Dialogue + :ivar data: The dialogue memory object as json + :ivar url: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + assistant_sid: str, + sid: Optional[str] = None, + ): + super().__init__(version) + + self.account_sid: Optional[str] = payload.get("account_sid") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.sid: Optional[str] = payload.get("sid") + self.data: Optional[Dict[str, object]] = payload.get("data") + self.url: Optional[str] = payload.get("url") + + self._solution = { + "assistant_sid": assistant_sid, + "sid": sid or self.sid, + } + self._context: Optional[DialogueContext] = None + + @property + def _proxy(self) -> "DialogueContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: DialogueContext for this DialogueInstance + """ + if self._context is None: + self._context = DialogueContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + sid=self._solution["sid"], + ) + return self._context + + def fetch(self) -> "DialogueInstance": + """ + Fetch the DialogueInstance + + + :returns: The fetched DialogueInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "DialogueInstance": + """ + Asynchronous coroutine to fetch the DialogueInstance + + + :returns: The fetched DialogueInstance + """ + 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 DialogueContext(InstanceContext): + def __init__(self, version: Version, assistant_sid: str, sid: str): + """ + Initialize the DialogueContext + + :param version: Version that contains the resource + :param assistant_sid: + :param sid: + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + "sid": sid, + } + self._uri = "/Assistants/{assistant_sid}/Dialogues/{sid}".format( + **self._solution + ) + + def fetch(self) -> DialogueInstance: + """ + Fetch the DialogueInstance + + + :returns: The fetched DialogueInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return DialogueInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + sid=self._solution["sid"], + ) + + async def fetch_async(self) -> DialogueInstance: + """ + Asynchronous coroutine to fetch the DialogueInstance + + + :returns: The fetched DialogueInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return DialogueInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_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 DialogueList(ListResource): + def __init__(self, version: Version, assistant_sid: str): + """ + Initialize the DialogueList + + :param version: Version that contains the resource + :param assistant_sid: + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + } + + def get(self, sid: str) -> DialogueContext: + """ + Constructs a DialogueContext + + :param sid: + """ + return DialogueContext( + self._version, assistant_sid=self._solution["assistant_sid"], sid=sid + ) + + def __call__(self, sid: str) -> DialogueContext: + """ + Constructs a DialogueContext + + :param sid: + """ + return DialogueContext( + self._version, assistant_sid=self._solution["assistant_sid"], sid=sid + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/preview/understand/assistant/field_type/__init__.py b/twilio/rest/preview/understand/assistant/field_type/__init__.py new file mode 100644 index 0000000000..0deb38faf1 --- /dev/null +++ b/twilio/rest/preview/understand/assistant/field_type/__init__.py @@ -0,0 +1,654 @@ +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.understand.assistant.field_type.field_value import ( + FieldValueList, +) + + +class FieldTypeInstance(InstanceResource): + + """ + :ivar account_sid: The unique ID of the Account that created this Field Type. + :ivar date_created: The date that this resource was created + :ivar date_updated: The date that this resource was last updated + :ivar friendly_name: A user-provided string that identifies this resource. It is non-unique and can up to 255 characters long. + :ivar links: + :ivar assistant_sid: The unique ID of the Assistant. + :ivar sid: A 34 character string that uniquely identifies this resource. + :ivar unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. + :ivar url: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + assistant_sid: str, + 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.friendly_name: Optional[str] = payload.get("friendly_name") + self.links: Optional[Dict[str, object]] = payload.get("links") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.sid: Optional[str] = payload.get("sid") + self.unique_name: Optional[str] = payload.get("unique_name") + self.url: Optional[str] = payload.get("url") + + self._solution = { + "assistant_sid": assistant_sid, + "sid": sid or self.sid, + } + self._context: Optional[FieldTypeContext] = None + + @property + def _proxy(self) -> "FieldTypeContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: FieldTypeContext for this FieldTypeInstance + """ + if self._context is None: + self._context = FieldTypeContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + sid=self._solution["sid"], + ) + return self._context + + def delete(self) -> bool: + """ + Deletes the FieldTypeInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the FieldTypeInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def fetch(self) -> "FieldTypeInstance": + """ + Fetch the FieldTypeInstance + + + :returns: The fetched FieldTypeInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "FieldTypeInstance": + """ + Asynchronous coroutine to fetch the FieldTypeInstance + + + :returns: The fetched FieldTypeInstance + """ + return await self._proxy.fetch_async() + + def update( + self, + friendly_name: Union[str, object] = values.unset, + unique_name: Union[str, object] = values.unset, + ) -> "FieldTypeInstance": + """ + Update the FieldTypeInstance + + :param friendly_name: A user-provided string that identifies this resource. It is non-unique and can up to 255 characters long. + :param unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. + + :returns: The updated FieldTypeInstance + """ + return self._proxy.update( + friendly_name=friendly_name, + unique_name=unique_name, + ) + + async def update_async( + self, + friendly_name: Union[str, object] = values.unset, + unique_name: Union[str, object] = values.unset, + ) -> "FieldTypeInstance": + """ + Asynchronous coroutine to update the FieldTypeInstance + + :param friendly_name: A user-provided string that identifies this resource. It is non-unique and can up to 255 characters long. + :param unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. + + :returns: The updated FieldTypeInstance + """ + return await self._proxy.update_async( + friendly_name=friendly_name, + unique_name=unique_name, + ) + + @property + def field_values(self) -> FieldValueList: + """ + Access the field_values + """ + return self._proxy.field_values + + 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 FieldTypeContext(InstanceContext): + def __init__(self, version: Version, assistant_sid: str, sid: str): + """ + Initialize the FieldTypeContext + + :param version: Version that contains the resource + :param assistant_sid: + :param sid: + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + "sid": sid, + } + self._uri = "/Assistants/{assistant_sid}/FieldTypes/{sid}".format( + **self._solution + ) + + self._field_values: Optional[FieldValueList] = None + + def delete(self) -> bool: + """ + Deletes the FieldTypeInstance + + + :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 FieldTypeInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._version.delete_async( + method="DELETE", + uri=self._uri, + ) + + def fetch(self) -> FieldTypeInstance: + """ + Fetch the FieldTypeInstance + + + :returns: The fetched FieldTypeInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return FieldTypeInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + sid=self._solution["sid"], + ) + + async def fetch_async(self) -> FieldTypeInstance: + """ + Asynchronous coroutine to fetch the FieldTypeInstance + + + :returns: The fetched FieldTypeInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return FieldTypeInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + sid=self._solution["sid"], + ) + + def update( + self, + friendly_name: Union[str, object] = values.unset, + unique_name: Union[str, object] = values.unset, + ) -> FieldTypeInstance: + """ + Update the FieldTypeInstance + + :param friendly_name: A user-provided string that identifies this resource. It is non-unique and can up to 255 characters long. + :param unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. + + :returns: The updated FieldTypeInstance + """ + data = values.of( + { + "FriendlyName": friendly_name, + "UniqueName": unique_name, + } + ) + + payload = self._version.update( + method="POST", + uri=self._uri, + data=data, + ) + + return FieldTypeInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + sid=self._solution["sid"], + ) + + async def update_async( + self, + friendly_name: Union[str, object] = values.unset, + unique_name: Union[str, object] = values.unset, + ) -> FieldTypeInstance: + """ + Asynchronous coroutine to update the FieldTypeInstance + + :param friendly_name: A user-provided string that identifies this resource. It is non-unique and can up to 255 characters long. + :param unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. + + :returns: The updated FieldTypeInstance + """ + data = values.of( + { + "FriendlyName": friendly_name, + "UniqueName": unique_name, + } + ) + + payload = await self._version.update_async( + method="POST", + uri=self._uri, + data=data, + ) + + return FieldTypeInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + sid=self._solution["sid"], + ) + + @property + def field_values(self) -> FieldValueList: + """ + Access the field_values + """ + if self._field_values is None: + self._field_values = FieldValueList( + self._version, + self._solution["assistant_sid"], + self._solution["sid"], + ) + return self._field_values + + 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 FieldTypePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> FieldTypeInstance: + """ + Build an instance of FieldTypeInstance + + :param payload: Payload response from the API + """ + return FieldTypeInstance( + self._version, payload, assistant_sid=self._solution["assistant_sid"] + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class FieldTypeList(ListResource): + def __init__(self, version: Version, assistant_sid: str): + """ + Initialize the FieldTypeList + + :param version: Version that contains the resource + :param assistant_sid: + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + } + self._uri = "/Assistants/{assistant_sid}/FieldTypes".format(**self._solution) + + def create( + self, unique_name: str, friendly_name: Union[str, object] = values.unset + ) -> FieldTypeInstance: + """ + Create the FieldTypeInstance + + :param unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. + :param friendly_name: A user-provided string that identifies this resource. It is non-unique and can up to 255 characters long. + + :returns: The created FieldTypeInstance + """ + data = values.of( + { + "UniqueName": unique_name, + "FriendlyName": friendly_name, + } + ) + + payload = self._version.create( + method="POST", + uri=self._uri, + data=data, + ) + + return FieldTypeInstance( + self._version, payload, assistant_sid=self._solution["assistant_sid"] + ) + + async def create_async( + self, unique_name: str, friendly_name: Union[str, object] = values.unset + ) -> FieldTypeInstance: + """ + Asynchronously create the FieldTypeInstance + + :param unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. + :param friendly_name: A user-provided string that identifies this resource. It is non-unique and can up to 255 characters long. + + :returns: The created FieldTypeInstance + """ + data = values.of( + { + "UniqueName": unique_name, + "FriendlyName": friendly_name, + } + ) + + payload = await self._version.create_async( + method="POST", + uri=self._uri, + data=data, + ) + + return FieldTypeInstance( + self._version, payload, assistant_sid=self._solution["assistant_sid"] + ) + + def stream( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[FieldTypeInstance]: + """ + Streams FieldTypeInstance 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[FieldTypeInstance]: + """ + Asynchronously streams FieldTypeInstance 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[FieldTypeInstance]: + """ + Lists FieldTypeInstance 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[FieldTypeInstance]: + """ + Asynchronously lists FieldTypeInstance 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, + ) -> FieldTypePage: + """ + Retrieve a single page of FieldTypeInstance 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 FieldTypeInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = self._version.page(method="GET", uri=self._uri, params=data) + return FieldTypePage(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, + ) -> FieldTypePage: + """ + Asynchronously retrieve a single page of FieldTypeInstance 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 FieldTypeInstance + """ + 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 FieldTypePage(self._version, response, self._solution) + + def get_page(self, target_url: str) -> FieldTypePage: + """ + Retrieve a specific page of FieldTypeInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of FieldTypeInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return FieldTypePage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> FieldTypePage: + """ + Asynchronously retrieve a specific page of FieldTypeInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of FieldTypeInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return FieldTypePage(self._version, response, self._solution) + + def get(self, sid: str) -> FieldTypeContext: + """ + Constructs a FieldTypeContext + + :param sid: + """ + return FieldTypeContext( + self._version, assistant_sid=self._solution["assistant_sid"], sid=sid + ) + + def __call__(self, sid: str) -> FieldTypeContext: + """ + Constructs a FieldTypeContext + + :param sid: + """ + return FieldTypeContext( + self._version, assistant_sid=self._solution["assistant_sid"], sid=sid + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/preview/understand/assistant/field_type/field_value.py b/twilio/rest/preview/understand/assistant/field_type/field_value.py new file mode 100644 index 0000000000..87fb7df94b --- /dev/null +++ b/twilio/rest/preview/understand/assistant/field_type/field_value.py @@ -0,0 +1,577 @@ +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 FieldValueInstance(InstanceResource): + + """ + :ivar account_sid: The unique ID of the Account that created this Field Value. + :ivar date_created: The date that this resource was created + :ivar date_updated: The date that this resource was last updated + :ivar field_type_sid: The unique ID of the Field Type associated with this Field Value. + :ivar language: An ISO language-country string of the value. + :ivar assistant_sid: The unique ID of the Assistant. + :ivar sid: A 34 character string that uniquely identifies this resource. + :ivar value: The Field Value itself. + :ivar url: + :ivar synonym_of: A value that indicates this field value is a synonym of. Empty if the value is not a synonym. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + assistant_sid: str, + field_type_sid: str, + 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.field_type_sid: Optional[str] = payload.get("field_type_sid") + self.language: Optional[str] = payload.get("language") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.sid: Optional[str] = payload.get("sid") + self.value: Optional[str] = payload.get("value") + self.url: Optional[str] = payload.get("url") + self.synonym_of: Optional[str] = payload.get("synonym_of") + + self._solution = { + "assistant_sid": assistant_sid, + "field_type_sid": field_type_sid, + "sid": sid or self.sid, + } + self._context: Optional[FieldValueContext] = None + + @property + def _proxy(self) -> "FieldValueContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: FieldValueContext for this FieldValueInstance + """ + if self._context is None: + self._context = FieldValueContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + field_type_sid=self._solution["field_type_sid"], + sid=self._solution["sid"], + ) + return self._context + + def delete(self) -> bool: + """ + Deletes the FieldValueInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the FieldValueInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def fetch(self) -> "FieldValueInstance": + """ + Fetch the FieldValueInstance + + + :returns: The fetched FieldValueInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "FieldValueInstance": + """ + Asynchronous coroutine to fetch the FieldValueInstance + + + :returns: The fetched FieldValueInstance + """ + 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 FieldValueContext(InstanceContext): + def __init__( + self, version: Version, assistant_sid: str, field_type_sid: str, sid: str + ): + """ + Initialize the FieldValueContext + + :param version: Version that contains the resource + :param assistant_sid: + :param field_type_sid: + :param sid: + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + "field_type_sid": field_type_sid, + "sid": sid, + } + self._uri = "/Assistants/{assistant_sid}/FieldTypes/{field_type_sid}/FieldValues/{sid}".format( + **self._solution + ) + + def delete(self) -> bool: + """ + Deletes the FieldValueInstance + + + :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 FieldValueInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._version.delete_async( + method="DELETE", + uri=self._uri, + ) + + def fetch(self) -> FieldValueInstance: + """ + Fetch the FieldValueInstance + + + :returns: The fetched FieldValueInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return FieldValueInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + field_type_sid=self._solution["field_type_sid"], + sid=self._solution["sid"], + ) + + async def fetch_async(self) -> FieldValueInstance: + """ + Asynchronous coroutine to fetch the FieldValueInstance + + + :returns: The fetched FieldValueInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return FieldValueInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + field_type_sid=self._solution["field_type_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 FieldValuePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> FieldValueInstance: + """ + Build an instance of FieldValueInstance + + :param payload: Payload response from the API + """ + return FieldValueInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + field_type_sid=self._solution["field_type_sid"], + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class FieldValueList(ListResource): + def __init__(self, version: Version, assistant_sid: str, field_type_sid: str): + """ + Initialize the FieldValueList + + :param version: Version that contains the resource + :param assistant_sid: + :param field_type_sid: + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + "field_type_sid": field_type_sid, + } + self._uri = "/Assistants/{assistant_sid}/FieldTypes/{field_type_sid}/FieldValues".format( + **self._solution + ) + + def create( + self, language: str, value: str, synonym_of: Union[str, object] = values.unset + ) -> FieldValueInstance: + """ + Create the FieldValueInstance + + :param language: An ISO language-country string of the value. + :param value: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. + :param synonym_of: A value that indicates this field value is a synonym of. Empty if the value is not a synonym. + + :returns: The created FieldValueInstance + """ + data = values.of( + { + "Language": language, + "Value": value, + "SynonymOf": synonym_of, + } + ) + + payload = self._version.create( + method="POST", + uri=self._uri, + data=data, + ) + + return FieldValueInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + field_type_sid=self._solution["field_type_sid"], + ) + + async def create_async( + self, language: str, value: str, synonym_of: Union[str, object] = values.unset + ) -> FieldValueInstance: + """ + Asynchronously create the FieldValueInstance + + :param language: An ISO language-country string of the value. + :param value: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. + :param synonym_of: A value that indicates this field value is a synonym of. Empty if the value is not a synonym. + + :returns: The created FieldValueInstance + """ + data = values.of( + { + "Language": language, + "Value": value, + "SynonymOf": synonym_of, + } + ) + + payload = await self._version.create_async( + method="POST", + uri=self._uri, + data=data, + ) + + return FieldValueInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + field_type_sid=self._solution["field_type_sid"], + ) + + def stream( + self, + language: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[FieldValueInstance]: + """ + Streams FieldValueInstance 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 language: An ISO language-country string of the value. For example: *en-US* + :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(language=language, page_size=limits["page_size"]) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + language: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[FieldValueInstance]: + """ + Asynchronously streams FieldValueInstance 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 language: An ISO language-country string of the value. For example: *en-US* + :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(language=language, page_size=limits["page_size"]) + + return self._version.stream_async(page, limits["limit"]) + + def list( + self, + language: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[FieldValueInstance]: + """ + Lists FieldValueInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str language: An ISO language-country string of the value. For example: *en-US* + :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( + language=language, + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + language: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[FieldValueInstance]: + """ + Asynchronously lists FieldValueInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str language: An ISO language-country string of the value. For example: *en-US* + :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( + language=language, + limit=limit, + page_size=page_size, + ) + ] + + def page( + self, + language: 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, + ) -> FieldValuePage: + """ + Retrieve a single page of FieldValueInstance records from the API. + Request is executed immediately + + :param language: An ISO language-country string of the value. For example: *en-US* + :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 FieldValueInstance + """ + data = values.of( + { + "Language": language, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = self._version.page(method="GET", uri=self._uri, params=data) + return FieldValuePage(self._version, response, self._solution) + + async def page_async( + self, + language: 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, + ) -> FieldValuePage: + """ + Asynchronously retrieve a single page of FieldValueInstance records from the API. + Request is executed immediately + + :param language: An ISO language-country string of the value. For example: *en-US* + :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 FieldValueInstance + """ + data = values.of( + { + "Language": language, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = await self._version.page_async( + method="GET", uri=self._uri, params=data + ) + return FieldValuePage(self._version, response, self._solution) + + def get_page(self, target_url: str) -> FieldValuePage: + """ + Retrieve a specific page of FieldValueInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of FieldValueInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return FieldValuePage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> FieldValuePage: + """ + Asynchronously retrieve a specific page of FieldValueInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of FieldValueInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return FieldValuePage(self._version, response, self._solution) + + def get(self, sid: str) -> FieldValueContext: + """ + Constructs a FieldValueContext + + :param sid: + """ + return FieldValueContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + field_type_sid=self._solution["field_type_sid"], + sid=sid, + ) + + def __call__(self, sid: str) -> FieldValueContext: + """ + Constructs a FieldValueContext + + :param sid: + """ + return FieldValueContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + field_type_sid=self._solution["field_type_sid"], + sid=sid, + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/preview/understand/assistant/model_build.py b/twilio/rest/preview/understand/assistant/model_build.py new file mode 100644 index 0000000000..8b45b76dc0 --- /dev/null +++ b/twilio/rest/preview/understand/assistant/model_build.py @@ -0,0 +1,627 @@ +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 ModelBuildInstance(InstanceResource): + class Status(object): + ENQUEUED = "enqueued" + BUILDING = "building" + COMPLETED = "completed" + FAILED = "failed" + CANCELED = "canceled" + + """ + :ivar account_sid: The unique ID of the Account that created this Model Build. + :ivar date_created: The date that this resource was created + :ivar date_updated: The date that this resource was last updated + :ivar assistant_sid: The unique ID of the parent Assistant. + :ivar sid: A 34 character string that uniquely identifies this resource. + :ivar status: + :ivar unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. + :ivar url: + :ivar build_duration: The time in seconds it took to build the model. + :ivar error_code: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + assistant_sid: str, + 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.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.sid: Optional[str] = payload.get("sid") + self.status: Optional["ModelBuildInstance.Status"] = payload.get("status") + self.unique_name: Optional[str] = payload.get("unique_name") + self.url: Optional[str] = payload.get("url") + self.build_duration: Optional[int] = deserialize.integer( + payload.get("build_duration") + ) + self.error_code: Optional[int] = deserialize.integer(payload.get("error_code")) + + self._solution = { + "assistant_sid": assistant_sid, + "sid": sid or self.sid, + } + self._context: Optional[ModelBuildContext] = None + + @property + def _proxy(self) -> "ModelBuildContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: ModelBuildContext for this ModelBuildInstance + """ + if self._context is None: + self._context = ModelBuildContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + sid=self._solution["sid"], + ) + return self._context + + def delete(self) -> bool: + """ + Deletes the ModelBuildInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the ModelBuildInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def fetch(self) -> "ModelBuildInstance": + """ + Fetch the ModelBuildInstance + + + :returns: The fetched ModelBuildInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "ModelBuildInstance": + """ + Asynchronous coroutine to fetch the ModelBuildInstance + + + :returns: The fetched ModelBuildInstance + """ + return await self._proxy.fetch_async() + + def update( + self, unique_name: Union[str, object] = values.unset + ) -> "ModelBuildInstance": + """ + Update the ModelBuildInstance + + :param unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. For example: v0.1 + + :returns: The updated ModelBuildInstance + """ + return self._proxy.update( + unique_name=unique_name, + ) + + async def update_async( + self, unique_name: Union[str, object] = values.unset + ) -> "ModelBuildInstance": + """ + Asynchronous coroutine to update the ModelBuildInstance + + :param unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. For example: v0.1 + + :returns: The updated ModelBuildInstance + """ + return await self._proxy.update_async( + unique_name=unique_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 ModelBuildContext(InstanceContext): + def __init__(self, version: Version, assistant_sid: str, sid: str): + """ + Initialize the ModelBuildContext + + :param version: Version that contains the resource + :param assistant_sid: + :param sid: + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + "sid": sid, + } + self._uri = "/Assistants/{assistant_sid}/ModelBuilds/{sid}".format( + **self._solution + ) + + def delete(self) -> bool: + """ + Deletes the ModelBuildInstance + + + :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 ModelBuildInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._version.delete_async( + method="DELETE", + uri=self._uri, + ) + + def fetch(self) -> ModelBuildInstance: + """ + Fetch the ModelBuildInstance + + + :returns: The fetched ModelBuildInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return ModelBuildInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + sid=self._solution["sid"], + ) + + async def fetch_async(self) -> ModelBuildInstance: + """ + Asynchronous coroutine to fetch the ModelBuildInstance + + + :returns: The fetched ModelBuildInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return ModelBuildInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + sid=self._solution["sid"], + ) + + def update( + self, unique_name: Union[str, object] = values.unset + ) -> ModelBuildInstance: + """ + Update the ModelBuildInstance + + :param unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. For example: v0.1 + + :returns: The updated ModelBuildInstance + """ + data = values.of( + { + "UniqueName": unique_name, + } + ) + + payload = self._version.update( + method="POST", + uri=self._uri, + data=data, + ) + + return ModelBuildInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + sid=self._solution["sid"], + ) + + async def update_async( + self, unique_name: Union[str, object] = values.unset + ) -> ModelBuildInstance: + """ + Asynchronous coroutine to update the ModelBuildInstance + + :param unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. For example: v0.1 + + :returns: The updated ModelBuildInstance + """ + data = values.of( + { + "UniqueName": unique_name, + } + ) + + payload = await self._version.update_async( + method="POST", + uri=self._uri, + data=data, + ) + + return ModelBuildInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_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 ModelBuildPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ModelBuildInstance: + """ + Build an instance of ModelBuildInstance + + :param payload: Payload response from the API + """ + return ModelBuildInstance( + self._version, payload, assistant_sid=self._solution["assistant_sid"] + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class ModelBuildList(ListResource): + def __init__(self, version: Version, assistant_sid: str): + """ + Initialize the ModelBuildList + + :param version: Version that contains the resource + :param assistant_sid: + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + } + self._uri = "/Assistants/{assistant_sid}/ModelBuilds".format(**self._solution) + + def create( + self, + status_callback: Union[str, object] = values.unset, + unique_name: Union[str, object] = values.unset, + ) -> ModelBuildInstance: + """ + Create the ModelBuildInstance + + :param status_callback: + :param unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. For example: v0.1 + + :returns: The created ModelBuildInstance + """ + data = values.of( + { + "StatusCallback": status_callback, + "UniqueName": unique_name, + } + ) + + payload = self._version.create( + method="POST", + uri=self._uri, + data=data, + ) + + return ModelBuildInstance( + self._version, payload, assistant_sid=self._solution["assistant_sid"] + ) + + async def create_async( + self, + status_callback: Union[str, object] = values.unset, + unique_name: Union[str, object] = values.unset, + ) -> ModelBuildInstance: + """ + Asynchronously create the ModelBuildInstance + + :param status_callback: + :param unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. For example: v0.1 + + :returns: The created ModelBuildInstance + """ + data = values.of( + { + "StatusCallback": status_callback, + "UniqueName": unique_name, + } + ) + + payload = await self._version.create_async( + method="POST", + uri=self._uri, + data=data, + ) + + return ModelBuildInstance( + self._version, payload, assistant_sid=self._solution["assistant_sid"] + ) + + def stream( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[ModelBuildInstance]: + """ + Streams ModelBuildInstance 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[ModelBuildInstance]: + """ + Asynchronously streams ModelBuildInstance 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[ModelBuildInstance]: + """ + Lists ModelBuildInstance 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[ModelBuildInstance]: + """ + Asynchronously lists ModelBuildInstance 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, + ) -> ModelBuildPage: + """ + Retrieve a single page of ModelBuildInstance 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 ModelBuildInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = self._version.page(method="GET", uri=self._uri, params=data) + return ModelBuildPage(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, + ) -> ModelBuildPage: + """ + Asynchronously retrieve a single page of ModelBuildInstance 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 ModelBuildInstance + """ + 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 ModelBuildPage(self._version, response, self._solution) + + def get_page(self, target_url: str) -> ModelBuildPage: + """ + Retrieve a specific page of ModelBuildInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of ModelBuildInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return ModelBuildPage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> ModelBuildPage: + """ + Asynchronously retrieve a specific page of ModelBuildInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of ModelBuildInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return ModelBuildPage(self._version, response, self._solution) + + def get(self, sid: str) -> ModelBuildContext: + """ + Constructs a ModelBuildContext + + :param sid: + """ + return ModelBuildContext( + self._version, assistant_sid=self._solution["assistant_sid"], sid=sid + ) + + def __call__(self, sid: str) -> ModelBuildContext: + """ + Constructs a ModelBuildContext + + :param sid: + """ + return ModelBuildContext( + self._version, assistant_sid=self._solution["assistant_sid"], sid=sid + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/preview/understand/assistant/query.py b/twilio/rest/preview/understand/assistant/query.py new file mode 100644 index 0000000000..62fb2e3e11 --- /dev/null +++ b/twilio/rest/preview/understand/assistant/query.py @@ -0,0 +1,715 @@ +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 QueryInstance(InstanceResource): + + """ + :ivar account_sid: The unique ID of the Account that created this Query. + :ivar date_created: The date that this resource was created + :ivar date_updated: The date that this resource was last updated + :ivar results: The natural language analysis results which include the Task recognized, the confidence score and a list of identified Fields. + :ivar language: An ISO language-country string of the sample. + :ivar model_build_sid: The unique ID of the Model Build queried. + :ivar query: The end-user's natural language input. + :ivar sample_sid: An optional reference to the Sample created from this query. + :ivar assistant_sid: The unique ID of the parent Assistant. + :ivar sid: A 34 character string that uniquely identifies this resource. + :ivar status: A string that described the query status. The values can be: pending_review, reviewed, discarded + :ivar url: + :ivar source_channel: The communication channel where this end-user input came from + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + assistant_sid: str, + 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.results: Optional[Dict[str, object]] = payload.get("results") + self.language: Optional[str] = payload.get("language") + self.model_build_sid: Optional[str] = payload.get("model_build_sid") + self.query: Optional[str] = payload.get("query") + self.sample_sid: Optional[str] = payload.get("sample_sid") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.sid: Optional[str] = payload.get("sid") + self.status: Optional[str] = payload.get("status") + self.url: Optional[str] = payload.get("url") + self.source_channel: Optional[str] = payload.get("source_channel") + + self._solution = { + "assistant_sid": assistant_sid, + "sid": sid or self.sid, + } + self._context: Optional[QueryContext] = None + + @property + def _proxy(self) -> "QueryContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: QueryContext for this QueryInstance + """ + if self._context is None: + self._context = QueryContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + sid=self._solution["sid"], + ) + return self._context + + def delete(self) -> bool: + """ + Deletes the QueryInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the QueryInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def fetch(self) -> "QueryInstance": + """ + Fetch the QueryInstance + + + :returns: The fetched QueryInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "QueryInstance": + """ + Asynchronous coroutine to fetch the QueryInstance + + + :returns: The fetched QueryInstance + """ + return await self._proxy.fetch_async() + + def update( + self, + sample_sid: Union[str, object] = values.unset, + status: Union[str, object] = values.unset, + ) -> "QueryInstance": + """ + Update the QueryInstance + + :param sample_sid: An optional reference to the Sample created from this query. + :param status: A string that described the query status. The values can be: pending_review, reviewed, discarded + + :returns: The updated QueryInstance + """ + return self._proxy.update( + sample_sid=sample_sid, + status=status, + ) + + async def update_async( + self, + sample_sid: Union[str, object] = values.unset, + status: Union[str, object] = values.unset, + ) -> "QueryInstance": + """ + Asynchronous coroutine to update the QueryInstance + + :param sample_sid: An optional reference to the Sample created from this query. + :param status: A string that described the query status. The values can be: pending_review, reviewed, discarded + + :returns: The updated QueryInstance + """ + return await self._proxy.update_async( + sample_sid=sample_sid, + 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 QueryContext(InstanceContext): + def __init__(self, version: Version, assistant_sid: str, sid: str): + """ + Initialize the QueryContext + + :param version: Version that contains the resource + :param assistant_sid: The unique ID of the parent Assistant. + :param sid: A 34 character string that uniquely identifies this resource. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + "sid": sid, + } + self._uri = "/Assistants/{assistant_sid}/Queries/{sid}".format(**self._solution) + + def delete(self) -> bool: + """ + Deletes the QueryInstance + + + :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 QueryInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._version.delete_async( + method="DELETE", + uri=self._uri, + ) + + def fetch(self) -> QueryInstance: + """ + Fetch the QueryInstance + + + :returns: The fetched QueryInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return QueryInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + sid=self._solution["sid"], + ) + + async def fetch_async(self) -> QueryInstance: + """ + Asynchronous coroutine to fetch the QueryInstance + + + :returns: The fetched QueryInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return QueryInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + sid=self._solution["sid"], + ) + + def update( + self, + sample_sid: Union[str, object] = values.unset, + status: Union[str, object] = values.unset, + ) -> QueryInstance: + """ + Update the QueryInstance + + :param sample_sid: An optional reference to the Sample created from this query. + :param status: A string that described the query status. The values can be: pending_review, reviewed, discarded + + :returns: The updated QueryInstance + """ + data = values.of( + { + "SampleSid": sample_sid, + "Status": status, + } + ) + + payload = self._version.update( + method="POST", + uri=self._uri, + data=data, + ) + + return QueryInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + sid=self._solution["sid"], + ) + + async def update_async( + self, + sample_sid: Union[str, object] = values.unset, + status: Union[str, object] = values.unset, + ) -> QueryInstance: + """ + Asynchronous coroutine to update the QueryInstance + + :param sample_sid: An optional reference to the Sample created from this query. + :param status: A string that described the query status. The values can be: pending_review, reviewed, discarded + + :returns: The updated QueryInstance + """ + data = values.of( + { + "SampleSid": sample_sid, + "Status": status, + } + ) + + payload = await self._version.update_async( + method="POST", + uri=self._uri, + data=data, + ) + + return QueryInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_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 QueryPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> QueryInstance: + """ + Build an instance of QueryInstance + + :param payload: Payload response from the API + """ + return QueryInstance( + self._version, payload, assistant_sid=self._solution["assistant_sid"] + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class QueryList(ListResource): + def __init__(self, version: Version, assistant_sid: str): + """ + Initialize the QueryList + + :param version: Version that contains the resource + :param assistant_sid: The unique ID of the parent Assistant. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + } + self._uri = "/Assistants/{assistant_sid}/Queries".format(**self._solution) + + def create( + self, + language: str, + query: str, + tasks: Union[str, object] = values.unset, + model_build: Union[str, object] = values.unset, + field: Union[str, object] = values.unset, + ) -> QueryInstance: + """ + Create the QueryInstance + + :param language: An ISO language-country string of the sample. + :param query: A user-provided string that uniquely identifies this resource as an alternative to the sid. It can be up to 2048 characters long. + :param tasks: Constraints the query to a set of tasks. Useful when you need to constrain the paths the user can take. Tasks should be comma separated *task-unique-name-1*, *task-unique-name-2* + :param model_build: The Model Build Sid or unique name of the Model Build to be queried. + :param field: Constraints the query to a given Field with an task. Useful when you know the Field you are expecting. It accepts one field in the format *task-unique-name-1*:*field-unique-name* + + :returns: The created QueryInstance + """ + data = values.of( + { + "Language": language, + "Query": query, + "Tasks": tasks, + "ModelBuild": model_build, + "Field": field, + } + ) + + payload = self._version.create( + method="POST", + uri=self._uri, + data=data, + ) + + return QueryInstance( + self._version, payload, assistant_sid=self._solution["assistant_sid"] + ) + + async def create_async( + self, + language: str, + query: str, + tasks: Union[str, object] = values.unset, + model_build: Union[str, object] = values.unset, + field: Union[str, object] = values.unset, + ) -> QueryInstance: + """ + Asynchronously create the QueryInstance + + :param language: An ISO language-country string of the sample. + :param query: A user-provided string that uniquely identifies this resource as an alternative to the sid. It can be up to 2048 characters long. + :param tasks: Constraints the query to a set of tasks. Useful when you need to constrain the paths the user can take. Tasks should be comma separated *task-unique-name-1*, *task-unique-name-2* + :param model_build: The Model Build Sid or unique name of the Model Build to be queried. + :param field: Constraints the query to a given Field with an task. Useful when you know the Field you are expecting. It accepts one field in the format *task-unique-name-1*:*field-unique-name* + + :returns: The created QueryInstance + """ + data = values.of( + { + "Language": language, + "Query": query, + "Tasks": tasks, + "ModelBuild": model_build, + "Field": field, + } + ) + + payload = await self._version.create_async( + method="POST", + uri=self._uri, + data=data, + ) + + return QueryInstance( + self._version, payload, assistant_sid=self._solution["assistant_sid"] + ) + + def stream( + self, + language: Union[str, object] = values.unset, + model_build: Union[str, object] = values.unset, + status: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[QueryInstance]: + """ + Streams QueryInstance 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 language: An ISO language-country string of the sample. + :param str model_build: The Model Build Sid or unique name of the Model Build to be queried. + :param str status: A string that described the query status. The values can be: pending_review, reviewed, discarded + :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( + language=language, + model_build=model_build, + status=status, + page_size=limits["page_size"], + ) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + language: Union[str, object] = values.unset, + model_build: Union[str, object] = values.unset, + status: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[QueryInstance]: + """ + Asynchronously streams QueryInstance 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 language: An ISO language-country string of the sample. + :param str model_build: The Model Build Sid or unique name of the Model Build to be queried. + :param str status: A string that described the query status. The values can be: pending_review, reviewed, discarded + :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( + language=language, + model_build=model_build, + status=status, + page_size=limits["page_size"], + ) + + return self._version.stream_async(page, limits["limit"]) + + def list( + self, + language: Union[str, object] = values.unset, + model_build: Union[str, object] = values.unset, + status: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[QueryInstance]: + """ + Lists QueryInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str language: An ISO language-country string of the sample. + :param str model_build: The Model Build Sid or unique name of the Model Build to be queried. + :param str status: A string that described the query status. The values can be: pending_review, reviewed, discarded + :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( + language=language, + model_build=model_build, + status=status, + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + language: Union[str, object] = values.unset, + model_build: Union[str, object] = values.unset, + status: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[QueryInstance]: + """ + Asynchronously lists QueryInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str language: An ISO language-country string of the sample. + :param str model_build: The Model Build Sid or unique name of the Model Build to be queried. + :param str status: A string that described the query status. The values can be: pending_review, reviewed, discarded + :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( + language=language, + model_build=model_build, + status=status, + limit=limit, + page_size=page_size, + ) + ] + + def page( + self, + language: Union[str, object] = values.unset, + model_build: Union[str, object] = values.unset, + status: 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, + ) -> QueryPage: + """ + Retrieve a single page of QueryInstance records from the API. + Request is executed immediately + + :param language: An ISO language-country string of the sample. + :param model_build: The Model Build Sid or unique name of the Model Build to be queried. + :param status: A string that described the query status. The values can be: pending_review, reviewed, discarded + :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 QueryInstance + """ + data = values.of( + { + "Language": language, + "ModelBuild": model_build, + "Status": status, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = self._version.page(method="GET", uri=self._uri, params=data) + return QueryPage(self._version, response, self._solution) + + async def page_async( + self, + language: Union[str, object] = values.unset, + model_build: Union[str, object] = values.unset, + status: 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, + ) -> QueryPage: + """ + Asynchronously retrieve a single page of QueryInstance records from the API. + Request is executed immediately + + :param language: An ISO language-country string of the sample. + :param model_build: The Model Build Sid or unique name of the Model Build to be queried. + :param status: A string that described the query status. The values can be: pending_review, reviewed, discarded + :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 QueryInstance + """ + data = values.of( + { + "Language": language, + "ModelBuild": model_build, + "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 QueryPage(self._version, response, self._solution) + + def get_page(self, target_url: str) -> QueryPage: + """ + Retrieve a specific page of QueryInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of QueryInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return QueryPage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> QueryPage: + """ + Asynchronously retrieve a specific page of QueryInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of QueryInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return QueryPage(self._version, response, self._solution) + + def get(self, sid: str) -> QueryContext: + """ + Constructs a QueryContext + + :param sid: A 34 character string that uniquely identifies this resource. + """ + return QueryContext( + self._version, assistant_sid=self._solution["assistant_sid"], sid=sid + ) + + def __call__(self, sid: str) -> QueryContext: + """ + Constructs a QueryContext + + :param sid: A 34 character string that uniquely identifies this resource. + """ + return QueryContext( + self._version, assistant_sid=self._solution["assistant_sid"], sid=sid + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/preview/understand/assistant/style_sheet.py b/twilio/rest/preview/understand/assistant/style_sheet.py new file mode 100644 index 0000000000..4571fc4cb1 --- /dev/null +++ b/twilio/rest/preview/understand/assistant/style_sheet.py @@ -0,0 +1,273 @@ +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, 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 + + +class StyleSheetInstance(InstanceResource): + + """ + :ivar account_sid: The unique ID of the Account that created this Assistant + :ivar assistant_sid: The unique ID of the Assistant + :ivar url: + :ivar data: The JSON style sheet object + """ + + def __init__(self, version: Version, payload: Dict[str, Any], assistant_sid: str): + super().__init__(version) + + self.account_sid: Optional[str] = payload.get("account_sid") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.url: Optional[str] = payload.get("url") + self.data: Optional[Dict[str, object]] = payload.get("data") + + self._solution = { + "assistant_sid": assistant_sid, + } + self._context: Optional[StyleSheetContext] = None + + @property + def _proxy(self) -> "StyleSheetContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: StyleSheetContext for this StyleSheetInstance + """ + if self._context is None: + self._context = StyleSheetContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + ) + return self._context + + def fetch(self) -> "StyleSheetInstance": + """ + Fetch the StyleSheetInstance + + + :returns: The fetched StyleSheetInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "StyleSheetInstance": + """ + Asynchronous coroutine to fetch the StyleSheetInstance + + + :returns: The fetched StyleSheetInstance + """ + return await self._proxy.fetch_async() + + def update( + self, style_sheet: Union[object, object] = values.unset + ) -> "StyleSheetInstance": + """ + Update the StyleSheetInstance + + :param style_sheet: The JSON Style sheet string + + :returns: The updated StyleSheetInstance + """ + return self._proxy.update( + style_sheet=style_sheet, + ) + + async def update_async( + self, style_sheet: Union[object, object] = values.unset + ) -> "StyleSheetInstance": + """ + Asynchronous coroutine to update the StyleSheetInstance + + :param style_sheet: The JSON Style sheet string + + :returns: The updated StyleSheetInstance + """ + return await self._proxy.update_async( + style_sheet=style_sheet, + ) + + 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 StyleSheetContext(InstanceContext): + def __init__(self, version: Version, assistant_sid: str): + """ + Initialize the StyleSheetContext + + :param version: Version that contains the resource + :param assistant_sid: The unique ID of the Assistant + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + } + self._uri = "/Assistants/{assistant_sid}/StyleSheet".format(**self._solution) + + def fetch(self) -> StyleSheetInstance: + """ + Fetch the StyleSheetInstance + + + :returns: The fetched StyleSheetInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return StyleSheetInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + ) + + async def fetch_async(self) -> StyleSheetInstance: + """ + Asynchronous coroutine to fetch the StyleSheetInstance + + + :returns: The fetched StyleSheetInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return StyleSheetInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + ) + + def update( + self, style_sheet: Union[object, object] = values.unset + ) -> StyleSheetInstance: + """ + Update the StyleSheetInstance + + :param style_sheet: The JSON Style sheet string + + :returns: The updated StyleSheetInstance + """ + data = values.of( + { + "StyleSheet": serialize.object(style_sheet), + } + ) + + payload = self._version.update( + method="POST", + uri=self._uri, + data=data, + ) + + return StyleSheetInstance( + self._version, payload, assistant_sid=self._solution["assistant_sid"] + ) + + async def update_async( + self, style_sheet: Union[object, object] = values.unset + ) -> StyleSheetInstance: + """ + Asynchronous coroutine to update the StyleSheetInstance + + :param style_sheet: The JSON Style sheet string + + :returns: The updated StyleSheetInstance + """ + data = values.of( + { + "StyleSheet": serialize.object(style_sheet), + } + ) + + payload = await self._version.update_async( + method="POST", + uri=self._uri, + data=data, + ) + + return StyleSheetInstance( + self._version, payload, assistant_sid=self._solution["assistant_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 StyleSheetList(ListResource): + def __init__(self, version: Version, assistant_sid: str): + """ + Initialize the StyleSheetList + + :param version: Version that contains the resource + :param assistant_sid: The unique ID of the Assistant + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + } + + def get(self) -> StyleSheetContext: + """ + Constructs a StyleSheetContext + + """ + return StyleSheetContext( + self._version, assistant_sid=self._solution["assistant_sid"] + ) + + def __call__(self) -> StyleSheetContext: + """ + Constructs a StyleSheetContext + + """ + return StyleSheetContext( + self._version, assistant_sid=self._solution["assistant_sid"] + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/preview/understand/assistant/task/__init__.py b/twilio/rest/preview/understand/assistant/task/__init__.py new file mode 100644 index 0000000000..135a421ec6 --- /dev/null +++ b/twilio/rest/preview/understand/assistant/task/__init__.py @@ -0,0 +1,760 @@ +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.understand.assistant.task.field import FieldList +from twilio.rest.preview.understand.assistant.task.sample import SampleList +from twilio.rest.preview.understand.assistant.task.task_actions import TaskActionsList +from twilio.rest.preview.understand.assistant.task.task_statistics import ( + TaskStatisticsList, +) + + +class TaskInstance(InstanceResource): + + """ + :ivar account_sid: The unique ID of the Account that created this Task. + :ivar date_created: The date that this resource was created + :ivar date_updated: The date that this resource was last updated + :ivar friendly_name: A user-provided string that identifies this resource. It is non-unique and can up to 255 characters long. + :ivar links: + :ivar assistant_sid: The unique ID of the Assistant. + :ivar sid: A 34 character string that uniquely identifies this resource. + :ivar unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. + :ivar actions_url: User-provided HTTP endpoint where from the assistant fetches actions + :ivar url: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + assistant_sid: str, + 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.friendly_name: Optional[str] = payload.get("friendly_name") + self.links: Optional[Dict[str, object]] = payload.get("links") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.sid: Optional[str] = payload.get("sid") + self.unique_name: Optional[str] = payload.get("unique_name") + self.actions_url: Optional[str] = payload.get("actions_url") + self.url: Optional[str] = payload.get("url") + + self._solution = { + "assistant_sid": assistant_sid, + "sid": sid or self.sid, + } + self._context: Optional[TaskContext] = None + + @property + def _proxy(self) -> "TaskContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: TaskContext for this TaskInstance + """ + if self._context is None: + self._context = TaskContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + sid=self._solution["sid"], + ) + return self._context + + def delete(self) -> bool: + """ + Deletes the TaskInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the TaskInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def fetch(self) -> "TaskInstance": + """ + Fetch the TaskInstance + + + :returns: The fetched TaskInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "TaskInstance": + """ + Asynchronous coroutine to fetch the TaskInstance + + + :returns: The fetched TaskInstance + """ + return await self._proxy.fetch_async() + + def update( + self, + friendly_name: Union[str, object] = values.unset, + unique_name: Union[str, object] = values.unset, + actions: Union[object, object] = values.unset, + actions_url: Union[str, object] = values.unset, + ) -> "TaskInstance": + """ + Update the TaskInstance + + :param friendly_name: A user-provided string that identifies this resource. It is non-unique and can up to 255 characters long. + :param unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. + :param actions: A user-provided JSON object encoded as a string to specify the actions for this task. It is optional and non-unique. + :param actions_url: User-provided HTTP endpoint where from the assistant fetches actions + + :returns: The updated TaskInstance + """ + return self._proxy.update( + friendly_name=friendly_name, + unique_name=unique_name, + actions=actions, + actions_url=actions_url, + ) + + async def update_async( + self, + friendly_name: Union[str, object] = values.unset, + unique_name: Union[str, object] = values.unset, + actions: Union[object, object] = values.unset, + actions_url: Union[str, object] = values.unset, + ) -> "TaskInstance": + """ + Asynchronous coroutine to update the TaskInstance + + :param friendly_name: A user-provided string that identifies this resource. It is non-unique and can up to 255 characters long. + :param unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. + :param actions: A user-provided JSON object encoded as a string to specify the actions for this task. It is optional and non-unique. + :param actions_url: User-provided HTTP endpoint where from the assistant fetches actions + + :returns: The updated TaskInstance + """ + return await self._proxy.update_async( + friendly_name=friendly_name, + unique_name=unique_name, + actions=actions, + actions_url=actions_url, + ) + + @property + def fields(self) -> FieldList: + """ + Access the fields + """ + return self._proxy.fields + + @property + def samples(self) -> SampleList: + """ + Access the samples + """ + return self._proxy.samples + + @property + def task_actions(self) -> TaskActionsList: + """ + Access the task_actions + """ + return self._proxy.task_actions + + @property + def statistics(self) -> TaskStatisticsList: + """ + Access the statistics + """ + return self._proxy.statistics + + 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 TaskContext(InstanceContext): + def __init__(self, version: Version, assistant_sid: str, sid: str): + """ + Initialize the TaskContext + + :param version: Version that contains the resource + :param assistant_sid: The unique ID of the Assistant. + :param sid: A 34 character string that uniquely identifies this resource. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + "sid": sid, + } + self._uri = "/Assistants/{assistant_sid}/Tasks/{sid}".format(**self._solution) + + self._fields: Optional[FieldList] = None + self._samples: Optional[SampleList] = None + self._task_actions: Optional[TaskActionsList] = None + self._statistics: Optional[TaskStatisticsList] = None + + def delete(self) -> bool: + """ + Deletes the TaskInstance + + + :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 TaskInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._version.delete_async( + method="DELETE", + uri=self._uri, + ) + + def fetch(self) -> TaskInstance: + """ + Fetch the TaskInstance + + + :returns: The fetched TaskInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return TaskInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + sid=self._solution["sid"], + ) + + async def fetch_async(self) -> TaskInstance: + """ + Asynchronous coroutine to fetch the TaskInstance + + + :returns: The fetched TaskInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return TaskInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + sid=self._solution["sid"], + ) + + def update( + self, + friendly_name: Union[str, object] = values.unset, + unique_name: Union[str, object] = values.unset, + actions: Union[object, object] = values.unset, + actions_url: Union[str, object] = values.unset, + ) -> TaskInstance: + """ + Update the TaskInstance + + :param friendly_name: A user-provided string that identifies this resource. It is non-unique and can up to 255 characters long. + :param unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. + :param actions: A user-provided JSON object encoded as a string to specify the actions for this task. It is optional and non-unique. + :param actions_url: User-provided HTTP endpoint where from the assistant fetches actions + + :returns: The updated TaskInstance + """ + data = values.of( + { + "FriendlyName": friendly_name, + "UniqueName": unique_name, + "Actions": serialize.object(actions), + "ActionsUrl": actions_url, + } + ) + + payload = self._version.update( + method="POST", + uri=self._uri, + data=data, + ) + + return TaskInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + sid=self._solution["sid"], + ) + + async def update_async( + self, + friendly_name: Union[str, object] = values.unset, + unique_name: Union[str, object] = values.unset, + actions: Union[object, object] = values.unset, + actions_url: Union[str, object] = values.unset, + ) -> TaskInstance: + """ + Asynchronous coroutine to update the TaskInstance + + :param friendly_name: A user-provided string that identifies this resource. It is non-unique and can up to 255 characters long. + :param unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. + :param actions: A user-provided JSON object encoded as a string to specify the actions for this task. It is optional and non-unique. + :param actions_url: User-provided HTTP endpoint where from the assistant fetches actions + + :returns: The updated TaskInstance + """ + data = values.of( + { + "FriendlyName": friendly_name, + "UniqueName": unique_name, + "Actions": serialize.object(actions), + "ActionsUrl": actions_url, + } + ) + + payload = await self._version.update_async( + method="POST", + uri=self._uri, + data=data, + ) + + return TaskInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + sid=self._solution["sid"], + ) + + @property + def fields(self) -> FieldList: + """ + Access the fields + """ + if self._fields is None: + self._fields = FieldList( + self._version, + self._solution["assistant_sid"], + self._solution["sid"], + ) + return self._fields + + @property + def samples(self) -> SampleList: + """ + Access the samples + """ + if self._samples is None: + self._samples = SampleList( + self._version, + self._solution["assistant_sid"], + self._solution["sid"], + ) + return self._samples + + @property + def task_actions(self) -> TaskActionsList: + """ + Access the task_actions + """ + if self._task_actions is None: + self._task_actions = TaskActionsList( + self._version, + self._solution["assistant_sid"], + self._solution["sid"], + ) + return self._task_actions + + @property + def statistics(self) -> TaskStatisticsList: + """ + Access the statistics + """ + if self._statistics is None: + self._statistics = TaskStatisticsList( + self._version, + self._solution["assistant_sid"], + self._solution["sid"], + ) + return self._statistics + + 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 TaskPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> TaskInstance: + """ + Build an instance of TaskInstance + + :param payload: Payload response from the API + """ + return TaskInstance( + self._version, payload, assistant_sid=self._solution["assistant_sid"] + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class TaskList(ListResource): + def __init__(self, version: Version, assistant_sid: str): + """ + Initialize the TaskList + + :param version: Version that contains the resource + :param assistant_sid: The unique ID of the Assistant. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + } + self._uri = "/Assistants/{assistant_sid}/Tasks".format(**self._solution) + + def create( + self, + unique_name: str, + friendly_name: Union[str, object] = values.unset, + actions: Union[object, object] = values.unset, + actions_url: Union[str, object] = values.unset, + ) -> TaskInstance: + """ + Create the TaskInstance + + :param unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. + :param friendly_name: A user-provided string that identifies this resource. It is non-unique and can up to 255 characters long. + :param actions: A user-provided JSON object encoded as a string to specify the actions for this task. It is optional and non-unique. + :param actions_url: User-provided HTTP endpoint where from the assistant fetches actions + + :returns: The created TaskInstance + """ + data = values.of( + { + "UniqueName": unique_name, + "FriendlyName": friendly_name, + "Actions": serialize.object(actions), + "ActionsUrl": actions_url, + } + ) + + payload = self._version.create( + method="POST", + uri=self._uri, + data=data, + ) + + return TaskInstance( + self._version, payload, assistant_sid=self._solution["assistant_sid"] + ) + + async def create_async( + self, + unique_name: str, + friendly_name: Union[str, object] = values.unset, + actions: Union[object, object] = values.unset, + actions_url: Union[str, object] = values.unset, + ) -> TaskInstance: + """ + Asynchronously create the TaskInstance + + :param unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. + :param friendly_name: A user-provided string that identifies this resource. It is non-unique and can up to 255 characters long. + :param actions: A user-provided JSON object encoded as a string to specify the actions for this task. It is optional and non-unique. + :param actions_url: User-provided HTTP endpoint where from the assistant fetches actions + + :returns: The created TaskInstance + """ + data = values.of( + { + "UniqueName": unique_name, + "FriendlyName": friendly_name, + "Actions": serialize.object(actions), + "ActionsUrl": actions_url, + } + ) + + payload = await self._version.create_async( + method="POST", + uri=self._uri, + data=data, + ) + + return TaskInstance( + self._version, payload, assistant_sid=self._solution["assistant_sid"] + ) + + def stream( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[TaskInstance]: + """ + Streams TaskInstance 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[TaskInstance]: + """ + Asynchronously streams TaskInstance 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[TaskInstance]: + """ + Lists TaskInstance 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[TaskInstance]: + """ + Asynchronously lists TaskInstance 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, + ) -> TaskPage: + """ + Retrieve a single page of TaskInstance 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 TaskInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = self._version.page(method="GET", uri=self._uri, params=data) + return TaskPage(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, + ) -> TaskPage: + """ + Asynchronously retrieve a single page of TaskInstance 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 TaskInstance + """ + 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 TaskPage(self._version, response, self._solution) + + def get_page(self, target_url: str) -> TaskPage: + """ + Retrieve a specific page of TaskInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of TaskInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return TaskPage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> TaskPage: + """ + Asynchronously retrieve a specific page of TaskInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of TaskInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return TaskPage(self._version, response, self._solution) + + def get(self, sid: str) -> TaskContext: + """ + Constructs a TaskContext + + :param sid: A 34 character string that uniquely identifies this resource. + """ + return TaskContext( + self._version, assistant_sid=self._solution["assistant_sid"], sid=sid + ) + + def __call__(self, sid: str) -> TaskContext: + """ + Constructs a TaskContext + + :param sid: A 34 character string that uniquely identifies this resource. + """ + return TaskContext( + self._version, assistant_sid=self._solution["assistant_sid"], sid=sid + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/preview/understand/assistant/task/field.py b/twilio/rest/preview/understand/assistant/task/field.py new file mode 100644 index 0000000000..e8f4aa3a8c --- /dev/null +++ b/twilio/rest/preview/understand/assistant/task/field.py @@ -0,0 +1,549 @@ +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 FieldInstance(InstanceResource): + + """ + :ivar account_sid: The unique ID of the Account that created this Field. + :ivar date_created: The date that this resource was created + :ivar date_updated: The date that this resource was last updated + :ivar field_type: The Field Type of this field. It can be any [Built-in Field Type](https://www.twilio.com/docs/assistant/api/built-in-field-types) or the unique_name or sid of a custom Field Type. + :ivar task_sid: The unique ID of the Task associated with this Field. + :ivar assistant_sid: The unique ID of the parent Assistant. + :ivar sid: A 34 character string that uniquely identifies this resource. + :ivar unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. + :ivar url: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + assistant_sid: str, + task_sid: str, + 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.field_type: Optional[str] = payload.get("field_type") + self.task_sid: Optional[str] = payload.get("task_sid") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.sid: Optional[str] = payload.get("sid") + self.unique_name: Optional[str] = payload.get("unique_name") + self.url: Optional[str] = payload.get("url") + + self._solution = { + "assistant_sid": assistant_sid, + "task_sid": task_sid, + "sid": sid or self.sid, + } + self._context: Optional[FieldContext] = None + + @property + def _proxy(self) -> "FieldContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: FieldContext for this FieldInstance + """ + if self._context is None: + self._context = FieldContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + sid=self._solution["sid"], + ) + return self._context + + def delete(self) -> bool: + """ + Deletes the FieldInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the FieldInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def fetch(self) -> "FieldInstance": + """ + Fetch the FieldInstance + + + :returns: The fetched FieldInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "FieldInstance": + """ + Asynchronous coroutine to fetch the FieldInstance + + + :returns: The fetched FieldInstance + """ + 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 FieldContext(InstanceContext): + def __init__(self, version: Version, assistant_sid: str, task_sid: str, sid: str): + """ + Initialize the FieldContext + + :param version: Version that contains the resource + :param assistant_sid: The unique ID of the Assistant. + :param task_sid: The unique ID of the Task associated with this Field. + :param sid: A 34 character string that uniquely identifies this resource. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + "task_sid": task_sid, + "sid": sid, + } + self._uri = "/Assistants/{assistant_sid}/Tasks/{task_sid}/Fields/{sid}".format( + **self._solution + ) + + def delete(self) -> bool: + """ + Deletes the FieldInstance + + + :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 FieldInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._version.delete_async( + method="DELETE", + uri=self._uri, + ) + + def fetch(self) -> FieldInstance: + """ + Fetch the FieldInstance + + + :returns: The fetched FieldInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return FieldInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + sid=self._solution["sid"], + ) + + async def fetch_async(self) -> FieldInstance: + """ + Asynchronous coroutine to fetch the FieldInstance + + + :returns: The fetched FieldInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return FieldInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_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 FieldPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> FieldInstance: + """ + Build an instance of FieldInstance + + :param payload: Payload response from the API + """ + return FieldInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class FieldList(ListResource): + def __init__(self, version: Version, assistant_sid: str, task_sid: str): + """ + Initialize the FieldList + + :param version: Version that contains the resource + :param assistant_sid: The unique ID of the Assistant. + :param task_sid: The unique ID of the Task associated with this Field. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + "task_sid": task_sid, + } + self._uri = "/Assistants/{assistant_sid}/Tasks/{task_sid}/Fields".format( + **self._solution + ) + + def create(self, field_type: str, unique_name: str) -> FieldInstance: + """ + Create the FieldInstance + + :param field_type: The unique name or sid of the FieldType. It can be any [Built-in Field Type](https://www.twilio.com/docs/assistant/api/built-in-field-types) or the unique_name or the Field Type sid of a custom Field Type. + :param unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. + + :returns: The created FieldInstance + """ + data = values.of( + { + "FieldType": field_type, + "UniqueName": unique_name, + } + ) + + payload = self._version.create( + method="POST", + uri=self._uri, + data=data, + ) + + return FieldInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + ) + + async def create_async(self, field_type: str, unique_name: str) -> FieldInstance: + """ + Asynchronously create the FieldInstance + + :param field_type: The unique name or sid of the FieldType. It can be any [Built-in Field Type](https://www.twilio.com/docs/assistant/api/built-in-field-types) or the unique_name or the Field Type sid of a custom Field Type. + :param unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. + + :returns: The created FieldInstance + """ + data = values.of( + { + "FieldType": field_type, + "UniqueName": unique_name, + } + ) + + payload = await self._version.create_async( + method="POST", + uri=self._uri, + data=data, + ) + + return FieldInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + ) + + def stream( + self, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[FieldInstance]: + """ + Streams FieldInstance 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[FieldInstance]: + """ + Asynchronously streams FieldInstance 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[FieldInstance]: + """ + Lists FieldInstance 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[FieldInstance]: + """ + Asynchronously lists FieldInstance 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, + ) -> FieldPage: + """ + Retrieve a single page of FieldInstance 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 FieldInstance + """ + data = values.of( + { + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = self._version.page(method="GET", uri=self._uri, params=data) + return FieldPage(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, + ) -> FieldPage: + """ + Asynchronously retrieve a single page of FieldInstance 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 FieldInstance + """ + 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 FieldPage(self._version, response, self._solution) + + def get_page(self, target_url: str) -> FieldPage: + """ + Retrieve a specific page of FieldInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of FieldInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return FieldPage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> FieldPage: + """ + Asynchronously retrieve a specific page of FieldInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of FieldInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return FieldPage(self._version, response, self._solution) + + def get(self, sid: str) -> FieldContext: + """ + Constructs a FieldContext + + :param sid: A 34 character string that uniquely identifies this resource. + """ + return FieldContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + sid=sid, + ) + + def __call__(self, sid: str) -> FieldContext: + """ + Constructs a FieldContext + + :param sid: A 34 character string that uniquely identifies this resource. + """ + return FieldContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + sid=sid, + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/preview/understand/assistant/task/sample.py b/twilio/rest/preview/understand/assistant/task/sample.py new file mode 100644 index 0000000000..ef8719c6ac --- /dev/null +++ b/twilio/rest/preview/understand/assistant/task/sample.py @@ -0,0 +1,697 @@ +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 SampleInstance(InstanceResource): + + """ + :ivar account_sid: The unique ID of the Account that created this Sample. + :ivar date_created: The date that this resource was created + :ivar date_updated: The date that this resource was last updated + :ivar task_sid: The unique ID of the Task associated with this Sample. + :ivar language: An ISO language-country string of the sample. + :ivar assistant_sid: The unique ID of the Assistant. + :ivar sid: A 34 character string that uniquely identifies this resource. + :ivar tagged_text: The text example of how end-users may express this task. The sample may contain Field tag blocks. + :ivar url: + :ivar source_channel: The communication channel the sample was captured. It can be: *voice*, *sms*, *chat*, *alexa*, *google-assistant*, or *slack*. If not included the value will be null + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + assistant_sid: str, + task_sid: str, + 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.task_sid: Optional[str] = payload.get("task_sid") + self.language: Optional[str] = payload.get("language") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.sid: Optional[str] = payload.get("sid") + self.tagged_text: Optional[str] = payload.get("tagged_text") + self.url: Optional[str] = payload.get("url") + self.source_channel: Optional[str] = payload.get("source_channel") + + self._solution = { + "assistant_sid": assistant_sid, + "task_sid": task_sid, + "sid": sid or self.sid, + } + self._context: Optional[SampleContext] = None + + @property + def _proxy(self) -> "SampleContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: SampleContext for this SampleInstance + """ + if self._context is None: + self._context = SampleContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + sid=self._solution["sid"], + ) + return self._context + + def delete(self) -> bool: + """ + Deletes the SampleInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the SampleInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def fetch(self) -> "SampleInstance": + """ + Fetch the SampleInstance + + + :returns: The fetched SampleInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "SampleInstance": + """ + Asynchronous coroutine to fetch the SampleInstance + + + :returns: The fetched SampleInstance + """ + return await self._proxy.fetch_async() + + def update( + self, + language: Union[str, object] = values.unset, + tagged_text: Union[str, object] = values.unset, + source_channel: Union[str, object] = values.unset, + ) -> "SampleInstance": + """ + Update the SampleInstance + + :param language: An ISO language-country string of the sample. + :param tagged_text: The text example of how end-users may express this task. The sample may contain Field tag blocks. + :param source_channel: The communication channel the sample was captured. It can be: *voice*, *sms*, *chat*, *alexa*, *google-assistant*, or *slack*. If not included the value will be null + + :returns: The updated SampleInstance + """ + return self._proxy.update( + language=language, + tagged_text=tagged_text, + source_channel=source_channel, + ) + + async def update_async( + self, + language: Union[str, object] = values.unset, + tagged_text: Union[str, object] = values.unset, + source_channel: Union[str, object] = values.unset, + ) -> "SampleInstance": + """ + Asynchronous coroutine to update the SampleInstance + + :param language: An ISO language-country string of the sample. + :param tagged_text: The text example of how end-users may express this task. The sample may contain Field tag blocks. + :param source_channel: The communication channel the sample was captured. It can be: *voice*, *sms*, *chat*, *alexa*, *google-assistant*, or *slack*. If not included the value will be null + + :returns: The updated SampleInstance + """ + return await self._proxy.update_async( + language=language, + tagged_text=tagged_text, + source_channel=source_channel, + ) + + 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 SampleContext(InstanceContext): + def __init__(self, version: Version, assistant_sid: str, task_sid: str, sid: str): + """ + Initialize the SampleContext + + :param version: Version that contains the resource + :param assistant_sid: The unique ID of the Assistant. + :param task_sid: The unique ID of the Task associated with this Sample. + :param sid: A 34 character string that uniquely identifies this resource. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + "task_sid": task_sid, + "sid": sid, + } + self._uri = "/Assistants/{assistant_sid}/Tasks/{task_sid}/Samples/{sid}".format( + **self._solution + ) + + def delete(self) -> bool: + """ + Deletes the SampleInstance + + + :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 SampleInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._version.delete_async( + method="DELETE", + uri=self._uri, + ) + + def fetch(self) -> SampleInstance: + """ + Fetch the SampleInstance + + + :returns: The fetched SampleInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return SampleInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + sid=self._solution["sid"], + ) + + async def fetch_async(self) -> SampleInstance: + """ + Asynchronous coroutine to fetch the SampleInstance + + + :returns: The fetched SampleInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return SampleInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + sid=self._solution["sid"], + ) + + def update( + self, + language: Union[str, object] = values.unset, + tagged_text: Union[str, object] = values.unset, + source_channel: Union[str, object] = values.unset, + ) -> SampleInstance: + """ + Update the SampleInstance + + :param language: An ISO language-country string of the sample. + :param tagged_text: The text example of how end-users may express this task. The sample may contain Field tag blocks. + :param source_channel: The communication channel the sample was captured. It can be: *voice*, *sms*, *chat*, *alexa*, *google-assistant*, or *slack*. If not included the value will be null + + :returns: The updated SampleInstance + """ + data = values.of( + { + "Language": language, + "TaggedText": tagged_text, + "SourceChannel": source_channel, + } + ) + + payload = self._version.update( + method="POST", + uri=self._uri, + data=data, + ) + + return SampleInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + sid=self._solution["sid"], + ) + + async def update_async( + self, + language: Union[str, object] = values.unset, + tagged_text: Union[str, object] = values.unset, + source_channel: Union[str, object] = values.unset, + ) -> SampleInstance: + """ + Asynchronous coroutine to update the SampleInstance + + :param language: An ISO language-country string of the sample. + :param tagged_text: The text example of how end-users may express this task. The sample may contain Field tag blocks. + :param source_channel: The communication channel the sample was captured. It can be: *voice*, *sms*, *chat*, *alexa*, *google-assistant*, or *slack*. If not included the value will be null + + :returns: The updated SampleInstance + """ + data = values.of( + { + "Language": language, + "TaggedText": tagged_text, + "SourceChannel": source_channel, + } + ) + + payload = await self._version.update_async( + method="POST", + uri=self._uri, + data=data, + ) + + return SampleInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_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 SamplePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> SampleInstance: + """ + Build an instance of SampleInstance + + :param payload: Payload response from the API + """ + return SampleInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" + + +class SampleList(ListResource): + def __init__(self, version: Version, assistant_sid: str, task_sid: str): + """ + Initialize the SampleList + + :param version: Version that contains the resource + :param assistant_sid: The unique ID of the Assistant. + :param task_sid: The unique ID of the Task associated with this Sample. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + "task_sid": task_sid, + } + self._uri = "/Assistants/{assistant_sid}/Tasks/{task_sid}/Samples".format( + **self._solution + ) + + def create( + self, + language: str, + tagged_text: str, + source_channel: Union[str, object] = values.unset, + ) -> SampleInstance: + """ + Create the SampleInstance + + :param language: An ISO language-country string of the sample. + :param tagged_text: The text example of how end-users may express this task. The sample may contain Field tag blocks. + :param source_channel: The communication channel the sample was captured. It can be: *voice*, *sms*, *chat*, *alexa*, *google-assistant*, or *slack*. If not included the value will be null + + :returns: The created SampleInstance + """ + data = values.of( + { + "Language": language, + "TaggedText": tagged_text, + "SourceChannel": source_channel, + } + ) + + payload = self._version.create( + method="POST", + uri=self._uri, + data=data, + ) + + return SampleInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + ) + + async def create_async( + self, + language: str, + tagged_text: str, + source_channel: Union[str, object] = values.unset, + ) -> SampleInstance: + """ + Asynchronously create the SampleInstance + + :param language: An ISO language-country string of the sample. + :param tagged_text: The text example of how end-users may express this task. The sample may contain Field tag blocks. + :param source_channel: The communication channel the sample was captured. It can be: *voice*, *sms*, *chat*, *alexa*, *google-assistant*, or *slack*. If not included the value will be null + + :returns: The created SampleInstance + """ + data = values.of( + { + "Language": language, + "TaggedText": tagged_text, + "SourceChannel": source_channel, + } + ) + + payload = await self._version.create_async( + method="POST", + uri=self._uri, + data=data, + ) + + return SampleInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + ) + + def stream( + self, + language: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> Iterator[SampleInstance]: + """ + Streams SampleInstance 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 language: An ISO language-country string of the sample. + :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(language=language, page_size=limits["page_size"]) + + return self._version.stream(page, limits["limit"]) + + async def stream_async( + self, + language: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> AsyncIterator[SampleInstance]: + """ + Asynchronously streams SampleInstance 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 language: An ISO language-country string of the sample. + :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(language=language, page_size=limits["page_size"]) + + return self._version.stream_async(page, limits["limit"]) + + def list( + self, + language: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[SampleInstance]: + """ + Lists SampleInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str language: An ISO language-country string of the sample. + :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( + language=language, + limit=limit, + page_size=page_size, + ) + ) + + async def list_async( + self, + language: Union[str, object] = values.unset, + limit: Optional[int] = None, + page_size: Optional[int] = None, + ) -> List[SampleInstance]: + """ + Asynchronously lists SampleInstance records from the API as a list. + Unlike stream(), this operation is eager and will load `limit` records into + memory before returning. + + :param str language: An ISO language-country string of the sample. + :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( + language=language, + limit=limit, + page_size=page_size, + ) + ] + + def page( + self, + language: 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, + ) -> SamplePage: + """ + Retrieve a single page of SampleInstance records from the API. + Request is executed immediately + + :param language: An ISO language-country string of the sample. + :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 SampleInstance + """ + data = values.of( + { + "Language": language, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = self._version.page(method="GET", uri=self._uri, params=data) + return SamplePage(self._version, response, self._solution) + + async def page_async( + self, + language: 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, + ) -> SamplePage: + """ + Asynchronously retrieve a single page of SampleInstance records from the API. + Request is executed immediately + + :param language: An ISO language-country string of the sample. + :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 SampleInstance + """ + data = values.of( + { + "Language": language, + "PageToken": page_token, + "Page": page_number, + "PageSize": page_size, + } + ) + + response = await self._version.page_async( + method="GET", uri=self._uri, params=data + ) + return SamplePage(self._version, response, self._solution) + + def get_page(self, target_url: str) -> SamplePage: + """ + Retrieve a specific page of SampleInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of SampleInstance + """ + response = self._version.domain.twilio.request("GET", target_url) + return SamplePage(self._version, response, self._solution) + + async def get_page_async(self, target_url: str) -> SamplePage: + """ + Asynchronously retrieve a specific page of SampleInstance records from the API. + Request is executed immediately + + :param target_url: API-generated URL for the requested results page + + :returns: Page of SampleInstance + """ + response = await self._version.domain.twilio.request_async("GET", target_url) + return SamplePage(self._version, response, self._solution) + + def get(self, sid: str) -> SampleContext: + """ + Constructs a SampleContext + + :param sid: A 34 character string that uniquely identifies this resource. + """ + return SampleContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + sid=sid, + ) + + def __call__(self, sid: str) -> SampleContext: + """ + Constructs a SampleContext + + :param sid: A 34 character string that uniquely identifies this resource. + """ + return SampleContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + sid=sid, + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/preview/understand/assistant/task/task_actions.py b/twilio/rest/preview/understand/assistant/task/task_actions.py new file mode 100644 index 0000000000..41366bbb96 --- /dev/null +++ b/twilio/rest/preview/understand/assistant/task/task_actions.py @@ -0,0 +1,301 @@ +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, 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 + + +class TaskActionsInstance(InstanceResource): + + """ + :ivar account_sid: The unique ID of the Account that created this Field. + :ivar assistant_sid: The unique ID of the parent Assistant. + :ivar task_sid: The unique ID of the Task. + :ivar url: + :ivar data: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + assistant_sid: str, + task_sid: str, + ): + super().__init__(version) + + self.account_sid: Optional[str] = payload.get("account_sid") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.task_sid: Optional[str] = payload.get("task_sid") + self.url: Optional[str] = payload.get("url") + self.data: Optional[Dict[str, object]] = payload.get("data") + + self._solution = { + "assistant_sid": assistant_sid, + "task_sid": task_sid, + } + self._context: Optional[TaskActionsContext] = None + + @property + def _proxy(self) -> "TaskActionsContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: TaskActionsContext for this TaskActionsInstance + """ + if self._context is None: + self._context = TaskActionsContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + ) + return self._context + + def fetch(self) -> "TaskActionsInstance": + """ + Fetch the TaskActionsInstance + + + :returns: The fetched TaskActionsInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "TaskActionsInstance": + """ + Asynchronous coroutine to fetch the TaskActionsInstance + + + :returns: The fetched TaskActionsInstance + """ + return await self._proxy.fetch_async() + + def update( + self, actions: Union[object, object] = values.unset + ) -> "TaskActionsInstance": + """ + Update the TaskActionsInstance + + :param actions: The JSON actions that instruct the Assistant how to perform this task. + + :returns: The updated TaskActionsInstance + """ + return self._proxy.update( + actions=actions, + ) + + async def update_async( + self, actions: Union[object, object] = values.unset + ) -> "TaskActionsInstance": + """ + Asynchronous coroutine to update the TaskActionsInstance + + :param actions: The JSON actions that instruct the Assistant how to perform this task. + + :returns: The updated TaskActionsInstance + """ + return await self._proxy.update_async( + actions=actions, + ) + + 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 TaskActionsContext(InstanceContext): + def __init__(self, version: Version, assistant_sid: str, task_sid: str): + """ + Initialize the TaskActionsContext + + :param version: Version that contains the resource + :param assistant_sid: The unique ID of the parent Assistant. + :param task_sid: The unique ID of the Task. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + "task_sid": task_sid, + } + self._uri = "/Assistants/{assistant_sid}/Tasks/{task_sid}/Actions".format( + **self._solution + ) + + def fetch(self) -> TaskActionsInstance: + """ + Fetch the TaskActionsInstance + + + :returns: The fetched TaskActionsInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return TaskActionsInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + ) + + async def fetch_async(self) -> TaskActionsInstance: + """ + Asynchronous coroutine to fetch the TaskActionsInstance + + + :returns: The fetched TaskActionsInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return TaskActionsInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + ) + + def update( + self, actions: Union[object, object] = values.unset + ) -> TaskActionsInstance: + """ + Update the TaskActionsInstance + + :param actions: The JSON actions that instruct the Assistant how to perform this task. + + :returns: The updated TaskActionsInstance + """ + data = values.of( + { + "Actions": serialize.object(actions), + } + ) + + payload = self._version.update( + method="POST", + uri=self._uri, + data=data, + ) + + return TaskActionsInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + ) + + async def update_async( + self, actions: Union[object, object] = values.unset + ) -> TaskActionsInstance: + """ + Asynchronous coroutine to update the TaskActionsInstance + + :param actions: The JSON actions that instruct the Assistant how to perform this task. + + :returns: The updated TaskActionsInstance + """ + data = values.of( + { + "Actions": serialize.object(actions), + } + ) + + payload = await self._version.update_async( + method="POST", + uri=self._uri, + data=data, + ) + + return TaskActionsInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_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 TaskActionsList(ListResource): + def __init__(self, version: Version, assistant_sid: str, task_sid: str): + """ + Initialize the TaskActionsList + + :param version: Version that contains the resource + :param assistant_sid: The unique ID of the parent Assistant. + :param task_sid: The unique ID of the Task. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + "task_sid": task_sid, + } + + def get(self) -> TaskActionsContext: + """ + Constructs a TaskActionsContext + + """ + return TaskActionsContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + ) + + def __call__(self) -> TaskActionsContext: + """ + Constructs a TaskActionsContext + + """ + return TaskActionsContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/preview/understand/assistant/task/task_statistics.py b/twilio/rest/preview/understand/assistant/task/task_statistics.py new file mode 100644 index 0000000000..07375954c7 --- /dev/null +++ b/twilio/rest/preview/understand/assistant/task/task_statistics.py @@ -0,0 +1,221 @@ +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, 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 TaskStatisticsInstance(InstanceResource): + + """ + :ivar account_sid: The unique ID of the Account that created this Field. + :ivar assistant_sid: The unique ID of the parent Assistant. + :ivar task_sid: The unique ID of the Task associated with this Field. + :ivar samples_count: The total number of Samples associated with this Task. + :ivar fields_count: The total number of Fields associated with this Task. + :ivar url: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + assistant_sid: str, + task_sid: str, + ): + super().__init__(version) + + self.account_sid: Optional[str] = payload.get("account_sid") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.task_sid: Optional[str] = payload.get("task_sid") + self.samples_count: Optional[int] = deserialize.integer( + payload.get("samples_count") + ) + self.fields_count: Optional[int] = deserialize.integer( + payload.get("fields_count") + ) + self.url: Optional[str] = payload.get("url") + + self._solution = { + "assistant_sid": assistant_sid, + "task_sid": task_sid, + } + self._context: Optional[TaskStatisticsContext] = None + + @property + def _proxy(self) -> "TaskStatisticsContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: TaskStatisticsContext for this TaskStatisticsInstance + """ + if self._context is None: + self._context = TaskStatisticsContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + ) + return self._context + + def fetch(self) -> "TaskStatisticsInstance": + """ + Fetch the TaskStatisticsInstance + + + :returns: The fetched TaskStatisticsInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "TaskStatisticsInstance": + """ + Asynchronous coroutine to fetch the TaskStatisticsInstance + + + :returns: The fetched TaskStatisticsInstance + """ + 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 TaskStatisticsContext(InstanceContext): + def __init__(self, version: Version, assistant_sid: str, task_sid: str): + """ + Initialize the TaskStatisticsContext + + :param version: Version that contains the resource + :param assistant_sid: The unique ID of the parent Assistant. + :param task_sid: The unique ID of the Task associated with this Field. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + "task_sid": task_sid, + } + self._uri = "/Assistants/{assistant_sid}/Tasks/{task_sid}/Statistics".format( + **self._solution + ) + + def fetch(self) -> TaskStatisticsInstance: + """ + Fetch the TaskStatisticsInstance + + + :returns: The fetched TaskStatisticsInstance + """ + + payload = self._version.fetch( + method="GET", + uri=self._uri, + ) + + return TaskStatisticsInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + ) + + async def fetch_async(self) -> TaskStatisticsInstance: + """ + Asynchronous coroutine to fetch the TaskStatisticsInstance + + + :returns: The fetched TaskStatisticsInstance + """ + + payload = await self._version.fetch_async( + method="GET", + uri=self._uri, + ) + + return TaskStatisticsInstance( + self._version, + payload, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_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 TaskStatisticsList(ListResource): + def __init__(self, version: Version, assistant_sid: str, task_sid: str): + """ + Initialize the TaskStatisticsList + + :param version: Version that contains the resource + :param assistant_sid: The unique ID of the parent Assistant. + :param task_sid: The unique ID of the Task associated with this Field. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "assistant_sid": assistant_sid, + "task_sid": task_sid, + } + + def get(self) -> TaskStatisticsContext: + """ + Constructs a TaskStatisticsContext + + """ + return TaskStatisticsContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + ) + + def __call__(self) -> TaskStatisticsContext: + """ + Constructs a TaskStatisticsContext + + """ + return TaskStatisticsContext( + self._version, + assistant_sid=self._solution["assistant_sid"], + task_sid=self._solution["task_sid"], + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/preview/wireless/command.py b/twilio/rest/preview/wireless/command.py index b8cc4d6a02..4f3e4603af 100644 --- a/twilio/rest/preview/wireless/command.py +++ b/twilio/rest/preview/wireless/command.py @@ -225,7 +225,6 @@ def create( :returns: The created CommandInstance """ - data = values.of( { "Command": command, @@ -269,7 +268,6 @@ async def create_async( :returns: The created CommandInstance """ - data = values.of( { "Command": command, diff --git a/twilio/rest/preview/wireless/rate_plan.py b/twilio/rest/preview/wireless/rate_plan.py index 08ace21fb0..04b16f5b38 100644 --- a/twilio/rest/preview/wireless/rate_plan.py +++ b/twilio/rest/preview/wireless/rate_plan.py @@ -375,7 +375,6 @@ def create( :returns: The created RatePlanInstance """ - data = values.of( { "UniqueName": unique_name, @@ -430,7 +429,6 @@ async def create_async( :returns: The created RatePlanInstance """ - data = values.of( { "UniqueName": unique_name, diff --git a/twilio/rest/proxy/v1/service/__init__.py b/twilio/rest/proxy/v1/service/__init__.py index 0cd90e817e..ec886ad2bb 100644 --- a/twilio/rest/proxy/v1/service/__init__.py +++ b/twilio/rest/proxy/v1/service/__init__.py @@ -532,7 +532,6 @@ def create( :returns: The created ServiceInstance """ - data = values.of( { "UniqueName": unique_name, @@ -581,7 +580,6 @@ async def create_async( :returns: The created ServiceInstance """ - data = values.of( { "UniqueName": unique_name, diff --git a/twilio/rest/proxy/v1/service/phone_number.py b/twilio/rest/proxy/v1/service/phone_number.py index ec0af3dde9..fc8c514f13 100644 --- a/twilio/rest/proxy/v1/service/phone_number.py +++ b/twilio/rest/proxy/v1/service/phone_number.py @@ -366,7 +366,6 @@ def create( :returns: The created PhoneNumberInstance """ - data = values.of( { "Sid": sid, @@ -400,7 +399,6 @@ async def create_async( :returns: The created PhoneNumberInstance """ - data = values.of( { "Sid": sid, diff --git a/twilio/rest/proxy/v1/service/session/__init__.py b/twilio/rest/proxy/v1/service/session/__init__.py index 1c9dc055a9..7ce76fcab5 100644 --- a/twilio/rest/proxy/v1/service/session/__init__.py +++ b/twilio/rest/proxy/v1/service/session/__init__.py @@ -470,7 +470,6 @@ def create( :returns: The created SessionInstance """ - data = values.of( { "UniqueName": unique_name, @@ -515,7 +514,6 @@ async def create_async( :returns: The created SessionInstance """ - data = values.of( { "UniqueName": unique_name, diff --git a/twilio/rest/proxy/v1/service/session/interaction.py b/twilio/rest/proxy/v1/service/session/interaction.py index 8ce2846d51..145da3a703 100644 --- a/twilio/rest/proxy/v1/service/session/interaction.py +++ b/twilio/rest/proxy/v1/service/session/interaction.py @@ -60,7 +60,7 @@ class Type(object): :ivar data: A JSON string that includes the message body of message interactions (e.g. `{\"body\": \"hello\"}`) or the call duration (when available) of a call (e.g. `{\"duration\": \"5\"}`). :ivar type: :ivar inbound_participant_sid: The SID of the inbound [Participant](https://www.twilio.com/docs/proxy/api/participant) resource. - :ivar inbound_resource_sid: The SID of the inbound resource; either the [Call](https://www.twilio.com/docs/voice/api/call-resource) or [Message](https://www.twilio.com/docs/sms/api/message-resource). + :ivar inbound_resource_sid: The SID of the inbound resource; either the [Call](https://www.twilio.com/docs/voice/api/call-resource) or [Message](https://www.twilio.com/docs/sms/api/message. :ivar inbound_resource_status: :ivar inbound_resource_type: The inbound resource type. Can be [Call](https://www.twilio.com/docs/voice/api/call-resource) or [Message](https://www.twilio.com/docs/sms/api/message-resource). :ivar inbound_resource_url: The URL of the Twilio inbound resource diff --git a/twilio/rest/proxy/v1/service/session/participant/__init__.py b/twilio/rest/proxy/v1/service/session/participant/__init__.py index a14b19a95b..ce3c16abd0 100644 --- a/twilio/rest/proxy/v1/service/session/participant/__init__.py +++ b/twilio/rest/proxy/v1/service/session/participant/__init__.py @@ -330,7 +330,6 @@ def create( :returns: The created ParticipantInstance """ - data = values.of( { "Identifier": identifier, @@ -370,7 +369,6 @@ async def create_async( :returns: The created ParticipantInstance """ - data = values.of( { "Identifier": identifier, 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 d2b60ce95c..b07b1782fa 100644 --- a/twilio/rest/proxy/v1/service/session/participant/message_interaction.py +++ b/twilio/rest/proxy/v1/service/session/participant/message_interaction.py @@ -322,7 +322,6 @@ def create( :returns: The created MessageInteractionInstance """ - data = values.of( { "Body": body, @@ -357,7 +356,6 @@ async def create_async( :returns: The created MessageInteractionInstance """ - data = values.of( { "Body": body, diff --git a/twilio/rest/proxy/v1/service/short_code.py b/twilio/rest/proxy/v1/service/short_code.py index ccda96db4e..27dc8467f1 100644 --- a/twilio/rest/proxy/v1/service/short_code.py +++ b/twilio/rest/proxy/v1/service/short_code.py @@ -349,11 +349,10 @@ def create(self, sid: str) -> ShortCodeInstance: """ Create the ShortCodeInstance - :param sid: The SID of a Twilio [ShortCode](https://www.twilio.com/en-us/messaging/channels/sms/short-codes) resource that represents the short code you would like to assign to your Proxy Service. + :param sid: The SID of a Twilio [ShortCode](https://www.twilio.com/docs/sms/api/short-code) resource that represents the short code you would like to assign to your Proxy Service. :returns: The created ShortCodeInstance """ - data = values.of( { "Sid": sid, @@ -374,11 +373,10 @@ async def create_async(self, sid: str) -> ShortCodeInstance: """ Asynchronously create the ShortCodeInstance - :param sid: The SID of a Twilio [ShortCode](https://www.twilio.com/en-us/messaging/channels/sms/short-codes) resource that represents the short code you would like to assign to your Proxy Service. + :param sid: The SID of a Twilio [ShortCode](https://www.twilio.com/docs/sms/api/short-code) resource that represents the short code you would like to assign to your Proxy Service. :returns: The created ShortCodeInstance """ - data = values.of( { "Sid": sid, diff --git a/twilio/rest/serverless/v1/service/__init__.py b/twilio/rest/serverless/v1/service/__init__.py index ab58c0eb8d..146827d812 100644 --- a/twilio/rest/serverless/v1/service/__init__.py +++ b/twilio/rest/serverless/v1/service/__init__.py @@ -450,7 +450,6 @@ def create( :returns: The created ServiceInstance """ - data = values.of( { "UniqueName": unique_name, @@ -485,7 +484,6 @@ async def create_async( :returns: The created ServiceInstance """ - data = values.of( { "UniqueName": unique_name, diff --git a/twilio/rest/serverless/v1/service/asset/__init__.py b/twilio/rest/serverless/v1/service/asset/__init__.py index 38f3598109..7b70adf1c4 100644 --- a/twilio/rest/serverless/v1/service/asset/__init__.py +++ b/twilio/rest/serverless/v1/service/asset/__init__.py @@ -364,7 +364,6 @@ def create(self, friendly_name: str) -> AssetInstance: :returns: The created AssetInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -389,7 +388,6 @@ async def create_async(self, friendly_name: str) -> AssetInstance: :returns: The created AssetInstance """ - data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/serverless/v1/service/build/__init__.py b/twilio/rest/serverless/v1/service/build/__init__.py index 25997bec2e..0fe3b8f923 100644 --- a/twilio/rest/serverless/v1/service/build/__init__.py +++ b/twilio/rest/serverless/v1/service/build/__init__.py @@ -32,7 +32,6 @@ class Runtime(object): NODE12 = "node12" NODE14 = "node14" NODE16 = "node16" - NODE18 = "node18" class Status(object): BUILDING = "building" @@ -62,9 +61,9 @@ def __init__(self, version: Version, payload: Dict[str, Any], service_sid: str, self.account_sid: Optional[str] = payload.get("account_sid") self.service_sid: Optional[str] = payload.get("service_sid") self.status: Optional["BuildInstance.Status"] = payload.get("status") - self.asset_versions: Optional[List[Dict[str, object]]] = payload.get("asset_versions") - self.function_versions: Optional[List[Dict[str, object]]] = payload.get("function_versions") - self.dependencies: Optional[List[Dict[str, object]]] = payload.get("dependencies") + self.asset_versions: Optional[List[object]] = payload.get("asset_versions") + self.function_versions: Optional[List[object]] = payload.get("function_versions") + self.dependencies: Optional[List[object]] = payload.get("dependencies") self.runtime: Optional["BuildInstance.Runtime"] = payload.get("runtime") self.date_created: Optional[datetime] = deserialize.iso8601_datetime(payload.get("date_created")) self.date_updated: Optional[datetime] = deserialize.iso8601_datetime(payload.get("date_updated")) @@ -275,7 +274,7 @@ def __repr__(self) -> str: class BuildList(ListResource): - + def __init__(self, version: Version, service_sid: str): """ Initialize the BuildList @@ -306,7 +305,6 @@ def create(self, asset_versions: Union[List[str], object]=values.unset, function :returns: The created BuildInstance """ - data = values.of({ 'AssetVersions': serialize.map(asset_versions, lambda e: e), 'FunctionVersions': serialize.map(function_versions, lambda e: e), @@ -314,7 +312,6 @@ def create(self, asset_versions: Union[List[str], object]=values.unset, function 'Runtime': runtime, }) - payload = self._version.create(method='POST', uri=self._uri, data=data,) return BuildInstance(self._version, payload, service_sid=self._solution['service_sid']) @@ -330,7 +327,6 @@ async def create_async(self, asset_versions: Union[List[str], object]=values.uns :returns: The created BuildInstance """ - data = values.of({ 'AssetVersions': serialize.map(asset_versions, lambda e: e), 'FunctionVersions': serialize.map(function_versions, lambda e: e), @@ -338,7 +334,6 @@ async def create_async(self, asset_versions: Union[List[str], object]=values.uns 'Runtime': runtime, }) - 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/serverless/v1/service/build/build_status.py b/twilio/rest/serverless/v1/service/build/build_status.py index 2613ae3cb6..c127f89a4f 100644 --- a/twilio/rest/serverless/v1/service/build/build_status.py +++ b/twilio/rest/serverless/v1/service/build/build_status.py @@ -164,7 +164,7 @@ def __repr__(self) -> str: class BuildStatusList(ListResource): - + def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the BuildStatusList diff --git a/twilio/rest/serverless/v1/service/environment/__init__.py b/twilio/rest/serverless/v1/service/environment/__init__.py index 235c77739f..dac46b9744 100644 --- a/twilio/rest/serverless/v1/service/environment/__init__.py +++ b/twilio/rest/serverless/v1/service/environment/__init__.py @@ -341,7 +341,6 @@ def create( :returns: The created EnvironmentInstance """ - data = values.of( { "UniqueName": unique_name, @@ -370,7 +369,6 @@ async def create_async( :returns: The created EnvironmentInstance """ - data = values.of( { "UniqueName": unique_name, diff --git a/twilio/rest/serverless/v1/service/environment/deployment.py b/twilio/rest/serverless/v1/service/environment/deployment.py index 6667bd891c..f0f6b50037 100644 --- a/twilio/rest/serverless/v1/service/environment/deployment.py +++ b/twilio/rest/serverless/v1/service/environment/deployment.py @@ -243,7 +243,6 @@ def create( :returns: The created DeploymentInstance """ - data = values.of( { "BuildSid": build_sid, @@ -273,7 +272,6 @@ async def create_async( :returns: The created DeploymentInstance """ - data = values.of( { "BuildSid": build_sid, diff --git a/twilio/rest/serverless/v1/service/environment/variable.py b/twilio/rest/serverless/v1/service/environment/variable.py index b64484f57f..b619e3a655 100644 --- a/twilio/rest/serverless/v1/service/environment/variable.py +++ b/twilio/rest/serverless/v1/service/environment/variable.py @@ -390,7 +390,6 @@ def create(self, key: str, value: str) -> VariableInstance: :returns: The created VariableInstance """ - data = values.of( { "Key": key, @@ -420,7 +419,6 @@ async def create_async(self, key: str, value: str) -> VariableInstance: :returns: The created VariableInstance """ - data = values.of( { "Key": key, diff --git a/twilio/rest/serverless/v1/service/function/__init__.py b/twilio/rest/serverless/v1/service/function/__init__.py index 7b9718e246..3f2919316d 100644 --- a/twilio/rest/serverless/v1/service/function/__init__.py +++ b/twilio/rest/serverless/v1/service/function/__init__.py @@ -366,7 +366,6 @@ def create(self, friendly_name: str) -> FunctionInstance: :returns: The created FunctionInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -391,7 +390,6 @@ async def create_async(self, friendly_name: str) -> FunctionInstance: :returns: The created FunctionInstance """ - data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/studio/v1/flow/engagement/__init__.py b/twilio/rest/studio/v1/flow/engagement/__init__.py index 8271fa2c96..e0f56dbaf7 100644 --- a/twilio/rest/studio/v1/flow/engagement/__init__.py +++ b/twilio/rest/studio/v1/flow/engagement/__init__.py @@ -325,7 +325,6 @@ def create( :returns: The created EngagementInstance """ - data = values.of( { "To": to, @@ -356,7 +355,6 @@ async def create_async( :returns: The created EngagementInstance """ - data = values.of( { "To": to, diff --git a/twilio/rest/studio/v1/flow/execution/__init__.py b/twilio/rest/studio/v1/flow/execution/__init__.py index c4cfd09c49..d0ad05b67a 100644 --- a/twilio/rest/studio/v1/flow/execution/__init__.py +++ b/twilio/rest/studio/v1/flow/execution/__init__.py @@ -405,7 +405,6 @@ def create( :returns: The created ExecutionInstance """ - data = values.of( { "To": to, @@ -436,7 +435,6 @@ async def create_async( :returns: The created ExecutionInstance """ - data = values.of( { "To": to, diff --git a/twilio/rest/studio/v2/flow/__init__.py b/twilio/rest/studio/v2/flow/__init__.py index dafec94320..408e29cc7b 100644 --- a/twilio/rest/studio/v2/flow/__init__.py +++ b/twilio/rest/studio/v2/flow/__init__.py @@ -62,8 +62,8 @@ def __init__( self.revision: Optional[int] = deserialize.integer(payload.get("revision")) self.commit_message: Optional[str] = payload.get("commit_message") self.valid: Optional[bool] = payload.get("valid") - self.errors: Optional[List[Dict[str, object]]] = payload.get("errors") - self.warnings: Optional[List[Dict[str, object]]] = payload.get("warnings") + self.errors: Optional[List[object]] = payload.get("errors") + self.warnings: Optional[List[object]] = payload.get("warnings") self.date_created: Optional[datetime] = deserialize.iso8601_datetime( payload.get("date_created") ) @@ -452,7 +452,6 @@ def create( :returns: The created FlowInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -487,7 +486,6 @@ async def create_async( :returns: The created FlowInstance """ - data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/studio/v2/flow/execution/__init__.py b/twilio/rest/studio/v2/flow/execution/__init__.py index de539fa596..1173683525 100644 --- a/twilio/rest/studio/v2/flow/execution/__init__.py +++ b/twilio/rest/studio/v2/flow/execution/__init__.py @@ -403,7 +403,6 @@ def create( :returns: The created ExecutionInstance """ - data = values.of( { "To": to, @@ -434,7 +433,6 @@ async def create_async( :returns: The created ExecutionInstance """ - data = values.of( { "To": to, diff --git a/twilio/rest/studio/v2/flow/flow_revision.py b/twilio/rest/studio/v2/flow/flow_revision.py index 64c50b0a3d..a9a5394a4f 100644 --- a/twilio/rest/studio/v2/flow/flow_revision.py +++ b/twilio/rest/studio/v2/flow/flow_revision.py @@ -60,7 +60,7 @@ def __init__( self.revision: Optional[int] = deserialize.integer(payload.get("revision")) self.commit_message: Optional[str] = payload.get("commit_message") self.valid: Optional[bool] = payload.get("valid") - self.errors: Optional[List[Dict[str, object]]] = payload.get("errors") + self.errors: Optional[List[object]] = payload.get("errors") self.date_created: Optional[datetime] = deserialize.iso8601_datetime( payload.get("date_created") ) diff --git a/twilio/rest/supersim/v1/esim_profile.py b/twilio/rest/supersim/v1/esim_profile.py index d8b83546ae..230ac298a8 100644 --- a/twilio/rest/supersim/v1/esim_profile.py +++ b/twilio/rest/supersim/v1/esim_profile.py @@ -36,7 +36,7 @@ class Status(object): :ivar sid: The unique string that we created to identify the eSIM Profile resource. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) to which the eSIM Profile resource belongs. :ivar iccid: The [ICCID](https://en.wikipedia.org/wiki/Subscriber_identity_module#ICCID) associated with the Sim resource. - :ivar sim_sid: The SID of the [Sim](https://www.twilio.com/docs/iot/supersim/api/sim-resource) resource that this eSIM Profile controls. + :ivar sim_sid: The SID of the [Sim](https://www.twilio.com/docs/iot/wireless/api/sim-resource) resource that this eSIM Profile controls. :ivar status: :ivar eid: Identifier of the eUICC that can claim the eSIM Profile. :ivar smdp_plus_address: Address of the SM-DP+ server from which the Profile will be downloaded. The URL will appear once the eSIM Profile reaches the status `available`. @@ -232,7 +232,6 @@ def create( :returns: The created EsimProfileInstance """ - data = values.of( { "CallbackUrl": callback_url, @@ -267,7 +266,6 @@ async def create_async( :returns: The created EsimProfileInstance """ - data = values.of( { "CallbackUrl": callback_url, @@ -300,7 +298,7 @@ def stream( The results are returned as a generator, so this operation is memory efficient. :param str eid: List the eSIM Profiles that have been associated with an EId. - :param str sim_sid: Find the eSIM Profile resource related to a [Sim](https://www.twilio.com/docs/iot/supersim/api/sim-resource) resource by providing the SIM SID. Will always return an array with either 1 or 0 records. + :param str sim_sid: Find the eSIM Profile resource related to a [Sim](https://www.twilio.com/docs/iot/wireless/api/sim-resource) resource by providing the SIM SID. Will always return an array with either 1 or 0 records. :param "EsimProfileInstance.Status" status: List the eSIM Profiles that are in a given status. :param limit: Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit @@ -333,7 +331,7 @@ async def stream_async( The results are returned as a generator, so this operation is memory efficient. :param str eid: List the eSIM Profiles that have been associated with an EId. - :param str sim_sid: Find the eSIM Profile resource related to a [Sim](https://www.twilio.com/docs/iot/supersim/api/sim-resource) resource by providing the SIM SID. Will always return an array with either 1 or 0 records. + :param str sim_sid: Find the eSIM Profile resource related to a [Sim](https://www.twilio.com/docs/iot/wireless/api/sim-resource) resource by providing the SIM SID. Will always return an array with either 1 or 0 records. :param "EsimProfileInstance.Status" status: List the eSIM Profiles that are in a given status. :param limit: Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit @@ -365,7 +363,7 @@ def list( memory before returning. :param str eid: List the eSIM Profiles that have been associated with an EId. - :param str sim_sid: Find the eSIM Profile resource related to a [Sim](https://www.twilio.com/docs/iot/supersim/api/sim-resource) resource by providing the SIM SID. Will always return an array with either 1 or 0 records. + :param str sim_sid: Find the eSIM Profile resource related to a [Sim](https://www.twilio.com/docs/iot/wireless/api/sim-resource) resource by providing the SIM SID. Will always return an array with either 1 or 0 records. :param "EsimProfileInstance.Status" status: List the eSIM Profiles that are in a given status. :param limit: Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit @@ -400,7 +398,7 @@ async def list_async( memory before returning. :param str eid: List the eSIM Profiles that have been associated with an EId. - :param str sim_sid: Find the eSIM Profile resource related to a [Sim](https://www.twilio.com/docs/iot/supersim/api/sim-resource) resource by providing the SIM SID. Will always return an array with either 1 or 0 records. + :param str sim_sid: Find the eSIM Profile resource related to a [Sim](https://www.twilio.com/docs/iot/wireless/api/sim-resource) resource by providing the SIM SID. Will always return an array with either 1 or 0 records. :param "EsimProfileInstance.Status" status: List the eSIM Profiles that are in a given status. :param limit: Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit @@ -436,7 +434,7 @@ def page( Request is executed immediately :param eid: List the eSIM Profiles that have been associated with an EId. - :param sim_sid: Find the eSIM Profile resource related to a [Sim](https://www.twilio.com/docs/iot/supersim/api/sim-resource) resource by providing the SIM SID. Will always return an array with either 1 or 0 records. + :param sim_sid: Find the eSIM Profile resource related to a [Sim](https://www.twilio.com/docs/iot/wireless/api/sim-resource) resource by providing the SIM SID. Will always return an array with either 1 or 0 records. :param status: List the eSIM Profiles that are in a given status. :param page_token: PageToken provided by the API :param page_number: Page Number, this value is simply for client state @@ -472,7 +470,7 @@ async def page_async( Request is executed immediately :param eid: List the eSIM Profiles that have been associated with an EId. - :param sim_sid: Find the eSIM Profile resource related to a [Sim](https://www.twilio.com/docs/iot/supersim/api/sim-resource) resource by providing the SIM SID. Will always return an array with either 1 or 0 records. + :param sim_sid: Find the eSIM Profile resource related to a [Sim](https://www.twilio.com/docs/iot/wireless/api/sim-resource) resource by providing the SIM SID. Will always return an array with either 1 or 0 records. :param status: List the eSIM Profiles that are in a given status. :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/supersim/v1/fleet.py b/twilio/rest/supersim/v1/fleet.py index e09ea796fc..0017ff4e92 100644 --- a/twilio/rest/supersim/v1/fleet.py +++ b/twilio/rest/supersim/v1/fleet.py @@ -395,7 +395,6 @@ def create( :returns: The created FleetInstance """ - data = values.of( { "NetworkAccessProfile": network_access_profile, @@ -445,7 +444,6 @@ async def create_async( :returns: The created FleetInstance """ - data = values.of( { "NetworkAccessProfile": network_access_profile, diff --git a/twilio/rest/supersim/v1/ip_command.py b/twilio/rest/supersim/v1/ip_command.py index fd49bd8a83..98e6e2a0a5 100644 --- a/twilio/rest/supersim/v1/ip_command.py +++ b/twilio/rest/supersim/v1/ip_command.py @@ -246,7 +246,6 @@ def create( :returns: The created IpCommandInstance """ - data = values.of( { "Sim": sim, @@ -287,7 +286,6 @@ async def create_async( :returns: The created IpCommandInstance """ - data = values.of( { "Sim": sim, diff --git a/twilio/rest/supersim/v1/network.py b/twilio/rest/supersim/v1/network.py index a526c8dfbc..7364105c88 100644 --- a/twilio/rest/supersim/v1/network.py +++ b/twilio/rest/supersim/v1/network.py @@ -41,7 +41,7 @@ def __init__( self.friendly_name: Optional[str] = payload.get("friendly_name") self.url: Optional[str] = payload.get("url") self.iso_country: Optional[str] = payload.get("iso_country") - self.identifiers: Optional[List[Dict[str, object]]] = payload.get("identifiers") + self.identifiers: Optional[List[object]] = payload.get("identifiers") self._solution = { "sid": sid or self.sid, diff --git a/twilio/rest/supersim/v1/network_access_profile/__init__.py b/twilio/rest/supersim/v1/network_access_profile/__init__.py index 3e2b65d9c5..0712dbe653 100644 --- a/twilio/rest/supersim/v1/network_access_profile/__init__.py +++ b/twilio/rest/supersim/v1/network_access_profile/__init__.py @@ -311,7 +311,6 @@ def create( :returns: The created NetworkAccessProfileInstance """ - data = values.of( { "UniqueName": unique_name, @@ -340,7 +339,6 @@ async def create_async( :returns: The created NetworkAccessProfileInstance """ - data = values.of( { "UniqueName": unique_name, 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 a6ef54e514..065418f39d 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 @@ -48,7 +48,7 @@ def __init__( ) self.friendly_name: Optional[str] = payload.get("friendly_name") self.iso_country: Optional[str] = payload.get("iso_country") - self.identifiers: Optional[List[Dict[str, object]]] = payload.get("identifiers") + self.identifiers: Optional[List[object]] = payload.get("identifiers") self.url: Optional[str] = payload.get("url") self._solution = { @@ -272,7 +272,6 @@ def create(self, network: str) -> NetworkAccessProfileNetworkInstance: :returns: The created NetworkAccessProfileNetworkInstance """ - data = values.of( { "Network": network, @@ -299,7 +298,6 @@ async def create_async(self, network: str) -> NetworkAccessProfileNetworkInstanc :returns: The created NetworkAccessProfileNetworkInstance """ - data = values.of( { "Network": network, diff --git a/twilio/rest/supersim/v1/settings_update.py b/twilio/rest/supersim/v1/settings_update.py index 75a58a1967..d9b00143ad 100644 --- a/twilio/rest/supersim/v1/settings_update.py +++ b/twilio/rest/supersim/v1/settings_update.py @@ -48,7 +48,7 @@ def __init__(self, version: Version, payload: Dict[str, Any]): self.iccid: Optional[str] = payload.get("iccid") self.sim_sid: Optional[str] = payload.get("sim_sid") self.status: Optional["SettingsUpdateInstance.Status"] = payload.get("status") - self.packages: Optional[List[Dict[str, object]]] = payload.get("packages") + self.packages: Optional[List[object]] = payload.get("packages") self.date_completed: Optional[datetime] = deserialize.iso8601_datetime( payload.get("date_completed") ) diff --git a/twilio/rest/supersim/v1/sim/__init__.py b/twilio/rest/supersim/v1/sim/__init__.py index 7b2636869b..fae9427497 100644 --- a/twilio/rest/supersim/v1/sim/__init__.py +++ b/twilio/rest/supersim/v1/sim/__init__.py @@ -403,7 +403,6 @@ def create(self, iccid: str, registration_code: str) -> SimInstance: :returns: The created SimInstance """ - data = values.of( { "Iccid": iccid, @@ -428,7 +427,6 @@ async def create_async(self, iccid: str, registration_code: str) -> SimInstance: :returns: The created SimInstance """ - data = values.of( { "Iccid": iccid, diff --git a/twilio/rest/supersim/v1/sms_command.py b/twilio/rest/supersim/v1/sms_command.py index 9e68e71b76..83601dd7ce 100644 --- a/twilio/rest/supersim/v1/sms_command.py +++ b/twilio/rest/supersim/v1/sms_command.py @@ -227,7 +227,6 @@ def create( :returns: The created SmsCommandInstance """ - data = values.of( { "Sim": sim, @@ -262,7 +261,6 @@ async def create_async( :returns: The created SmsCommandInstance """ - data = values.of( { "Sim": sim, diff --git a/twilio/rest/sync/v1/service/__init__.py b/twilio/rest/sync/v1/service/__init__.py index 8e640535da..7db062b90d 100644 --- a/twilio/rest/sync/v1/service/__init__.py +++ b/twilio/rest/sync/v1/service/__init__.py @@ -518,7 +518,6 @@ def create( :returns: The created ServiceInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -562,7 +561,6 @@ async def create_async( :returns: The created ServiceInstance """ - data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/sync/v1/service/document/__init__.py b/twilio/rest/sync/v1/service/document/__init__.py index 847dbccb34..5689594a8a 100644 --- a/twilio/rest/sync/v1/service/document/__init__.py +++ b/twilio/rest/sync/v1/service/document/__init__.py @@ -423,7 +423,6 @@ def create( :returns: The created DocumentInstance """ - data = values.of( { "UniqueName": unique_name, @@ -457,7 +456,6 @@ async def create_async( :returns: The created DocumentInstance """ - data = values.of( { "UniqueName": unique_name, diff --git a/twilio/rest/sync/v1/service/sync_list/__init__.py b/twilio/rest/sync/v1/service/sync_list/__init__.py index 9606162600..545ebee389 100644 --- a/twilio/rest/sync/v1/service/sync_list/__init__.py +++ b/twilio/rest/sync/v1/service/sync_list/__init__.py @@ -427,7 +427,6 @@ def create( :returns: The created SyncListInstance """ - data = values.of( { "UniqueName": unique_name, @@ -461,7 +460,6 @@ async def create_async( :returns: The created SyncListInstance """ - data = values.of( { "UniqueName": unique_name, 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 0959b0e516..640b4c38ce 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 @@ -463,7 +463,6 @@ def create( :returns: The created SyncListItemInstance """ - data = values.of( { "Data": serialize.object(data), @@ -503,7 +502,6 @@ async def create_async( :returns: The created SyncListItemInstance """ - data = values.of( { "Data": serialize.object(data), diff --git a/twilio/rest/sync/v1/service/sync_map/__init__.py b/twilio/rest/sync/v1/service/sync_map/__init__.py index 9f034f5583..5b38378f2b 100644 --- a/twilio/rest/sync/v1/service/sync_map/__init__.py +++ b/twilio/rest/sync/v1/service/sync_map/__init__.py @@ -427,7 +427,6 @@ def create( :returns: The created SyncMapInstance """ - data = values.of( { "UniqueName": unique_name, @@ -461,7 +460,6 @@ async def create_async( :returns: The created SyncMapInstance """ - data = values.of( { "UniqueName": unique_name, 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 e3a7f321b0..ef290caab2 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 @@ -465,7 +465,6 @@ def create( :returns: The created SyncMapItemInstance """ - data = values.of( { "Key": key, @@ -508,7 +507,6 @@ async def create_async( :returns: The created SyncMapItemInstance """ - data = values.of( { "Key": key, diff --git a/twilio/rest/sync/v1/service/sync_stream/__init__.py b/twilio/rest/sync/v1/service/sync_stream/__init__.py index 584783c98a..59507674dd 100644 --- a/twilio/rest/sync/v1/service/sync_stream/__init__.py +++ b/twilio/rest/sync/v1/service/sync_stream/__init__.py @@ -379,7 +379,6 @@ def create( :returns: The created SyncStreamInstance """ - data = values.of( { "UniqueName": unique_name, @@ -410,7 +409,6 @@ async def create_async( :returns: The created SyncStreamInstance """ - data = values.of( { "UniqueName": unique_name, 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 eb9ac365bf..5227bb076b 100644 --- a/twilio/rest/sync/v1/service/sync_stream/stream_message.py +++ b/twilio/rest/sync/v1/service/sync_stream/stream_message.py @@ -84,7 +84,6 @@ def create(self, data: object) -> StreamMessageInstance: :returns: The created StreamMessageInstance """ - data = values.of( { "Data": serialize.object(data), @@ -112,7 +111,6 @@ async def create_async(self, data: object) -> StreamMessageInstance: :returns: The created StreamMessageInstance """ - data = values.of( { "Data": serialize.object(data), diff --git a/twilio/rest/taskrouter/v1/workspace/__init__.py b/twilio/rest/taskrouter/v1/workspace/__init__.py index 479abeaa8a..886ba65c93 100644 --- a/twilio/rest/taskrouter/v1/workspace/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/__init__.py @@ -657,7 +657,6 @@ def create( :returns: The created WorkspaceInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -700,7 +699,6 @@ async def create_async( :returns: The created WorkspaceInstance """ - data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/taskrouter/v1/workspace/activity.py b/twilio/rest/taskrouter/v1/workspace/activity.py index 91a18c7822..b233113d33 100644 --- a/twilio/rest/taskrouter/v1/workspace/activity.py +++ b/twilio/rest/taskrouter/v1/workspace/activity.py @@ -356,7 +356,6 @@ def create( :returns: The created ActivityInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -385,7 +384,6 @@ async def create_async( :returns: The created ActivityInstance """ - data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/taskrouter/v1/workspace/task/__init__.py b/twilio/rest/taskrouter/v1/workspace/task/__init__.py index f62da1759f..74c5a8fee4 100644 --- a/twilio/rest/taskrouter/v1/workspace/task/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/task/__init__.py @@ -38,7 +38,7 @@ class Status(object): :ivar age: The number of seconds since the Task was created. :ivar assignment_status: :ivar attributes: The JSON string with custom attributes of the work. **Note** If this property has been assigned a value, it will only be displayed in FETCH action that returns a single resource. Otherwise, it will be null. - :ivar addons: An object that contains the [Add-on](https://www.twilio.com/docs/add-ons) data for all installed Add-ons. + :ivar addons: An object that contains the [addon](https://www.twilio.com/docs/taskrouter/marketplace) data for all installed addons. :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 task_queue_entered_date: The date and time in GMT when the Task entered the TaskQueue, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. @@ -528,7 +528,6 @@ def create( :returns: The created TaskInstance """ - data = values.of( { "Timeout": timeout, @@ -571,7 +570,6 @@ async def create_async( :returns: The created TaskInstance """ - data = values.of( { "Timeout": timeout, @@ -621,7 +619,7 @@ def stream( :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 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 bool has_addons: Whether to read Tasks with addons. If `true`, returns only Tasks with addons. If `false`, returns only Tasks without addons. :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 @@ -675,7 +673,7 @@ async def stream_async( :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 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 bool has_addons: Whether to read Tasks with addons. If `true`, returns only Tasks with addons. If `false`, returns only Tasks without addons. :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 @@ -728,7 +726,7 @@ def list( :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 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 bool has_addons: Whether to read Tasks with addons. If `true`, returns only Tasks with addons. If `false`, returns only Tasks without addons. :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 @@ -781,7 +779,7 @@ async def list_async( :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 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 bool has_addons: Whether to read Tasks with addons. If `true`, returns only Tasks with addons. If `false`, returns only Tasks without addons. :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 @@ -835,7 +833,7 @@ def page( :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 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 has_addons: Whether to read Tasks with addons. If `true`, returns only Tasks with addons. If `false`, returns only Tasks without addons. :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 @@ -889,7 +887,7 @@ async def page_async( :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 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 has_addons: Whether to read Tasks with addons. If `true`, returns only Tasks with addons. If `false`, returns only Tasks without addons. :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/taskrouter/v1/workspace/task/reservation.py b/twilio/rest/taskrouter/v1/workspace/task/reservation.py index af50984004..32e7c6b4da 100644 --- a/twilio/rest/taskrouter/v1/workspace/task/reservation.py +++ b/twilio/rest/taskrouter/v1/workspace/task/reservation.py @@ -200,7 +200,6 @@ def update( supervisor: Union[str, object] = values.unset, end_conference_on_customer_exit: Union[bool, object] = values.unset, beep_on_customer_entrance: Union[bool, object] = values.unset, - jitter_buffer_size: Union[str, object] = values.unset, ) -> "ReservationInstance": """ Update the ReservationInstance @@ -259,7 +258,6 @@ def update( :param supervisor: The Supervisor SID/URI when executing the Supervise instruction. :param end_conference_on_customer_exit: Whether to end the conference when the customer leaves. :param beep_on_customer_entrance: Whether to play a notification beep when the customer joins. - :param jitter_buffer_size: The jitter buffer size for conference. Can be: `small`, `medium`, `large`, `off`. :returns: The updated ReservationInstance """ @@ -318,7 +316,6 @@ def update( supervisor=supervisor, end_conference_on_customer_exit=end_conference_on_customer_exit, beep_on_customer_entrance=beep_on_customer_entrance, - jitter_buffer_size=jitter_buffer_size, ) async def update_async( @@ -383,7 +380,6 @@ async def update_async( supervisor: Union[str, object] = values.unset, end_conference_on_customer_exit: Union[bool, object] = values.unset, beep_on_customer_entrance: Union[bool, object] = values.unset, - jitter_buffer_size: Union[str, object] = values.unset, ) -> "ReservationInstance": """ Asynchronous coroutine to update the ReservationInstance @@ -442,7 +438,6 @@ async def update_async( :param supervisor: The Supervisor SID/URI when executing the Supervise instruction. :param end_conference_on_customer_exit: Whether to end the conference when the customer leaves. :param beep_on_customer_entrance: Whether to play a notification beep when the customer joins. - :param jitter_buffer_size: The jitter buffer size for conference. Can be: `small`, `medium`, `large`, `off`. :returns: The updated ReservationInstance """ @@ -501,7 +496,6 @@ async def update_async( supervisor=supervisor, end_conference_on_customer_exit=end_conference_on_customer_exit, beep_on_customer_entrance=beep_on_customer_entrance, - jitter_buffer_size=jitter_buffer_size, ) def __repr__(self) -> str: @@ -642,7 +636,6 @@ def update( supervisor: Union[str, object] = values.unset, end_conference_on_customer_exit: Union[bool, object] = values.unset, beep_on_customer_entrance: Union[bool, object] = values.unset, - jitter_buffer_size: Union[str, object] = values.unset, ) -> ReservationInstance: """ Update the ReservationInstance @@ -701,7 +694,6 @@ def update( :param supervisor: The Supervisor SID/URI when executing the Supervise instruction. :param end_conference_on_customer_exit: Whether to end the conference when the customer leaves. :param beep_on_customer_entrance: Whether to play a notification beep when the customer joins. - :param jitter_buffer_size: The jitter buffer size for conference. Can be: `small`, `medium`, `large`, `off`. :returns: The updated ReservationInstance """ @@ -766,7 +758,6 @@ def update( "Supervisor": supervisor, "EndConferenceOnCustomerExit": end_conference_on_customer_exit, "BeepOnCustomerEntrance": beep_on_customer_entrance, - "JitterBufferSize": jitter_buffer_size, } ) headers = values.of( @@ -849,7 +840,6 @@ async def update_async( supervisor: Union[str, object] = values.unset, end_conference_on_customer_exit: Union[bool, object] = values.unset, beep_on_customer_entrance: Union[bool, object] = values.unset, - jitter_buffer_size: Union[str, object] = values.unset, ) -> ReservationInstance: """ Asynchronous coroutine to update the ReservationInstance @@ -908,7 +898,6 @@ async def update_async( :param supervisor: The Supervisor SID/URI when executing the Supervise instruction. :param end_conference_on_customer_exit: Whether to end the conference when the customer leaves. :param beep_on_customer_entrance: Whether to play a notification beep when the customer joins. - :param jitter_buffer_size: The jitter buffer size for conference. Can be: `small`, `medium`, `large`, `off`. :returns: The updated ReservationInstance """ @@ -973,7 +962,6 @@ async def update_async( "Supervisor": supervisor, "EndConferenceOnCustomerExit": end_conference_on_customer_exit, "BeepOnCustomerEntrance": beep_on_customer_entrance, - "JitterBufferSize": jitter_buffer_size, } ) headers = values.of( diff --git a/twilio/rest/taskrouter/v1/workspace/task_channel.py b/twilio/rest/taskrouter/v1/workspace/task_channel.py index 5744a3cba4..d6408dcd74 100644 --- a/twilio/rest/taskrouter/v1/workspace/task_channel.py +++ b/twilio/rest/taskrouter/v1/workspace/task_channel.py @@ -380,7 +380,6 @@ def create( :returns: The created TaskChannelInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -414,7 +413,6 @@ async def create_async( :returns: The created TaskChannelInstance """ - data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue/__init__.py b/twilio/rest/taskrouter/v1/workspace/task_queue/__init__.py index 2091338d65..cc523c8514 100644 --- a/twilio/rest/taskrouter/v1/workspace/task_queue/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/task_queue/__init__.py @@ -535,7 +535,6 @@ def create( :returns: The created TaskQueueInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -578,7 +577,6 @@ async def create_async( :returns: The created TaskQueueInstance """ - data = values.of( { "FriendlyName": friendly_name, 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 1fc18c16f1..d588f99d4d 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 @@ -50,7 +50,7 @@ def __init__( super().__init__(version) self.account_sid: Optional[str] = payload.get("account_sid") - self.activity_statistics: Optional[List[Dict[str, object]]] = payload.get( + self.activity_statistics: Optional[List[object]] = payload.get( "activity_statistics" ) self.longest_task_waiting_age: Optional[int] = deserialize.integer( diff --git a/twilio/rest/taskrouter/v1/workspace/worker/__init__.py b/twilio/rest/taskrouter/v1/workspace/worker/__init__.py index 5eecad38ba..104731aeda 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/__init__.py @@ -522,7 +522,6 @@ def create( :returns: The created WorkerInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -556,7 +555,6 @@ async def create_async( :returns: The created WorkerInstance """ - data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/taskrouter/v1/workspace/worker/reservation.py b/twilio/rest/taskrouter/v1/workspace/worker/reservation.py index 24727b114d..e99705d669 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/reservation.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/reservation.py @@ -191,7 +191,6 @@ def update( post_work_activity_sid: Union[str, object] = values.unset, end_conference_on_customer_exit: Union[bool, object] = values.unset, beep_on_customer_entrance: Union[bool, object] = values.unset, - jitter_buffer_size: Union[str, object] = values.unset, ) -> "ReservationInstance": """ Update the ReservationInstance @@ -248,7 +247,6 @@ def update( :param post_work_activity_sid: The new worker activity SID after executing a Conference instruction. :param end_conference_on_customer_exit: Whether to end the conference when the customer leaves. :param beep_on_customer_entrance: Whether to play a notification beep when the customer joins. - :param jitter_buffer_size: The jitter buffer size for conference. Can be: `small`, `medium`, `large`, `off`. :returns: The updated ReservationInstance """ @@ -305,7 +303,6 @@ def update( post_work_activity_sid=post_work_activity_sid, end_conference_on_customer_exit=end_conference_on_customer_exit, beep_on_customer_entrance=beep_on_customer_entrance, - jitter_buffer_size=jitter_buffer_size, ) async def update_async( @@ -366,7 +363,6 @@ async def update_async( post_work_activity_sid: Union[str, object] = values.unset, end_conference_on_customer_exit: Union[bool, object] = values.unset, beep_on_customer_entrance: Union[bool, object] = values.unset, - jitter_buffer_size: Union[str, object] = values.unset, ) -> "ReservationInstance": """ Asynchronous coroutine to update the ReservationInstance @@ -423,7 +419,6 @@ async def update_async( :param post_work_activity_sid: The new worker activity SID after executing a Conference instruction. :param end_conference_on_customer_exit: Whether to end the conference when the customer leaves. :param beep_on_customer_entrance: Whether to play a notification beep when the customer joins. - :param jitter_buffer_size: The jitter buffer size for conference. Can be: `small`, `medium`, `large`, `off`. :returns: The updated ReservationInstance """ @@ -480,7 +475,6 @@ async def update_async( post_work_activity_sid=post_work_activity_sid, end_conference_on_customer_exit=end_conference_on_customer_exit, beep_on_customer_entrance=beep_on_customer_entrance, - jitter_buffer_size=jitter_buffer_size, ) def __repr__(self) -> str: @@ -615,7 +609,6 @@ def update( post_work_activity_sid: Union[str, object] = values.unset, end_conference_on_customer_exit: Union[bool, object] = values.unset, beep_on_customer_entrance: Union[bool, object] = values.unset, - jitter_buffer_size: Union[str, object] = values.unset, ) -> ReservationInstance: """ Update the ReservationInstance @@ -672,7 +665,6 @@ def update( :param post_work_activity_sid: The new worker activity SID after executing a Conference instruction. :param end_conference_on_customer_exit: Whether to end the conference when the customer leaves. :param beep_on_customer_entrance: Whether to play a notification beep when the customer joins. - :param jitter_buffer_size: The jitter buffer size for conference. Can be: `small`, `medium`, `large`, `off`. :returns: The updated ReservationInstance """ @@ -735,7 +727,6 @@ def update( "PostWorkActivitySid": post_work_activity_sid, "EndConferenceOnCustomerExit": end_conference_on_customer_exit, "BeepOnCustomerEntrance": beep_on_customer_entrance, - "JitterBufferSize": jitter_buffer_size, } ) headers = values.of( @@ -814,7 +805,6 @@ async def update_async( post_work_activity_sid: Union[str, object] = values.unset, end_conference_on_customer_exit: Union[bool, object] = values.unset, beep_on_customer_entrance: Union[bool, object] = values.unset, - jitter_buffer_size: Union[str, object] = values.unset, ) -> ReservationInstance: """ Asynchronous coroutine to update the ReservationInstance @@ -871,7 +861,6 @@ async def update_async( :param post_work_activity_sid: The new worker activity SID after executing a Conference instruction. :param end_conference_on_customer_exit: Whether to end the conference when the customer leaves. :param beep_on_customer_entrance: Whether to play a notification beep when the customer joins. - :param jitter_buffer_size: The jitter buffer size for conference. Can be: `small`, `medium`, `large`, `off`. :returns: The updated ReservationInstance """ @@ -934,7 +923,6 @@ async def update_async( "PostWorkActivitySid": post_work_activity_sid, "EndConferenceOnCustomerExit": end_conference_on_customer_exit, "BeepOnCustomerEntrance": beep_on_customer_entrance, - "JitterBufferSize": jitter_buffer_size, } ) headers = values.of( 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 dad1f6ff26..14310b05bb 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.py @@ -49,7 +49,7 @@ def __init__(self, version: Version, payload: Dict[str, Any], workspace_sid: str self.end_time: Optional[datetime] = deserialize.iso8601_datetime( payload.get("end_time") ) - self.activity_durations: Optional[List[Dict[str, object]]] = payload.get( + self.activity_durations: Optional[List[object]] = payload.get( "activity_durations" ) self.reservations_created: Optional[int] = deserialize.integer( 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 8047c65ad8..c59611dcfa 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 @@ -35,7 +35,7 @@ def __init__(self, version: Version, payload: Dict[str, Any], workspace_sid: str super().__init__(version) self.account_sid: Optional[str] = payload.get("account_sid") - self.activity_statistics: Optional[List[Dict[str, object]]] = payload.get( + self.activity_statistics: Optional[List[object]] = payload.get( "activity_statistics" ) self.total_workers: Optional[int] = deserialize.integer( diff --git a/twilio/rest/taskrouter/v1/workspace/workflow/__init__.py b/twilio/rest/taskrouter/v1/workspace/workflow/__init__.py index dff4bd0ba8..04cbba20b7 100644 --- a/twilio/rest/taskrouter/v1/workspace/workflow/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/workflow/__init__.py @@ -515,7 +515,6 @@ def create( :returns: The created WorkflowInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -555,7 +554,6 @@ async def create_async( :returns: The created WorkflowInstance """ - data = values.of( { "FriendlyName": friendly_name, 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 8571bf3e05..d69600d7f2 100644 --- a/twilio/rest/taskrouter/v1/workspace/workspace_real_time_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/workspace_real_time_statistics.py @@ -40,7 +40,7 @@ def __init__(self, version: Version, payload: Dict[str, Any], workspace_sid: str super().__init__(version) self.account_sid: Optional[str] = payload.get("account_sid") - self.activity_statistics: Optional[List[Dict[str, object]]] = payload.get( + self.activity_statistics: Optional[List[object]] = payload.get( "activity_statistics" ) self.longest_task_waiting_age: Optional[int] = deserialize.integer( diff --git a/twilio/rest/trunking/v1/trunk/__init__.py b/twilio/rest/trunking/v1/trunk/__init__.py index 4b1b8c7937..e7a0aa5cfd 100644 --- a/twilio/rest/trunking/v1/trunk/__init__.py +++ b/twilio/rest/trunking/v1/trunk/__init__.py @@ -575,7 +575,6 @@ def create( :returns: The created TrunkInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -624,7 +623,6 @@ async def create_async( :returns: The created TrunkInstance """ - data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/trunking/v1/trunk/credential_list.py b/twilio/rest/trunking/v1/trunk/credential_list.py index 3caf6e5423..805d66260d 100644 --- a/twilio/rest/trunking/v1/trunk/credential_list.py +++ b/twilio/rest/trunking/v1/trunk/credential_list.py @@ -261,7 +261,6 @@ def create(self, credential_list_sid: str) -> CredentialListInstance: :returns: The created CredentialListInstance """ - data = values.of( { "CredentialListSid": credential_list_sid, @@ -286,7 +285,6 @@ async def create_async(self, credential_list_sid: str) -> CredentialListInstance :returns: The created CredentialListInstance """ - data = values.of( { "CredentialListSid": credential_list_sid, 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 38d6e4f03e..e528e0b1c3 100644 --- a/twilio/rest/trunking/v1/trunk/ip_access_control_list.py +++ b/twilio/rest/trunking/v1/trunk/ip_access_control_list.py @@ -263,7 +263,6 @@ def create(self, ip_access_control_list_sid: str) -> IpAccessControlListInstance :returns: The created IpAccessControlListInstance """ - data = values.of( { "IpAccessControlListSid": ip_access_control_list_sid, @@ -290,7 +289,6 @@ async def create_async( :returns: The created IpAccessControlListInstance """ - data = values.of( { "IpAccessControlListSid": ip_access_control_list_sid, diff --git a/twilio/rest/trunking/v1/trunk/origination_url.py b/twilio/rest/trunking/v1/trunk/origination_url.py index 2b7f48f436..79dca9387b 100644 --- a/twilio/rest/trunking/v1/trunk/origination_url.py +++ b/twilio/rest/trunking/v1/trunk/origination_url.py @@ -418,7 +418,6 @@ def create( :returns: The created OriginationUrlInstance """ - data = values.of( { "Weight": weight, @@ -458,7 +457,6 @@ async def create_async( :returns: The created OriginationUrlInstance """ - data = values.of( { "Weight": weight, diff --git a/twilio/rest/trunking/v1/trunk/phone_number.py b/twilio/rest/trunking/v1/trunk/phone_number.py index 41b78e4627..98f53c408f 100644 --- a/twilio/rest/trunking/v1/trunk/phone_number.py +++ b/twilio/rest/trunking/v1/trunk/phone_number.py @@ -310,7 +310,6 @@ def create(self, phone_number_sid: str) -> PhoneNumberInstance: :returns: The created PhoneNumberInstance """ - data = values.of( { "PhoneNumberSid": phone_number_sid, @@ -335,7 +334,6 @@ async def create_async(self, phone_number_sid: str) -> PhoneNumberInstance: :returns: The created PhoneNumberInstance """ - data = values.of( { "PhoneNumberSid": phone_number_sid, diff --git a/twilio/rest/trusthub/v1/__init__.py b/twilio/rest/trusthub/v1/__init__.py index 7d11abd1ec..10c3fd825b 100644 --- a/twilio/rest/trusthub/v1/__init__.py +++ b/twilio/rest/trusthub/v1/__init__.py @@ -16,9 +16,6 @@ from twilio.base.version import Version from twilio.base.domain import Domain from twilio.rest.trusthub.v1.compliance_inquiries import ComplianceInquiriesList -from twilio.rest.trusthub.v1.compliance_tollfree_inquiries import ( - ComplianceTollfreeInquiriesList, -) from twilio.rest.trusthub.v1.customer_profiles import CustomerProfilesList from twilio.rest.trusthub.v1.end_user import EndUserList from twilio.rest.trusthub.v1.end_user_type import EndUserTypeList @@ -37,9 +34,6 @@ def __init__(self, domain: Domain): """ super().__init__(domain, "v1") self._compliance_inquiries: Optional[ComplianceInquiriesList] = None - self._compliance_tollfree_inquiries: Optional[ - ComplianceTollfreeInquiriesList - ] = None self._customer_profiles: Optional[CustomerProfilesList] = None self._end_users: Optional[EndUserList] = None self._end_user_types: Optional[EndUserTypeList] = None @@ -54,12 +48,6 @@ def compliance_inquiries(self) -> ComplianceInquiriesList: self._compliance_inquiries = ComplianceInquiriesList(self) return self._compliance_inquiries - @property - def compliance_tollfree_inquiries(self) -> ComplianceTollfreeInquiriesList: - if self._compliance_tollfree_inquiries is None: - self._compliance_tollfree_inquiries = ComplianceTollfreeInquiriesList(self) - return self._compliance_tollfree_inquiries - @property def customer_profiles(self) -> CustomerProfilesList: if self._customer_profiles is None: diff --git a/twilio/rest/trusthub/v1/compliance_inquiries.py b/twilio/rest/trusthub/v1/compliance_inquiries.py index 7a55b1ad7d..c5c88d9155 100644 --- a/twilio/rest/trusthub/v1/compliance_inquiries.py +++ b/twilio/rest/trusthub/v1/compliance_inquiries.py @@ -197,7 +197,6 @@ def create(self, primary_profile_sid: str) -> ComplianceInquiriesInstance: :returns: The created ComplianceInquiriesInstance """ - data = values.of( { "PrimaryProfileSid": primary_profile_sid, @@ -222,7 +221,6 @@ async def create_async( :returns: The created ComplianceInquiriesInstance """ - data = values.of( { "PrimaryProfileSid": primary_profile_sid, diff --git a/twilio/rest/trusthub/v1/compliance_tollfree_inquiries.py b/twilio/rest/trusthub/v1/compliance_tollfree_inquiries.py deleted file mode 100644 index 17f01e5aa2..0000000000 --- a/twilio/rest/trusthub/v1/compliance_tollfree_inquiries.py +++ /dev/null @@ -1,251 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Trusthub - 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 serialize, values - -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.version import Version - - -class ComplianceTollfreeInquiriesInstance(InstanceResource): - class OptInType(object): - VERBAL = "VERBAL" - WEB_FORM = "WEB_FORM" - PAPER_FORM = "PAPER_FORM" - VIA_TEXT = "VIA_TEXT" - MOBILE_QR_CODE = "MOBILE_QR_CODE" - - """ - :ivar inquiry_id: The unique ID used to start an embedded compliance registration session. - :ivar inquiry_session_token: The session token used to start an embedded compliance registration session. - :ivar registration_id: The TolfreeId matching the Tollfree Profile that should be resumed or resubmitted for editing. - :ivar url: The URL of this resource. - """ - - def __init__(self, version: Version, payload: Dict[str, Any]): - super().__init__(version) - - self.inquiry_id: Optional[str] = payload.get("inquiry_id") - self.inquiry_session_token: Optional[str] = payload.get("inquiry_session_token") - self.registration_id: Optional[str] = payload.get("registration_id") - self.url: Optional[str] = payload.get("url") - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - - return "" - - -class ComplianceTollfreeInquiriesList(ListResource): - def __init__(self, version: Version): - """ - Initialize the ComplianceTollfreeInquiriesList - - :param version: Version that contains the resource - - """ - super().__init__(version) - - self._uri = "/ComplianceInquiries/Tollfree/Initialize" - - def create( - self, - tollfree_phone_number: str, - notification_email: str, - business_name: Union[str, object] = values.unset, - business_website: Union[str, object] = values.unset, - use_case_categories: Union[List[str], object] = values.unset, - use_case_summary: Union[str, object] = values.unset, - production_message_sample: Union[str, object] = values.unset, - opt_in_image_urls: Union[List[str], object] = values.unset, - opt_in_type: Union[ - "ComplianceTollfreeInquiriesInstance.OptInType", object - ] = values.unset, - message_volume: Union[str, object] = values.unset, - business_street_address: Union[str, object] = values.unset, - business_street_address2: Union[str, object] = values.unset, - business_city: Union[str, object] = values.unset, - business_state_province_region: Union[str, object] = values.unset, - business_postal_code: Union[str, object] = values.unset, - business_country: Union[str, object] = values.unset, - additional_information: Union[str, object] = values.unset, - business_contact_first_name: Union[str, object] = values.unset, - 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, - ) -> ComplianceTollfreeInquiriesInstance: - """ - Create the ComplianceTollfreeInquiriesInstance - - :param tollfree_phone_number: The Tollfree phone number to be verified - :param notification_email: The email address to receive the notification about the verification result. - :param business_name: The name of the business or organization using the Tollfree number. - :param business_website: The website of the business or organization using the Tollfree number. - :param use_case_categories: The category of the use case for the Tollfree Number. List as many are applicable.. - :param use_case_summary: Use this to further explain how messaging is used by the business or organization. - :param production_message_sample: An example of message content, i.e. a sample message. - :param opt_in_image_urls: Link to an image that shows the opt-in workflow. Multiple images allowed and must be a publicly hosted URL. - :param opt_in_type: - :param message_volume: Estimate monthly volume of messages from the Tollfree Number. - :param business_street_address: The address of the business or organization using the Tollfree number. - :param business_street_address2: The address of the business or organization using the Tollfree number. - :param business_city: The city of the business or organization using the Tollfree number. - :param business_state_province_region: The state/province/region of the business or organization using the Tollfree number. - :param business_postal_code: The postal code of the business or organization using the Tollfree number. - :param business_country: The country of the business or organization using the Tollfree number. - :param additional_information: Additional information to be provided for verification. - :param business_contact_first_name: The first name of the contact for the business or organization using the Tollfree number. - :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. - - :returns: The created ComplianceTollfreeInquiriesInstance - """ - - data = values.of( - { - "TollfreePhoneNumber": tollfree_phone_number, - "NotificationEmail": notification_email, - "BusinessName": business_name, - "BusinessWebsite": business_website, - "UseCaseCategories": serialize.map(use_case_categories, lambda e: e), - "UseCaseSummary": use_case_summary, - "ProductionMessageSample": production_message_sample, - "OptInImageUrls": serialize.map(opt_in_image_urls, lambda e: e), - "OptInType": opt_in_type, - "MessageVolume": message_volume, - "BusinessStreetAddress": business_street_address, - "BusinessStreetAddress2": business_street_address2, - "BusinessCity": business_city, - "BusinessStateProvinceRegion": business_state_province_region, - "BusinessPostalCode": business_postal_code, - "BusinessCountry": business_country, - "AdditionalInformation": additional_information, - "BusinessContactFirstName": business_contact_first_name, - "BusinessContactLastName": business_contact_last_name, - "BusinessContactEmail": business_contact_email, - "BusinessContactPhone": business_contact_phone, - } - ) - - payload = self._version.create( - method="POST", - uri=self._uri, - data=data, - ) - - return ComplianceTollfreeInquiriesInstance(self._version, payload) - - async def create_async( - self, - tollfree_phone_number: str, - notification_email: str, - business_name: Union[str, object] = values.unset, - business_website: Union[str, object] = values.unset, - use_case_categories: Union[List[str], object] = values.unset, - use_case_summary: Union[str, object] = values.unset, - production_message_sample: Union[str, object] = values.unset, - opt_in_image_urls: Union[List[str], object] = values.unset, - opt_in_type: Union[ - "ComplianceTollfreeInquiriesInstance.OptInType", object - ] = values.unset, - message_volume: Union[str, object] = values.unset, - business_street_address: Union[str, object] = values.unset, - business_street_address2: Union[str, object] = values.unset, - business_city: Union[str, object] = values.unset, - business_state_province_region: Union[str, object] = values.unset, - business_postal_code: Union[str, object] = values.unset, - business_country: Union[str, object] = values.unset, - additional_information: Union[str, object] = values.unset, - business_contact_first_name: Union[str, object] = values.unset, - 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, - ) -> ComplianceTollfreeInquiriesInstance: - """ - Asynchronously create the ComplianceTollfreeInquiriesInstance - - :param tollfree_phone_number: The Tollfree phone number to be verified - :param notification_email: The email address to receive the notification about the verification result. - :param business_name: The name of the business or organization using the Tollfree number. - :param business_website: The website of the business or organization using the Tollfree number. - :param use_case_categories: The category of the use case for the Tollfree Number. List as many are applicable.. - :param use_case_summary: Use this to further explain how messaging is used by the business or organization. - :param production_message_sample: An example of message content, i.e. a sample message. - :param opt_in_image_urls: Link to an image that shows the opt-in workflow. Multiple images allowed and must be a publicly hosted URL. - :param opt_in_type: - :param message_volume: Estimate monthly volume of messages from the Tollfree Number. - :param business_street_address: The address of the business or organization using the Tollfree number. - :param business_street_address2: The address of the business or organization using the Tollfree number. - :param business_city: The city of the business or organization using the Tollfree number. - :param business_state_province_region: The state/province/region of the business or organization using the Tollfree number. - :param business_postal_code: The postal code of the business or organization using the Tollfree number. - :param business_country: The country of the business or organization using the Tollfree number. - :param additional_information: Additional information to be provided for verification. - :param business_contact_first_name: The first name of the contact for the business or organization using the Tollfree number. - :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. - - :returns: The created ComplianceTollfreeInquiriesInstance - """ - - data = values.of( - { - "TollfreePhoneNumber": tollfree_phone_number, - "NotificationEmail": notification_email, - "BusinessName": business_name, - "BusinessWebsite": business_website, - "UseCaseCategories": serialize.map(use_case_categories, lambda e: e), - "UseCaseSummary": use_case_summary, - "ProductionMessageSample": production_message_sample, - "OptInImageUrls": serialize.map(opt_in_image_urls, lambda e: e), - "OptInType": opt_in_type, - "MessageVolume": message_volume, - "BusinessStreetAddress": business_street_address, - "BusinessStreetAddress2": business_street_address2, - "BusinessCity": business_city, - "BusinessStateProvinceRegion": business_state_province_region, - "BusinessPostalCode": business_postal_code, - "BusinessCountry": business_country, - "AdditionalInformation": additional_information, - "BusinessContactFirstName": business_contact_first_name, - "BusinessContactLastName": business_contact_last_name, - "BusinessContactEmail": business_contact_email, - "BusinessContactPhone": business_contact_phone, - } - ) - - payload = await self._version.create_async( - method="POST", - uri=self._uri, - data=data, - ) - - return ComplianceTollfreeInquiriesInstance(self._version, payload) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" diff --git a/twilio/rest/trusthub/v1/customer_profiles/__init__.py b/twilio/rest/trusthub/v1/customer_profiles/__init__.py index c1fa25cce5..a82fafa4da 100644 --- a/twilio/rest/trusthub/v1/customer_profiles/__init__.py +++ b/twilio/rest/trusthub/v1/customer_profiles/__init__.py @@ -479,7 +479,6 @@ def create( :returns: The created CustomerProfilesInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -514,7 +513,6 @@ async def create_async( :returns: The created CustomerProfilesInstance """ - data = values.of( { "FriendlyName": friendly_name, 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 41bc67e834..e1905c1ac5 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 @@ -274,7 +274,6 @@ def create( :returns: The created CustomerProfilesChannelEndpointAssignmentInstance """ - data = values.of( { "ChannelEndpointType": channel_endpoint_type, @@ -305,7 +304,6 @@ async def create_async( :returns: The created CustomerProfilesChannelEndpointAssignmentInstance """ - data = values.of( { "ChannelEndpointType": channel_endpoint_type, 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 6003f56602..c318b539cc 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 @@ -275,7 +275,6 @@ def create(self, object_sid: str) -> CustomerProfilesEntityAssignmentsInstance: :returns: The created CustomerProfilesEntityAssignmentsInstance """ - data = values.of( { "ObjectSid": object_sid, @@ -304,7 +303,6 @@ async def create_async( :returns: The created CustomerProfilesEntityAssignmentsInstance """ - data = values.of( { "ObjectSid": object_sid, 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 0b5f88b626..c3611f7647 100644 --- a/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_evaluations.py +++ b/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_evaluations.py @@ -55,7 +55,7 @@ def __init__( self.status: Optional[ "CustomerProfilesEvaluationsInstance.Status" ] = payload.get("status") - self.results: Optional[List[Dict[str, object]]] = payload.get("results") + self.results: Optional[List[object]] = payload.get("results") self.date_created: Optional[datetime] = deserialize.iso8601_datetime( payload.get("date_created") ) @@ -236,7 +236,6 @@ def create(self, policy_sid: str) -> CustomerProfilesEvaluationsInstance: :returns: The created CustomerProfilesEvaluationsInstance """ - data = values.of( { "PolicySid": policy_sid, @@ -265,7 +264,6 @@ async def create_async( :returns: The created CustomerProfilesEvaluationsInstance """ - data = values.of( { "PolicySid": policy_sid, diff --git a/twilio/rest/trusthub/v1/end_user.py b/twilio/rest/trusthub/v1/end_user.py index c72cb6222c..05f096b6c3 100644 --- a/twilio/rest/trusthub/v1/end_user.py +++ b/twilio/rest/trusthub/v1/end_user.py @@ -345,7 +345,6 @@ def create( :returns: The created EndUserInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -377,7 +376,6 @@ async def create_async( :returns: The created EndUserInstance """ - data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/trusthub/v1/end_user_type.py b/twilio/rest/trusthub/v1/end_user_type.py index f3d79d2a60..391012e1ac 100644 --- a/twilio/rest/trusthub/v1/end_user_type.py +++ b/twilio/rest/trusthub/v1/end_user_type.py @@ -40,7 +40,7 @@ def __init__( self.sid: Optional[str] = payload.get("sid") self.friendly_name: Optional[str] = payload.get("friendly_name") self.machine_name: Optional[str] = payload.get("machine_name") - self.fields: Optional[List[Dict[str, object]]] = payload.get("fields") + self.fields: Optional[List[object]] = payload.get("fields") self.url: Optional[str] = payload.get("url") self._solution = { diff --git a/twilio/rest/trusthub/v1/supporting_document.py b/twilio/rest/trusthub/v1/supporting_document.py index e532756197..f1f29a4afa 100644 --- a/twilio/rest/trusthub/v1/supporting_document.py +++ b/twilio/rest/trusthub/v1/supporting_document.py @@ -362,7 +362,6 @@ def create( :returns: The created SupportingDocumentInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -394,7 +393,6 @@ async def create_async( :returns: The created SupportingDocumentInstance """ - data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/trusthub/v1/supporting_document_type.py b/twilio/rest/trusthub/v1/supporting_document_type.py index 66b05f95f9..204c0b53a4 100644 --- a/twilio/rest/trusthub/v1/supporting_document_type.py +++ b/twilio/rest/trusthub/v1/supporting_document_type.py @@ -40,7 +40,7 @@ def __init__( self.sid: Optional[str] = payload.get("sid") self.friendly_name: Optional[str] = payload.get("friendly_name") self.machine_name: Optional[str] = payload.get("machine_name") - self.fields: Optional[List[Dict[str, object]]] = payload.get("fields") + self.fields: Optional[List[object]] = payload.get("fields") self.url: Optional[str] = payload.get("url") self._solution = { diff --git a/twilio/rest/trusthub/v1/trust_products/__init__.py b/twilio/rest/trusthub/v1/trust_products/__init__.py index 21b95d925d..627cc5a090 100644 --- a/twilio/rest/trusthub/v1/trust_products/__init__.py +++ b/twilio/rest/trusthub/v1/trust_products/__init__.py @@ -469,7 +469,6 @@ def create( :returns: The created TrustProductsInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -504,7 +503,6 @@ async def create_async( :returns: The created TrustProductsInstance """ - data = values.of( { "FriendlyName": friendly_name, 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 5083eb8a35..42b5923e6f 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 @@ -276,7 +276,6 @@ def create( :returns: The created TrustProductsChannelEndpointAssignmentInstance """ - data = values.of( { "ChannelEndpointType": channel_endpoint_type, @@ -307,7 +306,6 @@ async def create_async( :returns: The created TrustProductsChannelEndpointAssignmentInstance """ - data = values.of( { "ChannelEndpointType": channel_endpoint_type, 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 bcd907cc25..306f9359b5 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 @@ -269,7 +269,6 @@ def create(self, object_sid: str) -> TrustProductsEntityAssignmentsInstance: :returns: The created TrustProductsEntityAssignmentsInstance """ - data = values.of( { "ObjectSid": object_sid, @@ -298,7 +297,6 @@ async def create_async( :returns: The created TrustProductsEntityAssignmentsInstance """ - data = values.of( { "ObjectSid": object_sid, 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 665f5193c4..f2d435c1cb 100644 --- a/twilio/rest/trusthub/v1/trust_products/trust_products_evaluations.py +++ b/twilio/rest/trusthub/v1/trust_products/trust_products_evaluations.py @@ -55,7 +55,7 @@ def __init__( self.status: Optional["TrustProductsEvaluationsInstance.Status"] = payload.get( "status" ) - self.results: Optional[List[Dict[str, object]]] = payload.get("results") + self.results: Optional[List[object]] = payload.get("results") self.date_created: Optional[datetime] = deserialize.iso8601_datetime( payload.get("date_created") ) @@ -232,7 +232,6 @@ def create(self, policy_sid: str) -> TrustProductsEvaluationsInstance: :returns: The created TrustProductsEvaluationsInstance """ - data = values.of( { "PolicySid": policy_sid, @@ -259,7 +258,6 @@ async def create_async(self, policy_sid: str) -> TrustProductsEvaluationsInstanc :returns: The created TrustProductsEvaluationsInstance """ - data = values.of( { "PolicySid": policy_sid, diff --git a/twilio/rest/verify/v2/safelist.py b/twilio/rest/verify/v2/safelist.py index b0f05c500f..45e5b220e1 100644 --- a/twilio/rest/verify/v2/safelist.py +++ b/twilio/rest/verify/v2/safelist.py @@ -215,7 +215,6 @@ def create(self, phone_number: str) -> SafelistInstance: :returns: The created SafelistInstance """ - data = values.of( { "PhoneNumber": phone_number, @@ -238,7 +237,6 @@ async def create_async(self, phone_number: str) -> SafelistInstance: :returns: The created SafelistInstance """ - data = values.of( { "PhoneNumber": phone_number, diff --git a/twilio/rest/verify/v2/service/__init__.py b/twilio/rest/verify/v2/service/__init__.py index da646a8ca1..32685a079e 100644 --- a/twilio/rest/verify/v2/service/__init__.py +++ b/twilio/rest/verify/v2/service/__init__.py @@ -49,7 +49,6 @@ 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 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. :ivar url: The absolute URL of the resource. @@ -81,9 +80,6 @@ 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.verify_event_subscription_enabled: Optional[bool] = payload.get( - "verify_event_subscription_enabled" - ) self.date_created: Optional[datetime] = deserialize.iso8601_datetime( payload.get("date_created") ) @@ -168,7 +164,6 @@ 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, - verify_event_subscription_enabled: Union[bool, object] = values.unset, ) -> "ServiceInstance": """ Update the ServiceInstance @@ -190,7 +185,6 @@ 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 verify_event_subscription_enabled: Whether to allow verifications from the service to reach the stream-events sinks if configured :returns: The updated ServiceInstance """ @@ -212,7 +206,6 @@ def update( totp_code_length=totp_code_length, totp_skew=totp_skew, default_template_sid=default_template_sid, - verify_event_subscription_enabled=verify_event_subscription_enabled, ) async def update_async( @@ -234,7 +227,6 @@ 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, - verify_event_subscription_enabled: Union[bool, object] = values.unset, ) -> "ServiceInstance": """ Asynchronous coroutine to update the ServiceInstance @@ -256,7 +248,6 @@ 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 verify_event_subscription_enabled: Whether to allow verifications from the service to reach the stream-events sinks if configured :returns: The updated ServiceInstance """ @@ -278,7 +269,6 @@ async def update_async( totp_code_length=totp_code_length, totp_skew=totp_skew, default_template_sid=default_template_sid, - verify_event_subscription_enabled=verify_event_subscription_enabled, ) @property @@ -445,7 +435,6 @@ 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, - verify_event_subscription_enabled: Union[bool, object] = values.unset, ) -> ServiceInstance: """ Update the ServiceInstance @@ -467,7 +456,6 @@ 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 verify_event_subscription_enabled: Whether to allow verifications from the service to reach the stream-events sinks if configured :returns: The updated ServiceInstance """ @@ -490,7 +478,6 @@ def update( "Totp.CodeLength": totp_code_length, "Totp.Skew": totp_skew, "DefaultTemplateSid": default_template_sid, - "VerifyEventSubscriptionEnabled": verify_event_subscription_enabled, } ) @@ -521,7 +508,6 @@ 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, - verify_event_subscription_enabled: Union[bool, object] = values.unset, ) -> ServiceInstance: """ Asynchronous coroutine to update the ServiceInstance @@ -543,7 +529,6 @@ 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 verify_event_subscription_enabled: Whether to allow verifications from the service to reach the stream-events sinks if configured :returns: The updated ServiceInstance """ @@ -566,7 +551,6 @@ async def update_async( "Totp.CodeLength": totp_code_length, "Totp.Skew": totp_skew, "DefaultTemplateSid": default_template_sid, - "VerifyEventSubscriptionEnabled": verify_event_subscription_enabled, } ) @@ -721,7 +705,6 @@ 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, - verify_event_subscription_enabled: Union[bool, object] = values.unset, ) -> ServiceInstance: """ Create the ServiceInstance @@ -743,11 +726,9 @@ 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 verify_event_subscription_enabled: Whether to allow verifications from the service to reach the stream-events sinks if configured :returns: The created ServiceInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -767,7 +748,6 @@ def create( "Totp.CodeLength": totp_code_length, "Totp.Skew": totp_skew, "DefaultTemplateSid": default_template_sid, - "VerifyEventSubscriptionEnabled": verify_event_subscription_enabled, } ) @@ -798,7 +778,6 @@ 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, - verify_event_subscription_enabled: Union[bool, object] = values.unset, ) -> ServiceInstance: """ Asynchronously create the ServiceInstance @@ -820,11 +799,9 @@ 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 verify_event_subscription_enabled: Whether to allow verifications from the service to reach the stream-events sinks if configured :returns: The created ServiceInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -844,7 +821,6 @@ async def create_async( "Totp.CodeLength": totp_code_length, "Totp.Skew": totp_skew, "DefaultTemplateSid": default_template_sid, - "VerifyEventSubscriptionEnabled": verify_event_subscription_enabled, } ) diff --git a/twilio/rest/verify/v2/service/access_token.py b/twilio/rest/verify/v2/service/access_token.py index 26aa9d2bf7..8c1bc46f8f 100644 --- a/twilio/rest/verify/v2/service/access_token.py +++ b/twilio/rest/verify/v2/service/access_token.py @@ -217,7 +217,6 @@ def create( :returns: The created AccessTokenInstance """ - data = values.of( { "Identity": identity, @@ -254,7 +253,6 @@ async def create_async( :returns: The created AccessTokenInstance """ - data = values.of( { "Identity": identity, diff --git a/twilio/rest/verify/v2/service/entity/__init__.py b/twilio/rest/verify/v2/service/entity/__init__.py index 93134aaa88..74629d9bb2 100644 --- a/twilio/rest/verify/v2/service/entity/__init__.py +++ b/twilio/rest/verify/v2/service/entity/__init__.py @@ -332,7 +332,6 @@ def create(self, identity: str) -> EntityInstance: :returns: The created EntityInstance """ - data = values.of( { "Identity": identity, @@ -357,7 +356,6 @@ async def create_async(self, identity: str) -> EntityInstance: :returns: The created EntityInstance """ - data = values.of( { "Identity": identity, diff --git a/twilio/rest/verify/v2/service/entity/challenge/__init__.py b/twilio/rest/verify/v2/service/entity/challenge/__init__.py index efe274607c..65aab902b1 100644 --- a/twilio/rest/verify/v2/service/entity/challenge/__init__.py +++ b/twilio/rest/verify/v2/service/entity/challenge/__init__.py @@ -428,7 +428,6 @@ def create( :returns: The created ChallengeInstance """ - data = values.of( { "FactorSid": factor_sid, @@ -476,7 +475,6 @@ async def create_async( :returns: The created ChallengeInstance """ - data = values.of( { "FactorSid": factor_sid, diff --git a/twilio/rest/verify/v2/service/entity/challenge/notification.py b/twilio/rest/verify/v2/service/entity/challenge/notification.py index 683415f70e..a04fea65ed 100644 --- a/twilio/rest/verify/v2/service/entity/challenge/notification.py +++ b/twilio/rest/verify/v2/service/entity/challenge/notification.py @@ -107,7 +107,6 @@ def create(self, ttl: Union[int, object] = values.unset) -> NotificationInstance :returns: The created NotificationInstance """ - data = values.of( { "Ttl": ttl, @@ -138,7 +137,6 @@ async def create_async( :returns: The created NotificationInstance """ - data = values.of( { "Ttl": ttl, diff --git a/twilio/rest/verify/v2/service/entity/new_factor.py b/twilio/rest/verify/v2/service/entity/new_factor.py index 1c21582278..71c793cc65 100644 --- a/twilio/rest/verify/v2/service/entity/new_factor.py +++ b/twilio/rest/verify/v2/service/entity/new_factor.py @@ -161,7 +161,6 @@ def create( :returns: The created NewFactorInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -233,7 +232,6 @@ async def create_async( :returns: The created NewFactorInstance """ - data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/verify/v2/service/messaging_configuration.py b/twilio/rest/verify/v2/service/messaging_configuration.py index b96c4db037..51d170ea41 100644 --- a/twilio/rest/verify/v2/service/messaging_configuration.py +++ b/twilio/rest/verify/v2/service/messaging_configuration.py @@ -350,7 +350,6 @@ def create( :returns: The created MessagingConfigurationInstance """ - data = values.of( { "Country": country, @@ -379,7 +378,6 @@ async def create_async( :returns: The created MessagingConfigurationInstance """ - data = values.of( { "Country": country, diff --git a/twilio/rest/verify/v2/service/rate_limit/__init__.py b/twilio/rest/verify/v2/service/rate_limit/__init__.py index cf37fa1e8c..f411c57e65 100644 --- a/twilio/rest/verify/v2/service/rate_limit/__init__.py +++ b/twilio/rest/verify/v2/service/rate_limit/__init__.py @@ -377,7 +377,6 @@ def create( :returns: The created RateLimitInstance """ - data = values.of( { "UniqueName": unique_name, @@ -406,7 +405,6 @@ async def create_async( :returns: The created RateLimitInstance """ - data = values.of( { "UniqueName": unique_name, diff --git a/twilio/rest/verify/v2/service/rate_limit/bucket.py b/twilio/rest/verify/v2/service/rate_limit/bucket.py index 18ff98acd5..a97b1e0171 100644 --- a/twilio/rest/verify/v2/service/rate_limit/bucket.py +++ b/twilio/rest/verify/v2/service/rate_limit/bucket.py @@ -392,7 +392,6 @@ def create(self, max: int, interval: int) -> BucketInstance: :returns: The created BucketInstance """ - data = values.of( { "Max": max, @@ -422,7 +421,6 @@ async def create_async(self, max: int, interval: int) -> BucketInstance: :returns: The created BucketInstance """ - data = values.of( { "Max": max, diff --git a/twilio/rest/verify/v2/service/verification.py b/twilio/rest/verify/v2/service/verification.py index dc48cd010d..91acb3d7e0 100644 --- a/twilio/rest/verify/v2/service/verification.py +++ b/twilio/rest/verify/v2/service/verification.py @@ -75,7 +75,7 @@ def __init__( self.lookup: Optional[Dict[str, object]] = payload.get("lookup") self.amount: Optional[str] = payload.get("amount") self.payee: Optional[str] = payload.get("payee") - self.send_code_attempts: Optional[List[Dict[str, object]]] = payload.get( + self.send_code_attempts: Optional[List[object]] = payload.get( "send_code_attempts" ) self.date_created: Optional[datetime] = deserialize.iso8601_datetime( @@ -324,7 +324,6 @@ def create( template_custom_substitutions: Union[str, object] = values.unset, device_ip: Union[str, object] = values.unset, risk_check: Union["VerificationInstance.RiskCheck", object] = values.unset, - tags: Union[str, object] = values.unset, ) -> VerificationInstance: """ Create the VerificationInstance @@ -345,11 +344,9 @@ def create( :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 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. :returns: The created VerificationInstance """ - data = values.of( { "To": to, @@ -368,7 +365,6 @@ def create( "TemplateCustomSubstitutions": template_custom_substitutions, "DeviceIp": device_ip, "RiskCheck": risk_check, - "Tags": tags, } ) @@ -400,7 +396,6 @@ async def create_async( template_custom_substitutions: Union[str, object] = values.unset, device_ip: Union[str, object] = values.unset, risk_check: Union["VerificationInstance.RiskCheck", object] = values.unset, - tags: Union[str, object] = values.unset, ) -> VerificationInstance: """ Asynchronously create the VerificationInstance @@ -421,11 +416,9 @@ async def create_async( :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 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. :returns: The created VerificationInstance """ - data = values.of( { "To": to, @@ -444,7 +437,6 @@ async def create_async( "TemplateCustomSubstitutions": template_custom_substitutions, "DeviceIp": device_ip, "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 b33803854e..05a8399f87 100644 --- a/twilio/rest/verify/v2/service/verification_check.py +++ b/twilio/rest/verify/v2/service/verification_check.py @@ -65,7 +65,7 @@ def __init__(self, version: Version, payload: Dict[str, Any], service_sid: str): self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( payload.get("date_updated") ) - self.sna_attempts_error_codes: Optional[List[Dict[str, object]]] = payload.get( + self.sna_attempts_error_codes: Optional[List[object]] = payload.get( "sna_attempts_error_codes" ) @@ -119,7 +119,6 @@ def create( :returns: The created VerificationCheckInstance """ - data = values.of( { "Code": code, @@ -159,7 +158,6 @@ async def create_async( :returns: The created VerificationCheckInstance """ - data = values.of( { "Code": code, diff --git a/twilio/rest/verify/v2/service/webhook.py b/twilio/rest/verify/v2/service/webhook.py index 15dce50aa1..c7924db4bf 100644 --- a/twilio/rest/verify/v2/service/webhook.py +++ b/twilio/rest/verify/v2/service/webhook.py @@ -433,7 +433,6 @@ def create( :returns: The created WebhookInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -473,7 +472,6 @@ async def create_async( :returns: The created WebhookInstance """ - data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/verify/v2/verification_attempt.py b/twilio/rest/verify/v2/verification_attempt.py index 009291550a..8ed27f6775 100644 --- a/twilio/rest/verify/v2/verification_attempt.py +++ b/twilio/rest/verify/v2/verification_attempt.py @@ -43,7 +43,7 @@ class ConversionStatus(object): :ivar date_updated: The date that this Attempt was updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. :ivar conversion_status: :ivar channel: - :ivar price: An object containing the charge for this verification attempt related to the channel costs and the currency used. The costs related to the succeeded verifications are not included. May not be immediately available. More information on pricing is available [here](https://www.twilio.com/en-us/verify/pricing). + :ivar price: An object containing the charge for this verification attempt related to the channel costs and the currency used. The costs related to the succeeded verifications are not included. May not be immediately available. More information on pricing is available [here](https://www.twilio.com/verify/pricing). :ivar channel_data: An object containing the channel specific information for an attempt. :ivar url: """ diff --git a/twilio/rest/video/v1/composition.py b/twilio/rest/video/v1/composition.py index 039f55e4a9..2fead14204 100644 --- a/twilio/rest/video/v1/composition.py +++ b/twilio/rest/video/v1/composition.py @@ -309,7 +309,6 @@ def create( :returns: The created CompositionInstance """ - data = values.of( { "RoomSid": room_sid, @@ -361,7 +360,6 @@ async def create_async( :returns: The created CompositionInstance """ - data = values.of( { "RoomSid": room_sid, diff --git a/twilio/rest/video/v1/composition_hook.py b/twilio/rest/video/v1/composition_hook.py index f4cb5c7c74..e15c43c4ac 100644 --- a/twilio/rest/video/v1/composition_hook.py +++ b/twilio/rest/video/v1/composition_hook.py @@ -484,7 +484,6 @@ def create( :returns: The created CompositionHookInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -539,7 +538,6 @@ async def create_async( :returns: The created CompositionHookInstance """ - data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/video/v1/room/__init__.py b/twilio/rest/video/v1/room/__init__.py index 0310baae1e..bc87b88e28 100644 --- a/twilio/rest/video/v1/room/__init__.py +++ b/twilio/rest/video/v1/room/__init__.py @@ -431,7 +431,6 @@ def create( :returns: The created RoomInstance """ - data = values.of( { "EnableTurn": enable_turn, @@ -499,7 +498,6 @@ async def create_async( :returns: The created RoomInstance """ - data = values.of( { "EnableTurn": enable_turn, diff --git a/twilio/rest/video/v1/room/participant/subscribe_rules.py b/twilio/rest/video/v1/room/participant/subscribe_rules.py index 286f912cf5..28e3976d15 100644 --- a/twilio/rest/video/v1/room/participant/subscribe_rules.py +++ b/twilio/rest/video/v1/room/participant/subscribe_rules.py @@ -93,10 +93,8 @@ def fetch(self) -> SubscribeRulesInstance: """ Asynchronously fetch the SubscribeRulesInstance - :returns: The fetched SubscribeRulesInstance """ - payload = self._version.fetch(method="GET", uri=self._uri) return SubscribeRulesInstance( @@ -110,10 +108,8 @@ async def fetch_async(self) -> SubscribeRulesInstance: """ Asynchronously fetch the SubscribeRulesInstance - :returns: The fetched SubscribeRulesInstance """ - payload = await self._version.fetch_async(method="GET", uri=self._uri) return SubscribeRulesInstance( diff --git a/twilio/rest/video/v1/room/recording_rules.py b/twilio/rest/video/v1/room/recording_rules.py index 862d90e4b2..68adaed070 100644 --- a/twilio/rest/video/v1/room/recording_rules.py +++ b/twilio/rest/video/v1/room/recording_rules.py @@ -78,10 +78,8 @@ def fetch(self) -> RecordingRulesInstance: """ Asynchronously fetch the RecordingRulesInstance - :returns: The fetched RecordingRulesInstance """ - payload = self._version.fetch(method="GET", uri=self._uri) return RecordingRulesInstance( @@ -92,10 +90,8 @@ async def fetch_async(self) -> RecordingRulesInstance: """ Asynchronously fetch the RecordingRulesInstance - :returns: The fetched RecordingRulesInstance """ - payload = await self._version.fetch_async(method="GET", uri=self._uri) return RecordingRulesInstance( diff --git a/twilio/rest/voice/v1/byoc_trunk.py b/twilio/rest/voice/v1/byoc_trunk.py index 076ea0de6d..88ed49dcbc 100644 --- a/twilio/rest/voice/v1/byoc_trunk.py +++ b/twilio/rest/voice/v1/byoc_trunk.py @@ -471,7 +471,6 @@ def create( :returns: The created ByocTrunkInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -524,7 +523,6 @@ async def create_async( :returns: The created ByocTrunkInstance """ - data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/voice/v1/connection_policy/__init__.py b/twilio/rest/voice/v1/connection_policy/__init__.py index fc8269105d..e1c26dc495 100644 --- a/twilio/rest/voice/v1/connection_policy/__init__.py +++ b/twilio/rest/voice/v1/connection_policy/__init__.py @@ -350,7 +350,6 @@ def create( :returns: The created ConnectionPolicyInstance """ - data = values.of( { "FriendlyName": friendly_name, @@ -375,7 +374,6 @@ async def create_async( :returns: The created ConnectionPolicyInstance """ - data = values.of( { "FriendlyName": friendly_name, 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 0972b680dc..e617072cb2 100644 --- a/twilio/rest/voice/v1/connection_policy/connection_policy_target.py +++ b/twilio/rest/voice/v1/connection_policy/connection_policy_target.py @@ -424,7 +424,6 @@ def create( :returns: The created ConnectionPolicyTargetInstance """ - data = values.of( { "Target": target, @@ -466,7 +465,6 @@ async def create_async( :returns: The created ConnectionPolicyTargetInstance """ - data = values.of( { "Target": target, 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 4d62c547b0..3e4966c72e 100644 --- a/twilio/rest/voice/v1/dialing_permissions/bulk_country_update.py +++ b/twilio/rest/voice/v1/dialing_permissions/bulk_country_update.py @@ -66,7 +66,6 @@ def create(self, update_request: str) -> BulkCountryUpdateInstance: :returns: The created BulkCountryUpdateInstance """ - data = values.of( { "UpdateRequest": update_request, @@ -89,7 +88,6 @@ async def create_async(self, update_request: str) -> BulkCountryUpdateInstance: :returns: The created BulkCountryUpdateInstance """ - data = values.of( { "UpdateRequest": update_request, diff --git a/twilio/rest/voice/v1/ip_record.py b/twilio/rest/voice/v1/ip_record.py index c363dd4790..c81322d423 100644 --- a/twilio/rest/voice/v1/ip_record.py +++ b/twilio/rest/voice/v1/ip_record.py @@ -331,7 +331,6 @@ def create( :returns: The created IpRecordInstance """ - data = values.of( { "IpAddress": ip_address, @@ -363,7 +362,6 @@ async def create_async( :returns: The created IpRecordInstance """ - data = values.of( { "IpAddress": ip_address, diff --git a/twilio/rest/voice/v1/source_ip_mapping.py b/twilio/rest/voice/v1/source_ip_mapping.py index a192d762eb..b61bee9cc5 100644 --- a/twilio/rest/voice/v1/source_ip_mapping.py +++ b/twilio/rest/voice/v1/source_ip_mapping.py @@ -317,7 +317,6 @@ def create( :returns: The created SourceIpMappingInstance """ - data = values.of( { "IpRecordSid": ip_record_sid, @@ -344,7 +343,6 @@ async def create_async( :returns: The created SourceIpMappingInstance """ - data = values.of( { "IpRecordSid": ip_record_sid, diff --git a/twilio/rest/wireless/v1/command.py b/twilio/rest/wireless/v1/command.py index 0315bf8b5b..16d230adbf 100644 --- a/twilio/rest/wireless/v1/command.py +++ b/twilio/rest/wireless/v1/command.py @@ -291,7 +291,6 @@ def create( :returns: The created CommandInstance """ - data = values.of( { "Command": command, @@ -335,7 +334,6 @@ async def create_async( :returns: The created CommandInstance """ - data = values.of( { "Command": command, diff --git a/twilio/rest/wireless/v1/rate_plan.py b/twilio/rest/wireless/v1/rate_plan.py index 591cdf3182..469c8997ea 100644 --- a/twilio/rest/wireless/v1/rate_plan.py +++ b/twilio/rest/wireless/v1/rate_plan.py @@ -385,7 +385,6 @@ def create( :returns: The created RatePlanInstance """ - data = values.of( { "UniqueName": unique_name, @@ -443,7 +442,6 @@ async def create_async( :returns: The created RatePlanInstance """ - data = values.of( { "UniqueName": unique_name,