diff --git a/CHANGES.md b/CHANGES.md index b9e9c6e47..73bbaa106 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,73 @@ twilio-python Changelog Here you can see the full list of changes between each twilio-python release. +[2024-02-09] Version 8.13.0 +--------------------------- +**Library - Fix** +- [PR #753](https://github.com/twilio/twilio-python/pull/753): added boolean_to_string converter. Thanks to [@tiwarishubham635](https://github.com/tiwarishubham635)! + +**Library - Chore** +- [PR #758](https://github.com/twilio/twilio-python/pull/758): disable cluster test. Thanks to [@sbansla](https://github.com/sbansla)! +- [PR #760](https://github.com/twilio/twilio-python/pull/760): run make prettier. Thanks to [@tiwarishubham635](https://github.com/tiwarishubham635)! + +**Api** +- Updated service base url for connect apps and authorized connect apps APIs **(breaking change)** +- Update documentation to reflect RiskCheck GA +- Added optional parameter `CallToken` for create participant api + +**Events** +- Marked as GA + +**Flex** +- Adding `flex_instance_sid` to Flex Configuration +- Adding `provisioning_status` for Email Manager +- Adding `offline_config` to Flex Configuration + +**Insights** +- add flag to restrict access to unapid customers +- decommission voice-qualitystats-endpoint role + +**Intelligence** +- Add text-generation operator (for example conversation summary) results to existing OperatorResults collection. + +**Lookups** +- Remove `carrier` field from `sms_pumping_risk` and leave `carrier_risk_category` **(breaking change)** +- Remove carrier information from call forwarding package **(breaking change)** + +**Messaging** +- Add update instance endpoints to us_app_to_person api +- Add tollfree edit_allowed and edit_reason fields +- Update Phone Number, Short Code, Alpha Sender, US A2P and Channel Sender documentation +- Add DELETE support to Tollfree Verification resource + +**Numbers** +- Add Get Port In request api + +**Push** +- Migrated to new Push API V4 with Resilient Notification Delivery. + +**Serverless** +- Add node18 as a valid Build runtime + +**Taskrouter** +- Add `jitter_buffer_size` param in update reservation +- Add container attribute to task_queue_bulk_real_time_statistics endpoint +- Remove beta_feature check on task_queue_bulk_real_time_statistics endpoint + +**Trusthub** +- Add optional field NotificationEmail to the POST /v1/ComplianceInquiries/Customers/Initialize API +- Add additional optional fields in compliance_tollfree_inquiry.json +- Rename did to tollfree_phone_number in compliance_tollfree_inquiry.json +- Add new optional field notification_email to compliance_tollfree_inquiry.json + +**Verify** +- `Tags` property added again to Public Docs **(breaking change)** +- Remove `Tags` from Public Docs **(breaking change)** +- Add `VerifyEventSubscriptionEnabled` parameter to service create and update endpoints. +- Add `Tags` optional parameter on Verification creation. +- Update Verify TOTP maturity to GA. + + [2024-01-25] Version 8.12.0 --------------------------- **Oauth** diff --git a/twilio/rest/__init__.py b/twilio/rest/__init__.py index 9f2d2e963..3e895271f 100644 --- a/twilio/rest/__init__.py +++ b/twilio/rest/__init__.py @@ -16,7 +16,6 @@ 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 @@ -34,7 +33,6 @@ 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 @@ -125,7 +123,6 @@ 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 @@ -143,7 +140,6 @@ 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 @@ -186,19 +182,6 @@ 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": """ @@ -420,19 +403,6 @@ 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/AccountsBase.py b/twilio/rest/accounts/AccountsBase.py index a89be8416..e9ac0d589 100644 --- a/twilio/rest/accounts/AccountsBase.py +++ b/twilio/rest/accounts/AccountsBase.py @@ -17,6 +17,7 @@ class AccountsBase(Domain): + def __init__(self, twilio: Client): """ Initialize the Accounts Domain diff --git a/twilio/rest/accounts/v1/__init__.py b/twilio/rest/accounts/v1/__init__.py index 4abbf2434..142d5c7a9 100644 --- a/twilio/rest/accounts/v1/__init__.py +++ b/twilio/rest/accounts/v1/__init__.py @@ -22,6 +22,7 @@ class V1(Version): + def __init__(self, domain: Domain): """ Initialize the V1 version of Accounts diff --git a/twilio/rest/accounts/v1/auth_token_promotion.py b/twilio/rest/accounts/v1/auth_token_promotion.py index 140b5b180..7ab6c3f39 100644 --- a/twilio/rest/accounts/v1/auth_token_promotion.py +++ b/twilio/rest/accounts/v1/auth_token_promotion.py @@ -88,6 +88,7 @@ def __repr__(self) -> str: class AuthTokenPromotionContext(InstanceContext): + def __init__(self, version: Version): """ Initialize the AuthTokenPromotionContext @@ -143,6 +144,7 @@ def __repr__(self) -> str: class AuthTokenPromotionList(ListResource): + def __init__(self, version: Version): """ Initialize the AuthTokenPromotionList diff --git a/twilio/rest/accounts/v1/credential/__init__.py b/twilio/rest/accounts/v1/credential/__init__.py index f2ee3c735..e9c4653f0 100644 --- a/twilio/rest/accounts/v1/credential/__init__.py +++ b/twilio/rest/accounts/v1/credential/__init__.py @@ -23,6 +23,7 @@ class CredentialList(ListResource): + def __init__(self, version: Version): """ Initialize the CredentialList diff --git a/twilio/rest/accounts/v1/credential/aws.py b/twilio/rest/accounts/v1/credential/aws.py index b49b07507..ab7562092 100644 --- a/twilio/rest/accounts/v1/credential/aws.py +++ b/twilio/rest/accounts/v1/credential/aws.py @@ -141,6 +141,7 @@ def __repr__(self) -> str: class AwsContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the AwsContext @@ -275,6 +276,7 @@ def __repr__(self) -> str: class AwsPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> AwsInstance: """ Build an instance of AwsInstance @@ -293,6 +295,7 @@ def __repr__(self) -> str: class AwsList(ListResource): + def __init__(self, version: Version): """ Initialize the AwsList @@ -319,6 +322,7 @@ def create( :returns: The created AwsInstance """ + data = values.of( { "Credentials": credentials, @@ -350,6 +354,7 @@ 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 6ed07b4e4..09018d1d2 100644 --- a/twilio/rest/accounts/v1/credential/public_key.py +++ b/twilio/rest/accounts/v1/credential/public_key.py @@ -143,6 +143,7 @@ def __repr__(self) -> str: class PublicKeyContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the PublicKeyContext @@ -279,6 +280,7 @@ def __repr__(self) -> str: class PublicKeyPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> PublicKeyInstance: """ Build an instance of PublicKeyInstance @@ -297,6 +299,7 @@ def __repr__(self) -> str: class PublicKeyList(ListResource): + def __init__(self, version: Version): """ Initialize the PublicKeyList @@ -323,6 +326,7 @@ def create( :returns: The created PublicKeyInstance """ + data = values.of( { "PublicKey": public_key, @@ -354,6 +358,7 @@ 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 90b1ee819..e20855965 100644 --- a/twilio/rest/accounts/v1/safelist.py +++ b/twilio/rest/accounts/v1/safelist.py @@ -12,7 +12,7 @@ Do not edit the class manually. """ -from typing import Any, Dict, Optional +from typing import Any, Dict, Optional, Union from twilio.base import values from twilio.base.instance_resource import InstanceResource @@ -43,6 +43,7 @@ def __repr__(self) -> str: class SafelistList(ListResource): + def __init__(self, version: Version): """ Initialize the SafelistList @@ -62,6 +63,7 @@ def create(self, phone_number: str) -> SafelistInstance: :returns: The created SafelistInstance """ + data = values.of( { "PhoneNumber": phone_number, @@ -84,6 +86,7 @@ async def create_async(self, phone_number: str) -> SafelistInstance: :returns: The created SafelistInstance """ + data = values.of( { "PhoneNumber": phone_number, @@ -98,23 +101,77 @@ async def create_async(self, phone_number: str) -> SafelistInstance: return SafelistInstance(self._version, payload) - def fetch(self) -> SafelistInstance: + 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: """ 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 """ - payload = self._version.fetch(method="GET", uri=self._uri) + + params = values.of( + { + "PhoneNumber": phone_number, + } + ) + payload = self._version.fetch(method="GET", uri=self._uri, params=params) return SafelistInstance(self._version, payload) - async def fetch_async(self) -> SafelistInstance: + async def fetch_async( + self, phone_number: Union[str, object] = values.unset + ) -> 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 """ - payload = await self._version.fetch_async(method="GET", uri=self._uri) + + params = values.of( + { + "PhoneNumber": phone_number, + } + ) + payload = await self._version.fetch_async( + method="GET", uri=self._uri, params=params + ) return SafelistInstance(self._version, payload) diff --git a/twilio/rest/accounts/v1/secondary_auth_token.py b/twilio/rest/accounts/v1/secondary_auth_token.py index 4d2e09947..3735dd876 100644 --- a/twilio/rest/accounts/v1/secondary_auth_token.py +++ b/twilio/rest/accounts/v1/secondary_auth_token.py @@ -106,6 +106,7 @@ def __repr__(self) -> str: class SecondaryAuthTokenContext(InstanceContext): + def __init__(self, version: Version): """ Initialize the SecondaryAuthTokenContext @@ -179,6 +180,7 @@ def __repr__(self) -> str: class SecondaryAuthTokenList(ListResource): + def __init__(self, version: Version): """ Initialize the SecondaryAuthTokenList diff --git a/twilio/rest/api/ApiBase.py b/twilio/rest/api/ApiBase.py index 417bc0d0d..e53535ab3 100644 --- a/twilio/rest/api/ApiBase.py +++ b/twilio/rest/api/ApiBase.py @@ -17,6 +17,7 @@ class ApiBase(Domain): + def __init__(self, twilio: Client): """ Initialize the Api Domain diff --git a/twilio/rest/api/v2010/__init__.py b/twilio/rest/api/v2010/__init__.py index fe5c45c51..2efb4ff3d 100644 --- a/twilio/rest/api/v2010/__init__.py +++ b/twilio/rest/api/v2010/__init__.py @@ -20,6 +20,7 @@ class V2010(Version): + def __init__(self, domain: Domain): """ Initialize the V2010 version of Api diff --git a/twilio/rest/api/v2010/account/__init__.py b/twilio/rest/api/v2010/account/__init__.py index 97e878526..adf2458f2 100644 --- a/twilio/rest/api/v2010/account/__init__.py +++ b/twilio/rest/api/v2010/account/__init__.py @@ -51,6 +51,7 @@ class AccountInstance(InstanceResource): + class Status(object): ACTIVE = "active" SUSPENDED = "suspended" @@ -348,6 +349,7 @@ def __repr__(self) -> str: class AccountContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the AccountContext @@ -781,6 +783,7 @@ def __repr__(self) -> str: class AccountPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> AccountInstance: """ Build an instance of AccountInstance @@ -799,6 +802,7 @@ def __repr__(self) -> str: class AccountList(ListResource): + def __init__(self, version: Version): """ Initialize the AccountList @@ -820,6 +824,7 @@ def create( :returns: The created AccountInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -844,6 +849,7 @@ 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 066c493fd..422d7f776 100644 --- a/twilio/rest/api/v2010/account/address/__init__.py +++ b/twilio/rest/api/v2010/account/address/__init__.py @@ -229,6 +229,7 @@ def __repr__(self) -> str: class AddressContext(InstanceContext): + def __init__(self, version: Version, account_sid: str, sid: str): """ Initialize the AddressContext @@ -446,6 +447,7 @@ def __repr__(self) -> str: class AddressPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> AddressInstance: """ Build an instance of AddressInstance @@ -466,6 +468,7 @@ def __repr__(self) -> str: class AddressList(ListResource): + def __init__(self, version: Version, account_sid: str): """ Initialize the AddressList @@ -511,6 +514,7 @@ def create( :returns: The created AddressInstance """ + data = values.of( { "CustomerName": customer_name, @@ -565,6 +569,7 @@ async def create_async( :returns: The created AddressInstance """ + data = values.of( { "CustomerName": customer_name, diff --git a/twilio/rest/api/v2010/account/address/dependent_phone_number.py b/twilio/rest/api/v2010/account/address/dependent_phone_number.py index 5db5d89b5..738f9baff 100644 --- a/twilio/rest/api/v2010/account/address/dependent_phone_number.py +++ b/twilio/rest/api/v2010/account/address/dependent_phone_number.py @@ -23,6 +23,7 @@ class DependentPhoneNumberInstance(InstanceResource): + class AddressRequirement(object): NONE = "none" ANY = "any" @@ -126,6 +127,7 @@ def __repr__(self) -> str: class DependentPhoneNumberPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> DependentPhoneNumberInstance: """ Build an instance of DependentPhoneNumberInstance @@ -149,6 +151,7 @@ def __repr__(self) -> str: class DependentPhoneNumberList(ListResource): + def __init__(self, version: Version, account_sid: str, address_sid: str): """ Initialize the DependentPhoneNumberList diff --git a/twilio/rest/api/v2010/account/application.py b/twilio/rest/api/v2010/account/application.py index 50f0e4ad7..3f70417b5 100644 --- a/twilio/rest/api/v2010/account/application.py +++ b/twilio/rest/api/v2010/account/application.py @@ -279,6 +279,7 @@ def __repr__(self) -> str: class ApplicationContext(InstanceContext): + def __init__(self, version: Version, account_sid: str, sid: str): """ Initialize the ApplicationContext @@ -523,6 +524,7 @@ def __repr__(self) -> str: class ApplicationPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ApplicationInstance: """ Build an instance of ApplicationInstance @@ -543,6 +545,7 @@ def __repr__(self) -> str: class ApplicationList(ListResource): + def __init__(self, version: Version, account_sid: str): """ Initialize the ApplicationList @@ -600,6 +603,7 @@ def create( :returns: The created ApplicationInstance """ + data = values.of( { "ApiVersion": api_version, @@ -672,6 +676,7 @@ 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 1e48d606b..9359545cd 100644 --- a/twilio/rest/api/v2010/account/authorized_connect_app.py +++ b/twilio/rest/api/v2010/account/authorized_connect_app.py @@ -12,9 +12,8 @@ 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 import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -23,6 +22,7 @@ class AuthorizedConnectAppInstance(InstanceResource): + class Permission(object): GET_ALL = "get-all" POST_ALL = "post-all" @@ -34,8 +34,6 @@ 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`. """ @@ -63,12 +61,6 @@ 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") ) @@ -125,6 +117,7 @@ def __repr__(self) -> str: class AuthorizedConnectAppContext(InstanceContext): + def __init__(self, version: Version, account_sid: str, connect_app_sid: str): """ Initialize the AuthorizedConnectAppContext @@ -195,6 +188,7 @@ def __repr__(self) -> str: class AuthorizedConnectAppPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> AuthorizedConnectAppInstance: """ Build an instance of AuthorizedConnectAppInstance @@ -215,6 +209,7 @@ def __repr__(self) -> str: class AuthorizedConnectAppList(ListResource): + def __init__(self, version: Version, account_sid: str): """ Initialize the AuthorizedConnectAppList diff --git a/twilio/rest/api/v2010/account/available_phone_number_country/__init__.py b/twilio/rest/api/v2010/account/available_phone_number_country/__init__.py index 32583e778..14fcfc28d 100644 --- a/twilio/rest/api/v2010/account/available_phone_number_country/__init__.py +++ b/twilio/rest/api/v2010/account/available_phone_number_country/__init__.py @@ -166,6 +166,7 @@ def __repr__(self) -> str: class AvailablePhoneNumberCountryContext(InstanceContext): + def __init__(self, version: Version, account_sid: str, country_code: str): """ Initialize the AvailablePhoneNumberCountryContext @@ -339,6 +340,7 @@ def __repr__(self) -> str: class AvailablePhoneNumberCountryPage(Page): + def get_instance( self, payload: Dict[str, Any] ) -> AvailablePhoneNumberCountryInstance: @@ -361,6 +363,7 @@ def __repr__(self) -> str: class AvailablePhoneNumberCountryList(ListResource): + def __init__(self, version: Version, account_sid: str): """ Initialize the AvailablePhoneNumberCountryList diff --git a/twilio/rest/api/v2010/account/available_phone_number_country/local.py b/twilio/rest/api/v2010/account/available_phone_number_country/local.py index c64739cc8..a3fd567a7 100644 --- a/twilio/rest/api/v2010/account/available_phone_number_country/local.py +++ b/twilio/rest/api/v2010/account/available_phone_number_country/local.py @@ -77,6 +77,7 @@ def __repr__(self) -> str: class LocalPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> LocalInstance: """ Build an instance of LocalInstance @@ -100,6 +101,7 @@ def __repr__(self) -> str: class LocalList(ListResource): + def __init__(self, version: Version, account_sid: str, country_code: str): """ Initialize the LocalList diff --git a/twilio/rest/api/v2010/account/available_phone_number_country/machine_to_machine.py b/twilio/rest/api/v2010/account/available_phone_number_country/machine_to_machine.py index 860983f2a..04ba514cc 100644 --- a/twilio/rest/api/v2010/account/available_phone_number_country/machine_to_machine.py +++ b/twilio/rest/api/v2010/account/available_phone_number_country/machine_to_machine.py @@ -77,6 +77,7 @@ def __repr__(self) -> str: class MachineToMachinePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> MachineToMachineInstance: """ Build an instance of MachineToMachineInstance @@ -100,6 +101,7 @@ def __repr__(self) -> str: class MachineToMachineList(ListResource): + def __init__(self, version: Version, account_sid: str, country_code: str): """ Initialize the MachineToMachineList diff --git a/twilio/rest/api/v2010/account/available_phone_number_country/mobile.py b/twilio/rest/api/v2010/account/available_phone_number_country/mobile.py index 624ccbb30..cd3712701 100644 --- a/twilio/rest/api/v2010/account/available_phone_number_country/mobile.py +++ b/twilio/rest/api/v2010/account/available_phone_number_country/mobile.py @@ -77,6 +77,7 @@ def __repr__(self) -> str: class MobilePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> MobileInstance: """ Build an instance of MobileInstance @@ -100,6 +101,7 @@ def __repr__(self) -> str: class MobileList(ListResource): + def __init__(self, version: Version, account_sid: str, country_code: str): """ Initialize the MobileList diff --git a/twilio/rest/api/v2010/account/available_phone_number_country/national.py b/twilio/rest/api/v2010/account/available_phone_number_country/national.py index 259603284..018bef3ac 100644 --- a/twilio/rest/api/v2010/account/available_phone_number_country/national.py +++ b/twilio/rest/api/v2010/account/available_phone_number_country/national.py @@ -77,6 +77,7 @@ def __repr__(self) -> str: class NationalPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> NationalInstance: """ Build an instance of NationalInstance @@ -100,6 +101,7 @@ def __repr__(self) -> str: class NationalList(ListResource): + def __init__(self, version: Version, account_sid: str, country_code: str): """ Initialize the NationalList diff --git a/twilio/rest/api/v2010/account/available_phone_number_country/shared_cost.py b/twilio/rest/api/v2010/account/available_phone_number_country/shared_cost.py index 75b890592..3cb7af3ef 100644 --- a/twilio/rest/api/v2010/account/available_phone_number_country/shared_cost.py +++ b/twilio/rest/api/v2010/account/available_phone_number_country/shared_cost.py @@ -77,6 +77,7 @@ def __repr__(self) -> str: class SharedCostPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> SharedCostInstance: """ Build an instance of SharedCostInstance @@ -100,6 +101,7 @@ def __repr__(self) -> str: class SharedCostList(ListResource): + def __init__(self, version: Version, account_sid: str, country_code: str): """ Initialize the SharedCostList diff --git a/twilio/rest/api/v2010/account/available_phone_number_country/toll_free.py b/twilio/rest/api/v2010/account/available_phone_number_country/toll_free.py index b46af0039..e9d830c0b 100644 --- a/twilio/rest/api/v2010/account/available_phone_number_country/toll_free.py +++ b/twilio/rest/api/v2010/account/available_phone_number_country/toll_free.py @@ -77,6 +77,7 @@ def __repr__(self) -> str: class TollFreePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> TollFreeInstance: """ Build an instance of TollFreeInstance @@ -100,6 +101,7 @@ def __repr__(self) -> str: class TollFreeList(ListResource): + def __init__(self, version: Version, account_sid: str, country_code: str): """ Initialize the TollFreeList diff --git a/twilio/rest/api/v2010/account/available_phone_number_country/voip.py b/twilio/rest/api/v2010/account/available_phone_number_country/voip.py index b0bb21369..8825843c8 100644 --- a/twilio/rest/api/v2010/account/available_phone_number_country/voip.py +++ b/twilio/rest/api/v2010/account/available_phone_number_country/voip.py @@ -77,6 +77,7 @@ def __repr__(self) -> str: class VoipPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> VoipInstance: """ Build an instance of VoipInstance @@ -100,6 +101,7 @@ def __repr__(self) -> str: class VoipList(ListResource): + def __init__(self, version: Version, account_sid: str, country_code: str): """ Initialize the VoipList diff --git a/twilio/rest/api/v2010/account/balance.py b/twilio/rest/api/v2010/account/balance.py index 402e25d5f..0e90cdaae 100644 --- a/twilio/rest/api/v2010/account/balance.py +++ b/twilio/rest/api/v2010/account/balance.py @@ -48,6 +48,7 @@ def __repr__(self) -> str: class BalanceList(ListResource): + def __init__(self, version: Version, account_sid: str): """ Initialize the BalanceList @@ -68,8 +69,10 @@ def fetch(self) -> BalanceInstance: """ Asynchronously fetch the BalanceInstance + :returns: The fetched BalanceInstance """ + payload = self._version.fetch(method="GET", uri=self._uri) return BalanceInstance( @@ -80,8 +83,10 @@ 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 f35c25f6b..406db2760 100644 --- a/twilio/rest/api/v2010/account/call/__init__.py +++ b/twilio/rest/api/v2010/account/call/__init__.py @@ -37,6 +37,7 @@ class CallInstance(InstanceResource): + class Status(object): QUEUED = "queued" RINGING = "ringing" @@ -336,6 +337,7 @@ def __repr__(self) -> str: class CallContext(InstanceContext): + def __init__(self, version: Version, account_sid: str, sid: str): """ Initialize the CallContext @@ -667,6 +669,7 @@ def __repr__(self) -> str: class CallPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> CallInstance: """ Build an instance of CallInstance @@ -687,6 +690,7 @@ def __repr__(self) -> str: class CallList(ListResource): + def __init__(self, version: Version, account_sid: str): """ Initialize the CallList @@ -784,6 +788,7 @@ def create( :returns: The created CallInstance """ + data = values.of( { "To": to, @@ -917,6 +922,7 @@ async def create_async( :returns: The created CallInstance """ + data = values.of( { "To": to, diff --git a/twilio/rest/api/v2010/account/call/event.py b/twilio/rest/api/v2010/account/call/event.py index 734d3e6cb..7993dd00a 100644 --- a/twilio/rest/api/v2010/account/call/event.py +++ b/twilio/rest/api/v2010/account/call/event.py @@ -51,6 +51,7 @@ def __repr__(self) -> str: class EventPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> EventInstance: """ Build an instance of EventInstance @@ -74,6 +75,7 @@ def __repr__(self) -> str: class EventList(ListResource): + def __init__(self, version: Version, account_sid: str, call_sid: str): """ Initialize the EventList diff --git a/twilio/rest/api/v2010/account/call/feedback.py b/twilio/rest/api/v2010/account/call/feedback.py index 342b032eb..210a529ac 100644 --- a/twilio/rest/api/v2010/account/call/feedback.py +++ b/twilio/rest/api/v2010/account/call/feedback.py @@ -22,6 +22,7 @@ class FeedbackInstance(InstanceResource): + class Issues(object): AUDIO_LATENCY = "audio-latency" DIGITS_NOT_CAPTURED = "digits-not-captured" @@ -146,6 +147,7 @@ def __repr__(self) -> str: class FeedbackContext(InstanceContext): + def __init__(self, version: Version, account_sid: str, call_sid: str): """ Initialize the FeedbackContext @@ -282,6 +284,7 @@ def __repr__(self) -> str: class FeedbackList(ListResource): + def __init__(self, version: Version, account_sid: str, call_sid: str): """ Initialize the FeedbackList diff --git a/twilio/rest/api/v2010/account/call/feedback_summary.py b/twilio/rest/api/v2010/account/call/feedback_summary.py index 3df166038..2f26b0b0a 100644 --- a/twilio/rest/api/v2010/account/call/feedback_summary.py +++ b/twilio/rest/api/v2010/account/call/feedback_summary.py @@ -22,6 +22,7 @@ class FeedbackSummaryInstance(InstanceResource): + class Status(object): QUEUED = "queued" IN_PROGRESS = "in-progress" @@ -69,7 +70,7 @@ def __init__( payload.get("end_date") ) self.include_subaccounts: Optional[bool] = payload.get("include_subaccounts") - self.issues: Optional[List[object]] = payload.get("issues") + self.issues: Optional[List[Dict[str, object]]] = payload.get("issues") self.quality_score_average: Optional[float] = deserialize.decimal( payload.get("quality_score_average") ) @@ -154,6 +155,7 @@ def __repr__(self) -> str: class FeedbackSummaryContext(InstanceContext): + def __init__(self, version: Version, account_sid: str, sid: str): """ Initialize the FeedbackSummaryContext @@ -248,6 +250,7 @@ def __repr__(self) -> str: class FeedbackSummaryList(ListResource): + def __init__(self, version: Version, account_sid: str): """ Initialize the FeedbackSummaryList @@ -285,6 +288,7 @@ def create( :returns: The created FeedbackSummaryInstance """ + data = values.of( { "StartDate": serialize.iso8601_date(start_date), @@ -324,6 +328,7 @@ 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/notification.py b/twilio/rest/api/v2010/account/call/notification.py index 2f704e2c4..44291b844 100644 --- a/twilio/rest/api/v2010/account/call/notification.py +++ b/twilio/rest/api/v2010/account/call/notification.py @@ -130,6 +130,7 @@ def __repr__(self) -> str: class NotificationContext(InstanceContext): + def __init__(self, version: Version, account_sid: str, call_sid: str, sid: str): """ Initialize the NotificationContext @@ -206,6 +207,7 @@ def __repr__(self) -> str: class NotificationPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> NotificationInstance: """ Build an instance of NotificationInstance @@ -229,6 +231,7 @@ def __repr__(self) -> str: class NotificationList(ListResource): + def __init__(self, version: Version, account_sid: str, call_sid: str): """ Initialize the NotificationList diff --git a/twilio/rest/api/v2010/account/call/payment.py b/twilio/rest/api/v2010/account/call/payment.py index 229332139..540baa843 100644 --- a/twilio/rest/api/v2010/account/call/payment.py +++ b/twilio/rest/api/v2010/account/call/payment.py @@ -22,6 +22,7 @@ class PaymentInstance(InstanceResource): + class BankAccountType(object): CONSUMER_CHECKING = "consumer-checking" CONSUMER_SAVINGS = "consumer-savings" @@ -160,6 +161,7 @@ def __repr__(self) -> str: class PaymentContext(InstanceContext): + def __init__(self, version: Version, account_sid: str, call_sid: str, sid: str): """ Initialize the PaymentContext @@ -274,6 +276,7 @@ def __repr__(self) -> str: class PaymentList(ListResource): + def __init__(self, version: Version, account_sid: str, call_sid: str): """ Initialize the PaymentList @@ -337,6 +340,7 @@ def create( :returns: The created PaymentInstance """ + data = values.of( { "IdempotencyKey": idempotency_key, @@ -414,6 +418,7 @@ 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 4a852d67e..b9653c4b5 100644 --- a/twilio/rest/api/v2010/account/call/recording.py +++ b/twilio/rest/api/v2010/account/call/recording.py @@ -23,6 +23,7 @@ class RecordingInstance(InstanceResource): + class Source(object): DIALVERB = "DialVerb" CONFERENCE = "Conference" @@ -205,6 +206,7 @@ def __repr__(self) -> str: class RecordingContext(InstanceContext): + def __init__(self, version: Version, account_sid: str, call_sid: str, sid: str): """ Initialize the RecordingContext @@ -373,6 +375,7 @@ def __repr__(self) -> str: class RecordingPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> RecordingInstance: """ Build an instance of RecordingInstance @@ -396,6 +399,7 @@ def __repr__(self) -> str: class RecordingList(ListResource): + def __init__(self, version: Version, account_sid: str, call_sid: str): """ Initialize the RecordingList @@ -437,6 +441,7 @@ def create( :returns: The created RecordingInstance """ + data = values.of( { "RecordingStatusCallbackEvent": serialize.map( @@ -484,6 +489,7 @@ 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 d7742ed39..bcb537071 100644 --- a/twilio/rest/api/v2010/account/call/siprec.py +++ b/twilio/rest/api/v2010/account/call/siprec.py @@ -22,6 +22,7 @@ class SiprecInstance(InstanceResource): + class Status(object): IN_PROGRESS = "in-progress" STOPPED = "stopped" @@ -125,6 +126,7 @@ def __repr__(self) -> str: class SiprecContext(InstanceContext): + def __init__(self, version: Version, account_sid: str, call_sid: str, sid: str): """ Initialize the SiprecContext @@ -215,6 +217,7 @@ def __repr__(self) -> str: class SiprecList(ListResource): + def __init__(self, version: Version, account_sid: str, call_sid: str): """ Initialize the SiprecList @@ -650,6 +653,7 @@ def create( :returns: The created SiprecInstance """ + data = values.of( { "Name": name, @@ -1286,6 +1290,7 @@ 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 36b6bbe33..a46d8f975 100644 --- a/twilio/rest/api/v2010/account/call/stream.py +++ b/twilio/rest/api/v2010/account/call/stream.py @@ -22,6 +22,7 @@ class StreamInstance(InstanceResource): + class Status(object): IN_PROGRESS = "in-progress" STOPPED = "stopped" @@ -125,6 +126,7 @@ def __repr__(self) -> str: class StreamContext(InstanceContext): + def __init__(self, version: Version, account_sid: str, call_sid: str, sid: str): """ Initialize the StreamContext @@ -217,6 +219,7 @@ def __repr__(self) -> str: class StreamList(ListResource): + def __init__(self, version: Version, account_sid: str, call_sid: str): """ Initialize the StreamList @@ -652,6 +655,7 @@ def create( :returns: The created StreamInstance """ + data = values.of( { "Url": url, @@ -1288,6 +1292,7 @@ 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 7529a5074..0e9d1f049 100644 --- a/twilio/rest/api/v2010/account/call/user_defined_message.py +++ b/twilio/rest/api/v2010/account/call/user_defined_message.py @@ -57,6 +57,7 @@ def __repr__(self) -> str: class UserDefinedMessageList(ListResource): + def __init__(self, version: Version, account_sid: str, call_sid: str): """ Initialize the UserDefinedMessageList @@ -90,6 +91,7 @@ def create( :returns: The created UserDefinedMessageInstance """ + data = values.of( { "Content": content, @@ -121,6 +123,7 @@ 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 8d9054bc2..a0b7c1833 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 @@ -103,6 +103,7 @@ def __repr__(self) -> str: class UserDefinedMessageSubscriptionContext(InstanceContext): + def __init__(self, version: Version, account_sid: str, call_sid: str, sid: str): """ Initialize the UserDefinedMessageSubscriptionContext @@ -161,6 +162,7 @@ def __repr__(self) -> str: class UserDefinedMessageSubscriptionList(ListResource): + def __init__(self, version: Version, account_sid: str, call_sid: str): """ Initialize the UserDefinedMessageSubscriptionList @@ -196,6 +198,7 @@ def create( :returns: The created UserDefinedMessageSubscriptionInstance """ + data = values.of( { "Callback": callback, @@ -232,6 +235,7 @@ async def create_async( :returns: The created UserDefinedMessageSubscriptionInstance """ + data = values.of( { "Callback": callback, diff --git a/twilio/rest/api/v2010/account/conference/__init__.py b/twilio/rest/api/v2010/account/conference/__init__.py index cd4ec2200..fff75dea5 100644 --- a/twilio/rest/api/v2010/account/conference/__init__.py +++ b/twilio/rest/api/v2010/account/conference/__init__.py @@ -25,6 +25,7 @@ class ConferenceInstance(InstanceResource): + class ReasonConferenceEnded(object): CONFERENCE_ENDED_VIA_API = "conference-ended-via-api" PARTICIPANT_WITH_END_CONFERENCE_ON_EXIT_LEFT = ( @@ -198,6 +199,7 @@ def __repr__(self) -> str: class ConferenceContext(InstanceContext): + def __init__(self, version: Version, account_sid: str, sid: str): """ Initialize the ConferenceContext @@ -369,6 +371,7 @@ def __repr__(self) -> str: class ConferencePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ConferenceInstance: """ Build an instance of ConferenceInstance @@ -389,6 +392,7 @@ def __repr__(self) -> str: class ConferenceList(ListResource): + def __init__(self, version: Version, account_sid: str): """ Initialize the ConferenceList diff --git a/twilio/rest/api/v2010/account/conference/participant.py b/twilio/rest/api/v2010/account/conference/participant.py index 5b3d7857e..3759e4558 100644 --- a/twilio/rest/api/v2010/account/conference/participant.py +++ b/twilio/rest/api/v2010/account/conference/participant.py @@ -23,6 +23,7 @@ class ParticipantInstance(InstanceResource): + class Status(object): QUEUED = "queued" CONNECTING = "connecting" @@ -248,6 +249,7 @@ def __repr__(self) -> str: class ParticipantContext(InstanceContext): + def __init__( self, version: Version, account_sid: str, conference_sid: str, call_sid: str ): @@ -476,6 +478,7 @@ def __repr__(self) -> str: class ParticipantPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ParticipantInstance: """ Build an instance of ParticipantInstance @@ -499,6 +502,7 @@ def __repr__(self) -> str: class ParticipantList(ListResource): + def __init__(self, version: Version, account_sid: str, conference_sid: str): """ Initialize the ParticipantList @@ -570,6 +574,7 @@ 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 @@ -621,9 +626,11 @@ 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_, @@ -681,6 +688,7 @@ def create( "AmdStatusCallback": amd_status_callback, "AmdStatusCallbackMethod": amd_status_callback_method, "Trim": trim, + "CallToken": call_token, } ) @@ -748,6 +756,7 @@ 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 @@ -799,9 +808,11 @@ 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_, @@ -859,6 +870,7 @@ 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/conference/recording.py b/twilio/rest/api/v2010/account/conference/recording.py index cd8abd95d..dfb1d406e 100644 --- a/twilio/rest/api/v2010/account/conference/recording.py +++ b/twilio/rest/api/v2010/account/conference/recording.py @@ -23,6 +23,7 @@ class RecordingInstance(InstanceResource): + class Source(object): DIALVERB = "DialVerb" CONFERENCE = "Conference" @@ -203,6 +204,7 @@ def __repr__(self) -> str: class RecordingContext(InstanceContext): + def __init__( self, version: Version, account_sid: str, conference_sid: str, sid: str ): @@ -371,6 +373,7 @@ def __repr__(self) -> str: class RecordingPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> RecordingInstance: """ Build an instance of RecordingInstance @@ -394,6 +397,7 @@ def __repr__(self) -> str: class RecordingList(ListResource): + def __init__(self, version: Version, account_sid: str, conference_sid: str): """ Initialize the RecordingList diff --git a/twilio/rest/api/v2010/account/connect_app.py b/twilio/rest/api/v2010/account/connect_app.py index 50c489745..722e4e9b3 100644 --- a/twilio/rest/api/v2010/account/connect_app.py +++ b/twilio/rest/api/v2010/account/connect_app.py @@ -22,6 +22,7 @@ class ConnectAppInstance(InstanceResource): + class Permission(object): GET_ALL = "get-all" POST_ALL = "post-all" @@ -214,6 +215,7 @@ def __repr__(self) -> str: class ConnectAppContext(InstanceContext): + def __init__(self, version: Version, account_sid: str, sid: str): """ Initialize the ConnectAppContext @@ -414,6 +416,7 @@ def __repr__(self) -> str: class ConnectAppPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ConnectAppInstance: """ Build an instance of ConnectAppInstance @@ -434,6 +437,7 @@ def __repr__(self) -> str: class ConnectAppList(ListResource): + def __init__(self, version: Version, account_sid: str): """ Initialize the ConnectAppList 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 805a1b6f0..b1910d5bf 100644 --- a/twilio/rest/api/v2010/account/incoming_phone_number/__init__.py +++ b/twilio/rest/api/v2010/account/incoming_phone_number/__init__.py @@ -29,6 +29,7 @@ class IncomingPhoneNumberInstance(InstanceResource): + class AddressRequirement(object): NONE = "none" ANY = "any" @@ -394,6 +395,7 @@ def __repr__(self) -> str: class IncomingPhoneNumberContext(InstanceContext): + def __init__(self, version: Version, account_sid: str, sid: str): """ Initialize the IncomingPhoneNumberContext @@ -703,6 +705,7 @@ def __repr__(self) -> str: class IncomingPhoneNumberPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> IncomingPhoneNumberInstance: """ Build an instance of IncomingPhoneNumberInstance @@ -723,6 +726,7 @@ def __repr__(self) -> str: class IncomingPhoneNumberList(ListResource): + def __init__(self, version: Version, account_sid: str): """ Initialize the IncomingPhoneNumberList @@ -806,6 +810,7 @@ def create( :returns: The created IncomingPhoneNumberInstance """ + data = values.of( { "ApiVersion": api_version, @@ -906,6 +911,7 @@ 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 a1206eaa9..12c6f961e 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 @@ -146,6 +146,7 @@ def __repr__(self) -> str: class AssignedAddOnContext(InstanceContext): + def __init__(self, version: Version, account_sid: str, resource_sid: str, sid: str): """ Initialize the AssignedAddOnContext @@ -260,6 +261,7 @@ def __repr__(self) -> str: class AssignedAddOnPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> AssignedAddOnInstance: """ Build an instance of AssignedAddOnInstance @@ -283,6 +285,7 @@ def __repr__(self) -> str: class AssignedAddOnList(ListResource): + def __init__(self, version: Version, account_sid: str, resource_sid: str): """ Initialize the AssignedAddOnList @@ -311,6 +314,7 @@ def create(self, installed_add_on_sid: str) -> AssignedAddOnInstance: :returns: The created AssignedAddOnInstance """ + data = values.of( { "InstalledAddOnSid": installed_add_on_sid, @@ -338,6 +342,7 @@ 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/assigned_add_on/assigned_add_on_extension.py b/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/assigned_add_on_extension.py index 1c1e4b55c..18504cafd 100644 --- a/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/assigned_add_on_extension.py +++ b/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/assigned_add_on_extension.py @@ -110,6 +110,7 @@ def __repr__(self) -> str: class AssignedAddOnExtensionContext(InstanceContext): + def __init__( self, version: Version, @@ -195,6 +196,7 @@ def __repr__(self) -> str: class AssignedAddOnExtensionPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> AssignedAddOnExtensionInstance: """ Build an instance of AssignedAddOnExtensionInstance @@ -219,6 +221,7 @@ def __repr__(self) -> str: class AssignedAddOnExtensionList(ListResource): + def __init__( self, version: Version, 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 0b2bd0341..6f87f0e94 100644 --- a/twilio/rest/api/v2010/account/incoming_phone_number/local.py +++ b/twilio/rest/api/v2010/account/incoming_phone_number/local.py @@ -23,6 +23,7 @@ class LocalInstance(InstanceResource): + class AddressRequirement(object): NONE = "none" ANY = "any" @@ -151,6 +152,7 @@ def __repr__(self) -> str: class LocalPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> LocalInstance: """ Build an instance of LocalInstance @@ -171,6 +173,7 @@ def __repr__(self) -> str: class LocalList(ListResource): + def __init__(self, version: Version, account_sid: str): """ Initialize the LocalList @@ -246,6 +249,7 @@ def create( :returns: The created LocalInstance """ + data = values.of( { "PhoneNumber": phone_number, @@ -341,6 +345,7 @@ 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 09714c657..59fdda7a9 100644 --- a/twilio/rest/api/v2010/account/incoming_phone_number/mobile.py +++ b/twilio/rest/api/v2010/account/incoming_phone_number/mobile.py @@ -23,6 +23,7 @@ class MobileInstance(InstanceResource): + class AddressRequirement(object): NONE = "none" ANY = "any" @@ -151,6 +152,7 @@ def __repr__(self) -> str: class MobilePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> MobileInstance: """ Build an instance of MobileInstance @@ -171,6 +173,7 @@ def __repr__(self) -> str: class MobileList(ListResource): + def __init__(self, version: Version, account_sid: str): """ Initialize the MobileList @@ -248,6 +251,7 @@ def create( :returns: The created MobileInstance """ + data = values.of( { "PhoneNumber": phone_number, @@ -345,6 +349,7 @@ 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 bb753adc0..e6a197283 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 @@ -23,6 +23,7 @@ class TollFreeInstance(InstanceResource): + class AddressRequirement(object): NONE = "none" ANY = "any" @@ -151,6 +152,7 @@ def __repr__(self) -> str: class TollFreePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> TollFreeInstance: """ Build an instance of TollFreeInstance @@ -171,6 +173,7 @@ def __repr__(self) -> str: class TollFreeList(ListResource): + def __init__(self, version: Version, account_sid: str): """ Initialize the TollFreeList @@ -248,6 +251,7 @@ def create( :returns: The created TollFreeInstance """ + data = values.of( { "PhoneNumber": phone_number, @@ -345,6 +349,7 @@ async def create_async( :returns: The created TollFreeInstance """ + data = values.of( { "PhoneNumber": phone_number, diff --git a/twilio/rest/api/v2010/account/key.py b/twilio/rest/api/v2010/account/key.py index e4ff85955..68a9feb0e 100644 --- a/twilio/rest/api/v2010/account/key.py +++ b/twilio/rest/api/v2010/account/key.py @@ -143,6 +143,7 @@ def __repr__(self) -> str: class KeyContext(InstanceContext): + def __init__(self, version: Version, account_sid: str, sid: str): """ Initialize the KeyContext @@ -291,6 +292,7 @@ def __repr__(self) -> str: class KeyPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> KeyInstance: """ Build an instance of KeyInstance @@ -311,6 +313,7 @@ def __repr__(self) -> str: class KeyList(ListResource): + def __init__(self, version: Version, account_sid: str): """ Initialize the KeyList diff --git a/twilio/rest/api/v2010/account/message/__init__.py b/twilio/rest/api/v2010/account/message/__init__.py index f84b821fd..9706e80cf 100644 --- a/twilio/rest/api/v2010/account/message/__init__.py +++ b/twilio/rest/api/v2010/account/message/__init__.py @@ -25,6 +25,7 @@ class MessageInstance(InstanceResource): + class AddressRetention(object): RETAIN = "retain" OBFUSCATE = "obfuscate" @@ -68,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/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 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 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. @@ -244,6 +245,7 @@ def __repr__(self) -> str: class MessageContext(InstanceContext): + def __init__(self, version: Version, account_sid: str, sid: str): """ Initialize the MessageContext @@ -433,6 +435,7 @@ def __repr__(self) -> str: class MessagePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> MessageInstance: """ Build an instance of MessageInstance @@ -453,6 +456,7 @@ def __repr__(self) -> str: class MessageList(ListResource): + def __init__(self, version: Version, account_sid: str): """ Initialize the MessageList @@ -514,20 +518,21 @@ 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/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 shorten_urls: For Messaging Services with [Link Shortening configured](https://www.twilio.com/docs/messaging/features/link-shortening) only: A Boolean indicating whether or not Twilio should shorten links in the `body` of the Message. Default value is `false`. If `true`, the `messaging_service_sid` parameter must also be provided. :param schedule_type: :param send_at: The time that Twilio will send the message. Must be in ISO 8601 format. :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/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 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 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/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 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 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, @@ -611,20 +616,21 @@ 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/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 shorten_urls: For Messaging Services with [Link Shortening configured](https://www.twilio.com/docs/messaging/features/link-shortening) only: A Boolean indicating whether or not Twilio should shorten links in the `body` of the Message. Default value is `false`. If `true`, the `messaging_service_sid` parameter must also be provided. :param schedule_type: :param send_at: The time that Twilio will send the message. Must be in ISO 8601 format. :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/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 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 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/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 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 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 59758491f..2ccce06a5 100644 --- a/twilio/rest/api/v2010/account/message/feedback.py +++ b/twilio/rest/api/v2010/account/message/feedback.py @@ -22,6 +22,7 @@ class FeedbackInstance(InstanceResource): + class Outcome(object): CONFIRMED = "confirmed" UNCONFIRMED = "unconfirmed" @@ -71,6 +72,7 @@ def __repr__(self) -> str: class FeedbackList(ListResource): + def __init__(self, version: Version, account_sid: str, message_sid: str): """ Initialize the FeedbackList @@ -103,6 +105,7 @@ def create( :returns: The created FeedbackInstance """ + data = values.of( { "Outcome": outcome, @@ -132,6 +135,7 @@ async def create_async( :returns: The created FeedbackInstance """ + data = values.of( { "Outcome": outcome, diff --git a/twilio/rest/api/v2010/account/message/media.py b/twilio/rest/api/v2010/account/message/media.py index 900c73a60..4068d0c35 100644 --- a/twilio/rest/api/v2010/account/message/media.py +++ b/twilio/rest/api/v2010/account/message/media.py @@ -126,6 +126,7 @@ def __repr__(self) -> str: class MediaContext(InstanceContext): + def __init__(self, version: Version, account_sid: str, message_sid: str, sid: str): """ Initialize the MediaContext @@ -226,6 +227,7 @@ def __repr__(self) -> str: class MediaPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> MediaInstance: """ Build an instance of MediaInstance @@ -249,6 +251,7 @@ def __repr__(self) -> str: class MediaList(ListResource): + def __init__(self, version: Version, account_sid: str, message_sid: str): """ Initialize the MediaList diff --git a/twilio/rest/api/v2010/account/new_key.py b/twilio/rest/api/v2010/account/new_key.py index 51581f4f8..015249ddf 100644 --- a/twilio/rest/api/v2010/account/new_key.py +++ b/twilio/rest/api/v2010/account/new_key.py @@ -58,6 +58,7 @@ def __repr__(self) -> str: class NewKeyList(ListResource): + def __init__(self, version: Version, account_sid: str): """ Initialize the NewKeyList @@ -84,6 +85,7 @@ def create( :returns: The created NewKeyInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -110,6 +112,7 @@ 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 7cc775839..6bfa32324 100644 --- a/twilio/rest/api/v2010/account/new_signing_key.py +++ b/twilio/rest/api/v2010/account/new_signing_key.py @@ -58,6 +58,7 @@ def __repr__(self) -> str: class NewSigningKeyList(ListResource): + def __init__(self, version: Version, account_sid: str): """ Initialize the NewSigningKeyList @@ -84,6 +85,7 @@ def create( :returns: The created NewSigningKeyInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -110,6 +112,7 @@ async def create_async( :returns: The created NewSigningKeyInstance """ + data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/api/v2010/account/notification.py b/twilio/rest/api/v2010/account/notification.py index 0892b2db6..0a2e13da3 100644 --- a/twilio/rest/api/v2010/account/notification.py +++ b/twilio/rest/api/v2010/account/notification.py @@ -127,6 +127,7 @@ def __repr__(self) -> str: class NotificationContext(InstanceContext): + def __init__(self, version: Version, account_sid: str, sid: str): """ Initialize the NotificationContext @@ -197,6 +198,7 @@ def __repr__(self) -> str: class NotificationPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> NotificationInstance: """ Build an instance of NotificationInstance @@ -217,6 +219,7 @@ def __repr__(self) -> str: class NotificationList(ListResource): + def __init__(self, version: Version, account_sid: str): """ Initialize the NotificationList diff --git a/twilio/rest/api/v2010/account/outgoing_caller_id.py b/twilio/rest/api/v2010/account/outgoing_caller_id.py index a0504da87..65ddfa1cd 100644 --- a/twilio/rest/api/v2010/account/outgoing_caller_id.py +++ b/twilio/rest/api/v2010/account/outgoing_caller_id.py @@ -151,6 +151,7 @@ def __repr__(self) -> str: class OutgoingCallerIdContext(InstanceContext): + def __init__(self, version: Version, account_sid: str, sid: str): """ Initialize the OutgoingCallerIdContext @@ -303,6 +304,7 @@ def __repr__(self) -> str: class OutgoingCallerIdPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> OutgoingCallerIdInstance: """ Build an instance of OutgoingCallerIdInstance @@ -323,6 +325,7 @@ def __repr__(self) -> str: class OutgoingCallerIdList(ListResource): + def __init__(self, version: Version, account_sid: str): """ Initialize the OutgoingCallerIdList diff --git a/twilio/rest/api/v2010/account/queue/__init__.py b/twilio/rest/api/v2010/account/queue/__init__.py index 5b9d21269..4e6c87baa 100644 --- a/twilio/rest/api/v2010/account/queue/__init__.py +++ b/twilio/rest/api/v2010/account/queue/__init__.py @@ -175,6 +175,7 @@ def __repr__(self) -> str: class QueueContext(InstanceContext): + def __init__(self, version: Version, account_sid: str, sid: str): """ Initialize the QueueContext @@ -348,6 +349,7 @@ def __repr__(self) -> str: class QueuePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> QueueInstance: """ Build an instance of QueueInstance @@ -368,6 +370,7 @@ def __repr__(self) -> str: class QueueList(ListResource): + def __init__(self, version: Version, account_sid: str): """ Initialize the QueueList @@ -395,6 +398,7 @@ def create( :returns: The created QueueInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -423,6 +427,7 @@ async def create_async( :returns: The created QueueInstance """ + data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/api/v2010/account/queue/member.py b/twilio/rest/api/v2010/account/queue/member.py index 9d8e26ead..bf092ff28 100644 --- a/twilio/rest/api/v2010/account/queue/member.py +++ b/twilio/rest/api/v2010/account/queue/member.py @@ -136,6 +136,7 @@ def __repr__(self) -> str: class MemberContext(InstanceContext): + def __init__( self, version: Version, account_sid: str, queue_sid: str, call_sid: str ): @@ -278,6 +279,7 @@ def __repr__(self) -> str: class MemberPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> MemberInstance: """ Build an instance of MemberInstance @@ -301,6 +303,7 @@ def __repr__(self) -> str: class MemberList(ListResource): + def __init__(self, version: Version, account_sid: str, queue_sid: str): """ Initialize the MemberList diff --git a/twilio/rest/api/v2010/account/recording/__init__.py b/twilio/rest/api/v2010/account/recording/__init__.py index c03c48c7a..b6d7c9827 100644 --- a/twilio/rest/api/v2010/account/recording/__init__.py +++ b/twilio/rest/api/v2010/account/recording/__init__.py @@ -25,6 +25,7 @@ class RecordingInstance(InstanceResource): + class Source(object): DIALVERB = "DialVerb" CONFERENCE = "Conference" @@ -197,6 +198,7 @@ def __repr__(self) -> str: class RecordingContext(InstanceContext): + def __init__(self, version: Version, account_sid: str, sid: str): """ Initialize the RecordingContext @@ -334,6 +336,7 @@ def __repr__(self) -> str: class RecordingPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> RecordingInstance: """ Build an instance of RecordingInstance @@ -354,6 +357,7 @@ def __repr__(self) -> str: class RecordingList(ListResource): + def __init__(self, version: Version, account_sid: str): """ Initialize the RecordingList diff --git a/twilio/rest/api/v2010/account/recording/add_on_result/__init__.py b/twilio/rest/api/v2010/account/recording/add_on_result/__init__.py index 2e7bab380..af1e75f4c 100644 --- a/twilio/rest/api/v2010/account/recording/add_on_result/__init__.py +++ b/twilio/rest/api/v2010/account/recording/add_on_result/__init__.py @@ -24,6 +24,7 @@ class AddOnResultInstance(InstanceResource): + class Status(object): CANCELED = "canceled" COMPLETED = "completed" @@ -156,6 +157,7 @@ def __repr__(self) -> str: class AddOnResultContext(InstanceContext): + def __init__( self, version: Version, account_sid: str, reference_sid: str, sid: str ): @@ -272,6 +274,7 @@ def __repr__(self) -> str: class AddOnResultPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> AddOnResultInstance: """ Build an instance of AddOnResultInstance @@ -295,6 +298,7 @@ def __repr__(self) -> str: class AddOnResultList(ListResource): + def __init__(self, version: Version, account_sid: str, reference_sid: str): """ Initialize the AddOnResultList diff --git a/twilio/rest/api/v2010/account/recording/add_on_result/payload.py b/twilio/rest/api/v2010/account/recording/add_on_result/payload.py index 2b2aa7648..1dc26e1d7 100644 --- a/twilio/rest/api/v2010/account/recording/add_on_result/payload.py +++ b/twilio/rest/api/v2010/account/recording/add_on_result/payload.py @@ -141,6 +141,7 @@ def __repr__(self) -> str: class PayloadContext(InstanceContext): + def __init__( self, version: Version, @@ -250,6 +251,7 @@ def __repr__(self) -> str: class PayloadPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> PayloadInstance: """ Build an instance of PayloadInstance @@ -274,6 +276,7 @@ def __repr__(self) -> str: class PayloadList(ListResource): + def __init__( self, version: Version, diff --git a/twilio/rest/api/v2010/account/recording/transcription.py b/twilio/rest/api/v2010/account/recording/transcription.py index a89b5e0ca..bb6e0e405 100644 --- a/twilio/rest/api/v2010/account/recording/transcription.py +++ b/twilio/rest/api/v2010/account/recording/transcription.py @@ -23,6 +23,7 @@ class TranscriptionInstance(InstanceResource): + class Status(object): IN_PROGRESS = "in-progress" COMPLETED = "completed" @@ -143,6 +144,7 @@ def __repr__(self) -> str: class TranscriptionContext(InstanceContext): + def __init__( self, version: Version, account_sid: str, recording_sid: str, sid: str ): @@ -243,6 +245,7 @@ def __repr__(self) -> str: class TranscriptionPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> TranscriptionInstance: """ Build an instance of TranscriptionInstance @@ -266,6 +269,7 @@ def __repr__(self) -> str: class TranscriptionList(ListResource): + def __init__(self, version: Version, account_sid: str, recording_sid: str): """ Initialize the TranscriptionList diff --git a/twilio/rest/api/v2010/account/short_code.py b/twilio/rest/api/v2010/account/short_code.py index 5644f9214..2af049a20 100644 --- a/twilio/rest/api/v2010/account/short_code.py +++ b/twilio/rest/api/v2010/account/short_code.py @@ -175,6 +175,7 @@ def __repr__(self) -> str: class ShortCodeContext(InstanceContext): + def __init__(self, version: Version, account_sid: str, sid: str): """ Initialize the ShortCodeContext @@ -335,6 +336,7 @@ def __repr__(self) -> str: class ShortCodePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ShortCodeInstance: """ Build an instance of ShortCodeInstance @@ -355,6 +357,7 @@ def __repr__(self) -> str: class ShortCodeList(ListResource): + def __init__(self, version: Version, account_sid: str): """ Initialize the ShortCodeList diff --git a/twilio/rest/api/v2010/account/signing_key.py b/twilio/rest/api/v2010/account/signing_key.py index 51ee4a409..6ddc7b92b 100644 --- a/twilio/rest/api/v2010/account/signing_key.py +++ b/twilio/rest/api/v2010/account/signing_key.py @@ -145,6 +145,7 @@ def __repr__(self) -> str: class SigningKeyContext(InstanceContext): + def __init__(self, version: Version, account_sid: str, sid: str): """ Initialize the SigningKeyContext @@ -297,6 +298,7 @@ def __repr__(self) -> str: class SigningKeyPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> SigningKeyInstance: """ Build an instance of SigningKeyInstance @@ -317,6 +319,7 @@ def __repr__(self) -> str: class SigningKeyList(ListResource): + def __init__(self, version: Version, account_sid: str): """ Initialize the SigningKeyList diff --git a/twilio/rest/api/v2010/account/sip/__init__.py b/twilio/rest/api/v2010/account/sip/__init__.py index 49d5a5db4..12c695ff7 100644 --- a/twilio/rest/api/v2010/account/sip/__init__.py +++ b/twilio/rest/api/v2010/account/sip/__init__.py @@ -26,6 +26,7 @@ class SipList(ListResource): + def __init__(self, version: Version, account_sid: str): """ Initialize the SipList 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 d56f55a81..634500f8c 100644 --- a/twilio/rest/api/v2010/account/sip/credential_list/__init__.py +++ b/twilio/rest/api/v2010/account/sip/credential_list/__init__.py @@ -157,6 +157,7 @@ def __repr__(self) -> str: class CredentialListContext(InstanceContext): + def __init__(self, version: Version, account_sid: str, sid: str): """ Initialize the CredentialListContext @@ -320,6 +321,7 @@ def __repr__(self) -> str: class CredentialListPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> CredentialListInstance: """ Build an instance of CredentialListInstance @@ -340,6 +342,7 @@ def __repr__(self) -> str: class CredentialListList(ListResource): + def __init__(self, version: Version, account_sid: str): """ Initialize the CredentialListList @@ -366,6 +369,7 @@ def create(self, friendly_name: str) -> CredentialListInstance: :returns: The created CredentialListInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -390,6 +394,7 @@ 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 5a9dbe60b..3d2c24b99 100644 --- a/twilio/rest/api/v2010/account/sip/credential_list/credential.py +++ b/twilio/rest/api/v2010/account/sip/credential_list/credential.py @@ -154,6 +154,7 @@ def __repr__(self) -> str: class CredentialContext(InstanceContext): + def __init__( self, version: Version, account_sid: str, credential_list_sid: str, sid: str ): @@ -312,6 +313,7 @@ def __repr__(self) -> str: class CredentialPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> CredentialInstance: """ Build an instance of CredentialInstance @@ -335,6 +337,7 @@ def __repr__(self) -> str: class CredentialList(ListResource): + def __init__(self, version: Version, account_sid: str, credential_list_sid: str): """ Initialize the CredentialList @@ -364,6 +367,7 @@ def create(self, username: str, password: str) -> CredentialInstance: :returns: The created CredentialInstance """ + data = values.of( { "Username": username, @@ -393,6 +397,7 @@ 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 e43083641..f59a0c8a2 100644 --- a/twilio/rest/api/v2010/account/sip/domain/__init__.py +++ b/twilio/rest/api/v2010/account/sip/domain/__init__.py @@ -289,6 +289,7 @@ def __repr__(self) -> str: class DomainContext(InstanceContext): + def __init__(self, version: Version, account_sid: str, sid: str): """ Initialize the DomainContext @@ -560,6 +561,7 @@ def __repr__(self) -> str: class DomainPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> DomainInstance: """ Build an instance of DomainInstance @@ -580,6 +582,7 @@ def __repr__(self) -> str: class DomainList(ListResource): + def __init__(self, version: Version, account_sid: str): """ Initialize the DomainList @@ -631,6 +634,7 @@ def create( :returns: The created DomainInstance """ + data = values.of( { "DomainName": domain_name, @@ -694,6 +698,7 @@ 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/__init__.py b/twilio/rest/api/v2010/account/sip/domain/auth_types/__init__.py index 19935cf60..73a81ac90 100644 --- a/twilio/rest/api/v2010/account/sip/domain/auth_types/__init__.py +++ b/twilio/rest/api/v2010/account/sip/domain/auth_types/__init__.py @@ -27,6 +27,7 @@ class AuthTypesList(ListResource): + def __init__(self, version: Version, account_sid: str, domain_sid: str): """ Initialize the AuthTypesList diff --git a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/__init__.py b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/__init__.py index 8f7548524..79a42fa01 100644 --- a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/__init__.py +++ b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/__init__.py @@ -27,6 +27,7 @@ class AuthTypeCallsList(ListResource): + def __init__(self, version: Version, account_sid: str, domain_sid: str): """ Initialize the AuthTypeCallsList 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 05935b417..81bb5b0b0 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 @@ -124,6 +124,7 @@ def __repr__(self) -> str: class AuthCallsCredentialListMappingContext(InstanceContext): + def __init__(self, version: Version, account_sid: str, domain_sid: str, sid: str): """ Initialize the AuthCallsCredentialListMappingContext @@ -224,6 +225,7 @@ def __repr__(self) -> str: class AuthCallsCredentialListMappingPage(Page): + def get_instance( self, payload: Dict[str, Any] ) -> AuthCallsCredentialListMappingInstance: @@ -249,6 +251,7 @@ def __repr__(self) -> str: class AuthCallsCredentialListMappingList(ListResource): + def __init__(self, version: Version, account_sid: str, domain_sid: str): """ Initialize the AuthCallsCredentialListMappingList @@ -279,6 +282,7 @@ def create( :returns: The created AuthCallsCredentialListMappingInstance """ + data = values.of( { "CredentialListSid": credential_list_sid, @@ -308,6 +312,7 @@ 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 b4ad167af..a690ef4b1 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 @@ -126,6 +126,7 @@ def __repr__(self) -> str: class AuthCallsIpAccessControlListMappingContext(InstanceContext): + def __init__(self, version: Version, account_sid: str, domain_sid: str, sid: str): """ Initialize the AuthCallsIpAccessControlListMappingContext @@ -228,6 +229,7 @@ def __repr__(self) -> str: class AuthCallsIpAccessControlListMappingPage(Page): + def get_instance( self, payload: Dict[str, Any] ) -> AuthCallsIpAccessControlListMappingInstance: @@ -253,6 +255,7 @@ def __repr__(self) -> str: class AuthCallsIpAccessControlListMappingList(ListResource): + def __init__(self, version: Version, account_sid: str, domain_sid: str): """ Initialize the AuthCallsIpAccessControlListMappingList @@ -283,6 +286,7 @@ def create( :returns: The created AuthCallsIpAccessControlListMappingInstance """ + data = values.of( { "IpAccessControlListSid": ip_access_control_list_sid, @@ -312,6 +316,7 @@ 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/__init__.py b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_registrations/__init__.py index 20229d899..c10c74737 100644 --- a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_registrations/__init__.py +++ b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_registrations/__init__.py @@ -24,6 +24,7 @@ class AuthTypeRegistrationsList(ListResource): + def __init__(self, version: Version, account_sid: str, domain_sid: str): """ Initialize the AuthTypeRegistrationsList 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 488145957..2b03bb299 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 @@ -124,6 +124,7 @@ def __repr__(self) -> str: class AuthRegistrationsCredentialListMappingContext(InstanceContext): + def __init__(self, version: Version, account_sid: str, domain_sid: str, sid: str): """ Initialize the AuthRegistrationsCredentialListMappingContext @@ -224,6 +225,7 @@ def __repr__(self) -> str: class AuthRegistrationsCredentialListMappingPage(Page): + def get_instance( self, payload: Dict[str, Any] ) -> AuthRegistrationsCredentialListMappingInstance: @@ -249,6 +251,7 @@ def __repr__(self) -> str: class AuthRegistrationsCredentialListMappingList(ListResource): + def __init__(self, version: Version, account_sid: str, domain_sid: str): """ Initialize the AuthRegistrationsCredentialListMappingList @@ -279,6 +282,7 @@ def create( :returns: The created AuthRegistrationsCredentialListMappingInstance """ + data = values.of( { "CredentialListSid": credential_list_sid, @@ -308,6 +312,7 @@ 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 d951074aa..f7838bfc5 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 @@ -126,6 +126,7 @@ def __repr__(self) -> str: class CredentialListMappingContext(InstanceContext): + def __init__(self, version: Version, account_sid: str, domain_sid: str, sid: str): """ Initialize the CredentialListMappingContext @@ -224,6 +225,7 @@ def __repr__(self) -> str: class CredentialListMappingPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> CredentialListMappingInstance: """ Build an instance of CredentialListMappingInstance @@ -247,6 +249,7 @@ def __repr__(self) -> str: class CredentialListMappingList(ListResource): + def __init__(self, version: Version, account_sid: str, domain_sid: str): """ Initialize the CredentialListMappingList @@ -275,6 +278,7 @@ def create(self, credential_list_sid: str) -> CredentialListMappingInstance: :returns: The created CredentialListMappingInstance """ + data = values.of( { "CredentialListSid": credential_list_sid, @@ -304,6 +308,7 @@ 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 b534af960..c619be386 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 @@ -128,6 +128,7 @@ def __repr__(self) -> str: class IpAccessControlListMappingContext(InstanceContext): + def __init__(self, version: Version, account_sid: str, domain_sid: str, sid: str): """ Initialize the IpAccessControlListMappingContext @@ -226,6 +227,7 @@ def __repr__(self) -> str: class IpAccessControlListMappingPage(Page): + def get_instance( self, payload: Dict[str, Any] ) -> IpAccessControlListMappingInstance: @@ -251,6 +253,7 @@ def __repr__(self) -> str: class IpAccessControlListMappingList(ListResource): + def __init__(self, version: Version, account_sid: str, domain_sid: str): """ Initialize the IpAccessControlListMappingList @@ -281,6 +284,7 @@ def create( :returns: The created IpAccessControlListMappingInstance """ + data = values.of( { "IpAccessControlListSid": ip_access_control_list_sid, @@ -310,6 +314,7 @@ 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 38ea58900..7c2fd8214 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 @@ -159,6 +159,7 @@ def __repr__(self) -> str: class IpAccessControlListContext(InstanceContext): + def __init__(self, version: Version, account_sid: str, sid: str): """ Initialize the IpAccessControlListContext @@ -324,6 +325,7 @@ def __repr__(self) -> str: class IpAccessControlListPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> IpAccessControlListInstance: """ Build an instance of IpAccessControlListInstance @@ -344,6 +346,7 @@ def __repr__(self) -> str: class IpAccessControlListList(ListResource): + def __init__(self, version: Version, account_sid: str): """ Initialize the IpAccessControlListList @@ -370,6 +373,7 @@ def create(self, friendly_name: str) -> IpAccessControlListInstance: :returns: The created IpAccessControlListInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -394,6 +398,7 @@ 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 0f96c154b..251bae965 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 @@ -176,6 +176,7 @@ def __repr__(self) -> str: class IpAddressContext(InstanceContext): + def __init__( self, version: Version, @@ -354,6 +355,7 @@ def __repr__(self) -> str: class IpAddressPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> IpAddressInstance: """ Build an instance of IpAddressInstance @@ -377,6 +379,7 @@ def __repr__(self) -> str: class IpAddressList(ListResource): + def __init__( self, version: Version, account_sid: str, ip_access_control_list_sid: str ): @@ -414,6 +417,7 @@ def create( :returns: The created IpAddressInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -450,6 +454,7 @@ 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 d726fe709..ec5acac97 100644 --- a/twilio/rest/api/v2010/account/token.py +++ b/twilio/rest/api/v2010/account/token.py @@ -62,6 +62,7 @@ def __repr__(self) -> str: class TokenList(ListResource): + def __init__(self, version: Version, account_sid: str): """ Initialize the TokenList @@ -86,6 +87,7 @@ def create(self, ttl: Union[int, object] = values.unset) -> TokenInstance: :returns: The created TokenInstance """ + data = values.of( { "Ttl": ttl, @@ -112,6 +114,7 @@ async def create_async( :returns: The created TokenInstance """ + data = values.of( { "Ttl": ttl, diff --git a/twilio/rest/api/v2010/account/transcription.py b/twilio/rest/api/v2010/account/transcription.py index b757351ae..a77bc42fb 100644 --- a/twilio/rest/api/v2010/account/transcription.py +++ b/twilio/rest/api/v2010/account/transcription.py @@ -23,6 +23,7 @@ class TranscriptionInstance(InstanceResource): + class Status(object): IN_PROGRESS = "in-progress" COMPLETED = "completed" @@ -140,6 +141,7 @@ def __repr__(self) -> str: class TranscriptionContext(InstanceContext): + def __init__(self, version: Version, account_sid: str, sid: str): """ Initialize the TranscriptionContext @@ -234,6 +236,7 @@ def __repr__(self) -> str: class TranscriptionPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> TranscriptionInstance: """ Build an instance of TranscriptionInstance @@ -254,6 +257,7 @@ def __repr__(self) -> str: class TranscriptionList(ListResource): + def __init__(self, version: Version, account_sid: str): """ Initialize the TranscriptionList diff --git a/twilio/rest/api/v2010/account/usage/__init__.py b/twilio/rest/api/v2010/account/usage/__init__.py index 0e7d123ee..8fe80f64b 100644 --- a/twilio/rest/api/v2010/account/usage/__init__.py +++ b/twilio/rest/api/v2010/account/usage/__init__.py @@ -23,6 +23,7 @@ class UsageList(ListResource): + def __init__(self, version: Version, account_sid: str): """ Initialize the UsageList diff --git a/twilio/rest/api/v2010/account/usage/record/__init__.py b/twilio/rest/api/v2010/account/usage/record/__init__.py index dab521ac9..8f8236fa2 100644 --- a/twilio/rest/api/v2010/account/usage/record/__init__.py +++ b/twilio/rest/api/v2010/account/usage/record/__init__.py @@ -31,6 +31,7 @@ class RecordInstance(InstanceResource): + class Category(object): A2P_REGISTRATION_FEES = "a2p-registration-fees" AGENT_CONFERENCE = "agent-conference" @@ -412,6 +413,7 @@ def __repr__(self) -> str: class RecordPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> RecordInstance: """ Build an instance of RecordInstance @@ -432,6 +434,7 @@ def __repr__(self) -> str: class RecordList(ListResource): + def __init__(self, version: Version, account_sid: str): """ Initialize the RecordList diff --git a/twilio/rest/api/v2010/account/usage/record/all_time.py b/twilio/rest/api/v2010/account/usage/record/all_time.py index a40bdcbb7..5c424bbb8 100644 --- a/twilio/rest/api/v2010/account/usage/record/all_time.py +++ b/twilio/rest/api/v2010/account/usage/record/all_time.py @@ -23,6 +23,7 @@ class AllTimeInstance(InstanceResource): + class Category(object): A2P_REGISTRATION_FEES = "a2p-registration-fees" AGENT_CONFERENCE = "agent-conference" @@ -404,6 +405,7 @@ def __repr__(self) -> str: class AllTimePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> AllTimeInstance: """ Build an instance of AllTimeInstance @@ -424,6 +426,7 @@ def __repr__(self) -> str: class AllTimeList(ListResource): + def __init__(self, version: Version, account_sid: str): """ Initialize the AllTimeList diff --git a/twilio/rest/api/v2010/account/usage/record/daily.py b/twilio/rest/api/v2010/account/usage/record/daily.py index 5716e1c45..6ce34da02 100644 --- a/twilio/rest/api/v2010/account/usage/record/daily.py +++ b/twilio/rest/api/v2010/account/usage/record/daily.py @@ -23,6 +23,7 @@ class DailyInstance(InstanceResource): + class Category(object): A2P_REGISTRATION_FEES = "a2p-registration-fees" AGENT_CONFERENCE = "agent-conference" @@ -404,6 +405,7 @@ def __repr__(self) -> str: class DailyPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> DailyInstance: """ Build an instance of DailyInstance @@ -424,6 +426,7 @@ def __repr__(self) -> str: class DailyList(ListResource): + def __init__(self, version: Version, account_sid: str): """ Initialize the DailyList diff --git a/twilio/rest/api/v2010/account/usage/record/last_month.py b/twilio/rest/api/v2010/account/usage/record/last_month.py index 2c61b5713..53b6deec6 100644 --- a/twilio/rest/api/v2010/account/usage/record/last_month.py +++ b/twilio/rest/api/v2010/account/usage/record/last_month.py @@ -23,6 +23,7 @@ class LastMonthInstance(InstanceResource): + class Category(object): A2P_REGISTRATION_FEES = "a2p-registration-fees" AGENT_CONFERENCE = "agent-conference" @@ -404,6 +405,7 @@ def __repr__(self) -> str: class LastMonthPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> LastMonthInstance: """ Build an instance of LastMonthInstance @@ -424,6 +426,7 @@ def __repr__(self) -> str: class LastMonthList(ListResource): + def __init__(self, version: Version, account_sid: str): """ Initialize the LastMonthList diff --git a/twilio/rest/api/v2010/account/usage/record/monthly.py b/twilio/rest/api/v2010/account/usage/record/monthly.py index aa397d46b..baa1164a7 100644 --- a/twilio/rest/api/v2010/account/usage/record/monthly.py +++ b/twilio/rest/api/v2010/account/usage/record/monthly.py @@ -23,6 +23,7 @@ class MonthlyInstance(InstanceResource): + class Category(object): A2P_REGISTRATION_FEES = "a2p-registration-fees" AGENT_CONFERENCE = "agent-conference" @@ -404,6 +405,7 @@ def __repr__(self) -> str: class MonthlyPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> MonthlyInstance: """ Build an instance of MonthlyInstance @@ -424,6 +426,7 @@ def __repr__(self) -> str: class MonthlyList(ListResource): + def __init__(self, version: Version, account_sid: str): """ Initialize the MonthlyList diff --git a/twilio/rest/api/v2010/account/usage/record/this_month.py b/twilio/rest/api/v2010/account/usage/record/this_month.py index 4b11038ca..5ce2ddc58 100644 --- a/twilio/rest/api/v2010/account/usage/record/this_month.py +++ b/twilio/rest/api/v2010/account/usage/record/this_month.py @@ -23,6 +23,7 @@ class ThisMonthInstance(InstanceResource): + class Category(object): A2P_REGISTRATION_FEES = "a2p-registration-fees" AGENT_CONFERENCE = "agent-conference" @@ -404,6 +405,7 @@ def __repr__(self) -> str: class ThisMonthPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ThisMonthInstance: """ Build an instance of ThisMonthInstance @@ -424,6 +426,7 @@ def __repr__(self) -> str: class ThisMonthList(ListResource): + def __init__(self, version: Version, account_sid: str): """ Initialize the ThisMonthList diff --git a/twilio/rest/api/v2010/account/usage/record/today.py b/twilio/rest/api/v2010/account/usage/record/today.py index 32ca2f48f..cb814db81 100644 --- a/twilio/rest/api/v2010/account/usage/record/today.py +++ b/twilio/rest/api/v2010/account/usage/record/today.py @@ -23,6 +23,7 @@ class TodayInstance(InstanceResource): + class Category(object): A2P_REGISTRATION_FEES = "a2p-registration-fees" AGENT_CONFERENCE = "agent-conference" @@ -404,6 +405,7 @@ def __repr__(self) -> str: class TodayPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> TodayInstance: """ Build an instance of TodayInstance @@ -424,6 +426,7 @@ def __repr__(self) -> str: class TodayList(ListResource): + def __init__(self, version: Version, account_sid: str): """ Initialize the TodayList diff --git a/twilio/rest/api/v2010/account/usage/record/yearly.py b/twilio/rest/api/v2010/account/usage/record/yearly.py index 3e83d5bc7..ac757b9eb 100644 --- a/twilio/rest/api/v2010/account/usage/record/yearly.py +++ b/twilio/rest/api/v2010/account/usage/record/yearly.py @@ -23,6 +23,7 @@ class YearlyInstance(InstanceResource): + class Category(object): A2P_REGISTRATION_FEES = "a2p-registration-fees" AGENT_CONFERENCE = "agent-conference" @@ -404,6 +405,7 @@ def __repr__(self) -> str: class YearlyPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> YearlyInstance: """ Build an instance of YearlyInstance @@ -424,6 +426,7 @@ def __repr__(self) -> str: class YearlyList(ListResource): + def __init__(self, version: Version, account_sid: str): """ Initialize the YearlyList diff --git a/twilio/rest/api/v2010/account/usage/record/yesterday.py b/twilio/rest/api/v2010/account/usage/record/yesterday.py index f9e7f41e9..ab262b709 100644 --- a/twilio/rest/api/v2010/account/usage/record/yesterday.py +++ b/twilio/rest/api/v2010/account/usage/record/yesterday.py @@ -23,6 +23,7 @@ class YesterdayInstance(InstanceResource): + class Category(object): A2P_REGISTRATION_FEES = "a2p-registration-fees" AGENT_CONFERENCE = "agent-conference" @@ -404,6 +405,7 @@ def __repr__(self) -> str: class YesterdayPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> YesterdayInstance: """ Build an instance of YesterdayInstance @@ -424,6 +426,7 @@ def __repr__(self) -> str: class YesterdayList(ListResource): + def __init__(self, version: Version, account_sid: str): """ Initialize the YesterdayList diff --git a/twilio/rest/api/v2010/account/usage/trigger.py b/twilio/rest/api/v2010/account/usage/trigger.py index fe070c356..66e86602a 100644 --- a/twilio/rest/api/v2010/account/usage/trigger.py +++ b/twilio/rest/api/v2010/account/usage/trigger.py @@ -23,6 +23,7 @@ class TriggerInstance(InstanceResource): + class Recurring(object): DAILY = "daily" MONTHLY = "monthly" @@ -523,6 +524,7 @@ def __repr__(self) -> str: class TriggerContext(InstanceContext): + def __init__(self, version: Version, account_sid: str, sid: str): """ Initialize the TriggerContext @@ -689,6 +691,7 @@ def __repr__(self) -> str: class TriggerPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> TriggerInstance: """ Build an instance of TriggerInstance @@ -709,6 +712,7 @@ def __repr__(self) -> str: class TriggerList(ListResource): + def __init__(self, version: Version, account_sid: str): """ Initialize the TriggerList @@ -750,6 +754,7 @@ def create( :returns: The created TriggerInstance """ + data = values.of( { "CallbackUrl": callback_url, @@ -795,6 +800,7 @@ 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 922cc25c8..a949df2d0 100644 --- a/twilio/rest/api/v2010/account/validation_request.py +++ b/twilio/rest/api/v2010/account/validation_request.py @@ -53,6 +53,7 @@ def __repr__(self) -> str: class ValidationRequestList(ListResource): + def __init__(self, version: Version, account_sid: str): """ Initialize the ValidationRequestList @@ -92,6 +93,7 @@ def create( :returns: The created ValidationRequestInstance """ + data = values.of( { "PhoneNumber": phone_number, @@ -134,6 +136,7 @@ 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 deleted file mode 100644 index 3b1a7f711..000000000 --- a/twilio/rest/autopilot/AutopilotBase.py +++ /dev/null @@ -1,43 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - NOTE: This class is auto generated by OpenAPI Generator. - https://openapi-generator.tech - Do not edit the class manually. -""" - -from typing import Optional - -from twilio.base.domain import Domain -from twilio.rest import Client -from twilio.rest.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 deleted file mode 100644 index fd23e4767..000000000 --- a/twilio/rest/autopilot/v1/__init__.py +++ /dev/null @@ -1,50 +0,0 @@ -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 deleted file mode 100644 index 8ac157ed6..000000000 --- a/twilio/rest/autopilot/v1/assistant/__init__.py +++ /dev/null @@ -1,877 +0,0 @@ -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 deleted file mode 100644 index f46030107..000000000 --- a/twilio/rest/autopilot/v1/assistant/defaults.py +++ /dev/null @@ -1,271 +0,0 @@ -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 deleted file mode 100644 index 0630694fb..000000000 --- a/twilio/rest/autopilot/v1/assistant/dialogue.py +++ /dev/null @@ -1,208 +0,0 @@ -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 deleted file mode 100644 index ce9f8ba34..000000000 --- a/twilio/rest/autopilot/v1/assistant/field_type/__init__.py +++ /dev/null @@ -1,650 +0,0 @@ -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 deleted file mode 100644 index 4180f3168..000000000 --- a/twilio/rest/autopilot/v1/assistant/field_type/field_value.py +++ /dev/null @@ -1,575 +0,0 @@ -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 deleted file mode 100644 index f3c4b708a..000000000 --- a/twilio/rest/autopilot/v1/assistant/model_build.py +++ /dev/null @@ -1,626 +0,0 @@ -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 deleted file mode 100644 index 0d4286d50..000000000 --- a/twilio/rest/autopilot/v1/assistant/query.py +++ /dev/null @@ -1,727 +0,0 @@ -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 deleted file mode 100644 index 54a0533e2..000000000 --- a/twilio/rest/autopilot/v1/assistant/style_sheet.py +++ /dev/null @@ -1,271 +0,0 @@ -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 deleted file mode 100644 index 7efae4594..000000000 --- a/twilio/rest/autopilot/v1/assistant/task/__init__.py +++ /dev/null @@ -1,756 +0,0 @@ -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 deleted file mode 100644 index bf256ab4d..000000000 --- a/twilio/rest/autopilot/v1/assistant/task/field.py +++ /dev/null @@ -1,547 +0,0 @@ -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 deleted file mode 100644 index e61906bf2..000000000 --- a/twilio/rest/autopilot/v1/assistant/task/sample.py +++ /dev/null @@ -1,695 +0,0 @@ -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 deleted file mode 100644 index 46f5f20d8..000000000 --- a/twilio/rest/autopilot/v1/assistant/task/task_actions.py +++ /dev/null @@ -1,299 +0,0 @@ -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 deleted file mode 100644 index c0749fabc..000000000 --- a/twilio/rest/autopilot/v1/assistant/task/task_statistics.py +++ /dev/null @@ -1,219 +0,0 @@ -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 deleted file mode 100644 index 13fcadb79..000000000 --- a/twilio/rest/autopilot/v1/assistant/webhook.py +++ /dev/null @@ -1,669 +0,0 @@ -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 deleted file mode 100644 index 7b6daf8ec..000000000 --- a/twilio/rest/autopilot/v1/restore_assistant.py +++ /dev/null @@ -1,134 +0,0 @@ -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/BulkexportsBase.py b/twilio/rest/bulkexports/BulkexportsBase.py index d2efe642b..cbca4c53e 100644 --- a/twilio/rest/bulkexports/BulkexportsBase.py +++ b/twilio/rest/bulkexports/BulkexportsBase.py @@ -17,6 +17,7 @@ class BulkexportsBase(Domain): + def __init__(self, twilio: Client): """ Initialize the Bulkexports Domain diff --git a/twilio/rest/bulkexports/v1/__init__.py b/twilio/rest/bulkexports/v1/__init__.py index e25eb3afc..a888fb484 100644 --- a/twilio/rest/bulkexports/v1/__init__.py +++ b/twilio/rest/bulkexports/v1/__init__.py @@ -20,6 +20,7 @@ class V1(Version): + def __init__(self, domain: Domain): """ Initialize the V1 version of Bulkexports diff --git a/twilio/rest/bulkexports/v1/export/__init__.py b/twilio/rest/bulkexports/v1/export/__init__.py index 938bf8d88..c5c11df08 100644 --- a/twilio/rest/bulkexports/v1/export/__init__.py +++ b/twilio/rest/bulkexports/v1/export/__init__.py @@ -105,6 +105,7 @@ def __repr__(self) -> str: class ExportContext(InstanceContext): + def __init__(self, version: Version, resource_type: str): """ Initialize the ExportContext @@ -196,6 +197,7 @@ def __repr__(self) -> str: class ExportList(ListResource): + def __init__(self, version: Version): """ Initialize the ExportList diff --git a/twilio/rest/bulkexports/v1/export/day.py b/twilio/rest/bulkexports/v1/export/day.py index af0313137..fcbc56e97 100644 --- a/twilio/rest/bulkexports/v1/export/day.py +++ b/twilio/rest/bulkexports/v1/export/day.py @@ -98,6 +98,7 @@ def __repr__(self) -> str: class DayContext(InstanceContext): + def __init__(self, version: Version, resource_type: str, day: str): """ Initialize the DayContext @@ -166,6 +167,7 @@ def __repr__(self) -> str: class DayPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> DayInstance: """ Build an instance of DayInstance @@ -186,6 +188,7 @@ def __repr__(self) -> str: class DayList(ListResource): + def __init__(self, version: Version, resource_type: str): """ Initialize the DayList diff --git a/twilio/rest/bulkexports/v1/export/export_custom_job.py b/twilio/rest/bulkexports/v1/export/export_custom_job.py index da66ae08d..758398eba 100644 --- a/twilio/rest/bulkexports/v1/export/export_custom_job.py +++ b/twilio/rest/bulkexports/v1/export/export_custom_job.py @@ -68,6 +68,7 @@ def __repr__(self) -> str: class ExportCustomJobPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ExportCustomJobInstance: """ Build an instance of ExportCustomJobInstance @@ -88,6 +89,7 @@ def __repr__(self) -> str: class ExportCustomJobList(ListResource): + def __init__(self, version: Version, resource_type: str): """ Initialize the ExportCustomJobList @@ -125,6 +127,7 @@ def create( :returns: The created ExportCustomJobInstance """ + data = values.of( { "StartDay": start_day, @@ -167,6 +170,7 @@ async def create_async( :returns: The created ExportCustomJobInstance """ + data = values.of( { "StartDay": start_day, diff --git a/twilio/rest/bulkexports/v1/export/job.py b/twilio/rest/bulkexports/v1/export/job.py index 65cebd0e5..48b2df1ab 100644 --- a/twilio/rest/bulkexports/v1/export/job.py +++ b/twilio/rest/bulkexports/v1/export/job.py @@ -122,6 +122,7 @@ def __repr__(self) -> str: class JobContext(InstanceContext): + def __init__(self, version: Version, job_sid: str): """ Initialize the JobContext @@ -210,6 +211,7 @@ def __repr__(self) -> str: class JobList(ListResource): + def __init__(self, version: Version): """ Initialize the JobList diff --git a/twilio/rest/bulkexports/v1/export_configuration.py b/twilio/rest/bulkexports/v1/export_configuration.py index bfb6307f5..59aee9391 100644 --- a/twilio/rest/bulkexports/v1/export_configuration.py +++ b/twilio/rest/bulkexports/v1/export_configuration.py @@ -134,6 +134,7 @@ def __repr__(self) -> str: class ExportConfigurationContext(InstanceContext): + def __init__(self, version: Version, resource_type: str): """ Initialize the ExportConfigurationContext @@ -264,6 +265,7 @@ def __repr__(self) -> str: class ExportConfigurationList(ListResource): + def __init__(self, version: Version): """ Initialize the ExportConfigurationList diff --git a/twilio/rest/chat/ChatBase.py b/twilio/rest/chat/ChatBase.py index a84b4eb33..6d8656da1 100644 --- a/twilio/rest/chat/ChatBase.py +++ b/twilio/rest/chat/ChatBase.py @@ -19,6 +19,7 @@ class ChatBase(Domain): + def __init__(self, twilio: Client): """ Initialize the Chat Domain diff --git a/twilio/rest/chat/v1/__init__.py b/twilio/rest/chat/v1/__init__.py index f01101f7d..d0ade9eed 100644 --- a/twilio/rest/chat/v1/__init__.py +++ b/twilio/rest/chat/v1/__init__.py @@ -20,6 +20,7 @@ class V1(Version): + def __init__(self, domain: Domain): """ Initialize the V1 version of Chat diff --git a/twilio/rest/chat/v1/credential.py b/twilio/rest/chat/v1/credential.py index 9e6503f46..8b477b675 100644 --- a/twilio/rest/chat/v1/credential.py +++ b/twilio/rest/chat/v1/credential.py @@ -23,6 +23,7 @@ class CredentialInstance(InstanceResource): + class PushService(object): GCM = "gcm" APN = "apn" @@ -184,6 +185,7 @@ def __repr__(self) -> str: class CredentialContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the CredentialContext @@ -352,6 +354,7 @@ def __repr__(self) -> str: class CredentialPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> CredentialInstance: """ Build an instance of CredentialInstance @@ -370,6 +373,7 @@ def __repr__(self) -> str: class CredentialList(ListResource): + def __init__(self, version: Version): """ Initialize the CredentialList @@ -404,6 +408,7 @@ def create( :returns: The created CredentialInstance """ + data = values.of( { "Type": type, @@ -447,6 +452,7 @@ 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 b6feae0cc..2783da6a9 100644 --- a/twilio/rest/chat/v1/service/__init__.py +++ b/twilio/rest/chat/v1/service/__init__.py @@ -527,6 +527,7 @@ def __repr__(self) -> str: class ServiceContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the ServiceContext @@ -1023,6 +1024,7 @@ def __repr__(self) -> str: class ServicePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ServiceInstance: """ Build an instance of ServiceInstance @@ -1041,6 +1043,7 @@ def __repr__(self) -> str: class ServiceList(ListResource): + def __init__(self, version: Version): """ Initialize the ServiceList @@ -1060,6 +1063,7 @@ def create(self, friendly_name: str) -> ServiceInstance: :returns: The created ServiceInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -1082,6 +1086,7 @@ 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 fbfe141fc..158561394 100644 --- a/twilio/rest/chat/v1/service/channel/__init__.py +++ b/twilio/rest/chat/v1/service/channel/__init__.py @@ -26,6 +26,7 @@ class ChannelInstance(InstanceResource): + class ChannelType(object): PUBLIC = "public" PRIVATE = "private" @@ -211,6 +212,7 @@ def __repr__(self) -> str: class ChannelContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the ChannelContext @@ -418,6 +420,7 @@ def __repr__(self) -> str: class ChannelPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ChannelInstance: """ Build an instance of ChannelInstance @@ -438,6 +441,7 @@ def __repr__(self) -> str: class ChannelList(ListResource): + def __init__(self, version: Version, service_sid: str): """ Initialize the ChannelList @@ -471,6 +475,7 @@ def create( :returns: The created ChannelInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -507,6 +512,7 @@ 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 639c4c509..6beccffae 100644 --- a/twilio/rest/chat/v1/service/channel/invite.py +++ b/twilio/rest/chat/v1/service/channel/invite.py @@ -132,6 +132,7 @@ def __repr__(self) -> str: class InviteContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, channel_sid: str, sid: str): """ Initialize the InviteContext @@ -232,6 +233,7 @@ def __repr__(self) -> str: class InvitePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> InviteInstance: """ Build an instance of InviteInstance @@ -255,6 +257,7 @@ def __repr__(self) -> str: class InviteList(ListResource): + def __init__(self, version: Version, service_sid: str, channel_sid: str): """ Initialize the InviteList @@ -286,6 +289,7 @@ def create( :returns: The created InviteInstance """ + data = values.of( { "Identity": identity, @@ -317,6 +321,7 @@ 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 6880f064e..f0cd21448 100644 --- a/twilio/rest/chat/v1/service/channel/member.py +++ b/twilio/rest/chat/v1/service/channel/member.py @@ -174,6 +174,7 @@ def __repr__(self) -> str: class MemberContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, channel_sid: str, sid: str): """ Initialize the MemberContext @@ -342,6 +343,7 @@ def __repr__(self) -> str: class MemberPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> MemberInstance: """ Build an instance of MemberInstance @@ -365,6 +367,7 @@ def __repr__(self) -> str: class MemberList(ListResource): + def __init__(self, version: Version, service_sid: str, channel_sid: str): """ Initialize the MemberList @@ -396,6 +399,7 @@ def create( :returns: The created MemberInstance """ + data = values.of( { "Identity": identity, @@ -427,6 +431,7 @@ 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 bf4db73dd..f524c9238 100644 --- a/twilio/rest/chat/v1/service/channel/message.py +++ b/twilio/rest/chat/v1/service/channel/message.py @@ -23,6 +23,7 @@ class MessageInstance(InstanceResource): + class OrderType(object): ASC = "asc" DESC = "desc" @@ -178,6 +179,7 @@ def __repr__(self) -> str: class MessageContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, channel_sid: str, sid: str): """ Initialize the MessageContext @@ -346,6 +348,7 @@ def __repr__(self) -> str: class MessagePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> MessageInstance: """ Build an instance of MessageInstance @@ -369,6 +372,7 @@ def __repr__(self) -> str: class MessageList(ListResource): + def __init__(self, version: Version, service_sid: str, channel_sid: str): """ Initialize the MessageList @@ -404,6 +408,7 @@ def create( :returns: The created MessageInstance """ + data = values.of( { "Body": body, @@ -440,6 +445,7 @@ 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 e83e30fd5..1913986a4 100644 --- a/twilio/rest/chat/v1/service/role.py +++ b/twilio/rest/chat/v1/service/role.py @@ -23,6 +23,7 @@ class RoleInstance(InstanceResource): + class RoleType(object): CHANNEL = "channel" DEPLOYMENT = "deployment" @@ -155,6 +156,7 @@ def __repr__(self) -> str: class RoleContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the RoleContext @@ -301,6 +303,7 @@ def __repr__(self) -> str: class RolePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> RoleInstance: """ Build an instance of RoleInstance @@ -321,6 +324,7 @@ def __repr__(self) -> str: class RoleList(ListResource): + def __init__(self, version: Version, service_sid: str): """ Initialize the RoleList @@ -349,6 +353,7 @@ def create( :returns: The created RoleInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -379,6 +384,7 @@ 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 ba5d038e2..b06509668 100644 --- a/twilio/rest/chat/v1/service/user/__init__.py +++ b/twilio/rest/chat/v1/service/user/__init__.py @@ -189,6 +189,7 @@ def __repr__(self) -> str: class UserContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the UserContext @@ -368,6 +369,7 @@ def __repr__(self) -> str: class UserPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> UserInstance: """ Build an instance of UserInstance @@ -388,6 +390,7 @@ def __repr__(self) -> str: class UserList(ListResource): + def __init__(self, version: Version, service_sid: str): """ Initialize the UserList @@ -421,6 +424,7 @@ def create( :returns: The created UserInstance """ + data = values.of( { "Identity": identity, @@ -457,6 +461,7 @@ async def create_async( :returns: The created UserInstance """ + data = values.of( { "Identity": identity, diff --git a/twilio/rest/chat/v1/service/user/user_channel.py b/twilio/rest/chat/v1/service/user/user_channel.py index 6a781e9ff..01e639cea 100644 --- a/twilio/rest/chat/v1/service/user/user_channel.py +++ b/twilio/rest/chat/v1/service/user/user_channel.py @@ -22,6 +22,7 @@ class UserChannelInstance(InstanceResource): + class ChannelStatus(object): JOINED = "joined" INVITED = "invited" @@ -74,6 +75,7 @@ def __repr__(self) -> str: class UserChannelPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> UserChannelInstance: """ Build an instance of UserChannelInstance @@ -97,6 +99,7 @@ def __repr__(self) -> str: class UserChannelList(ListResource): + def __init__(self, version: Version, service_sid: str, user_sid: str): """ Initialize the UserChannelList diff --git a/twilio/rest/chat/v2/__init__.py b/twilio/rest/chat/v2/__init__.py index c433e8543..e949532d5 100644 --- a/twilio/rest/chat/v2/__init__.py +++ b/twilio/rest/chat/v2/__init__.py @@ -20,6 +20,7 @@ class V2(Version): + def __init__(self, domain: Domain): """ Initialize the V2 version of Chat diff --git a/twilio/rest/chat/v2/credential.py b/twilio/rest/chat/v2/credential.py index 1c2f8a5cf..564cd5159 100644 --- a/twilio/rest/chat/v2/credential.py +++ b/twilio/rest/chat/v2/credential.py @@ -23,6 +23,7 @@ class CredentialInstance(InstanceResource): + class PushService(object): GCM = "gcm" APN = "apn" @@ -184,6 +185,7 @@ def __repr__(self) -> str: class CredentialContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the CredentialContext @@ -352,6 +354,7 @@ def __repr__(self) -> str: class CredentialPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> CredentialInstance: """ Build an instance of CredentialInstance @@ -370,6 +373,7 @@ def __repr__(self) -> str: class CredentialList(ListResource): + def __init__(self, version: Version): """ Initialize the CredentialList @@ -404,6 +408,7 @@ def create( :returns: The created CredentialInstance """ + data = values.of( { "Type": type, @@ -447,6 +452,7 @@ 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 d7ba975bd..66dd200b4 100644 --- a/twilio/rest/chat/v2/service/__init__.py +++ b/twilio/rest/chat/v2/service/__init__.py @@ -409,6 +409,7 @@ def __repr__(self) -> str: class ServiceContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the ServiceContext @@ -784,6 +785,7 @@ def __repr__(self) -> str: class ServicePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ServiceInstance: """ Build an instance of ServiceInstance @@ -802,6 +804,7 @@ def __repr__(self) -> str: class ServiceList(ListResource): + def __init__(self, version: Version): """ Initialize the ServiceList @@ -821,6 +824,7 @@ def create(self, friendly_name: str) -> ServiceInstance: :returns: The created ServiceInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -843,6 +847,7 @@ 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/binding.py b/twilio/rest/chat/v2/service/binding.py index cf792202c..2f960c513 100644 --- a/twilio/rest/chat/v2/service/binding.py +++ b/twilio/rest/chat/v2/service/binding.py @@ -23,6 +23,7 @@ class BindingInstance(InstanceResource): + class BindingType(object): GCM = "gcm" APN = "apn" @@ -140,6 +141,7 @@ def __repr__(self) -> str: class BindingContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the BindingContext @@ -232,6 +234,7 @@ def __repr__(self) -> str: class BindingPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> BindingInstance: """ Build an instance of BindingInstance @@ -252,6 +255,7 @@ def __repr__(self) -> str: class BindingList(ListResource): + def __init__(self, version: Version, service_sid: str): """ Initialize the BindingList diff --git a/twilio/rest/chat/v2/service/channel/__init__.py b/twilio/rest/chat/v2/service/channel/__init__.py index 421d2a7df..2b49faf26 100644 --- a/twilio/rest/chat/v2/service/channel/__init__.py +++ b/twilio/rest/chat/v2/service/channel/__init__.py @@ -27,6 +27,7 @@ class ChannelInstance(InstanceResource): + class ChannelType(object): PUBLIC = "public" PRIVATE = "private" @@ -267,6 +268,7 @@ def __repr__(self) -> str: class ChannelContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the ChannelContext @@ -540,6 +542,7 @@ def __repr__(self) -> str: class ChannelPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ChannelInstance: """ Build an instance of ChannelInstance @@ -560,6 +563,7 @@ def __repr__(self) -> str: class ChannelList(ListResource): + def __init__(self, version: Version, service_sid: str): """ Initialize the ChannelList @@ -603,6 +607,7 @@ def create( :returns: The created ChannelInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -619,6 +624,7 @@ def create( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -654,6 +660,7 @@ async def create_async( :returns: The created ChannelInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -670,6 +677,7 @@ 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 3c6ed8244..2c7333786 100644 --- a/twilio/rest/chat/v2/service/channel/invite.py +++ b/twilio/rest/chat/v2/service/channel/invite.py @@ -132,6 +132,7 @@ def __repr__(self) -> str: class InviteContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, channel_sid: str, sid: str): """ Initialize the InviteContext @@ -232,6 +233,7 @@ def __repr__(self) -> str: class InvitePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> InviteInstance: """ Build an instance of InviteInstance @@ -255,6 +257,7 @@ def __repr__(self) -> str: class InviteList(ListResource): + def __init__(self, version: Version, service_sid: str, channel_sid: str): """ Initialize the InviteList @@ -286,6 +289,7 @@ def create( :returns: The created InviteInstance """ + data = values.of( { "Identity": identity, @@ -317,6 +321,7 @@ 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 689233b28..c71d3e345 100644 --- a/twilio/rest/chat/v2/service/channel/member.py +++ b/twilio/rest/chat/v2/service/channel/member.py @@ -23,6 +23,7 @@ class MemberInstance(InstanceResource): + class WebhookEnabledType(object): TRUE = "true" FALSE = "false" @@ -230,6 +231,7 @@ def __repr__(self) -> str: class MemberContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, channel_sid: str, sid: str): """ Initialize the MemberContext @@ -460,6 +462,7 @@ def __repr__(self) -> str: class MemberPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> MemberInstance: """ Build an instance of MemberInstance @@ -483,6 +486,7 @@ def __repr__(self) -> str: class MemberList(ListResource): + def __init__(self, version: Version, service_sid: str, channel_sid: str): """ Initialize the MemberList @@ -530,6 +534,7 @@ def create( :returns: The created MemberInstance """ + data = values.of( { "Identity": identity, @@ -548,6 +553,7 @@ def create( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -586,6 +592,7 @@ async def create_async( :returns: The created MemberInstance """ + data = values.of( { "Identity": identity, @@ -604,6 +611,7 @@ 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 847f063dc..e98f526c7 100644 --- a/twilio/rest/chat/v2/service/channel/message.py +++ b/twilio/rest/chat/v2/service/channel/message.py @@ -23,6 +23,7 @@ class MessageInstance(InstanceResource): + class OrderType(object): ASC = "asc" DESC = "desc" @@ -238,6 +239,7 @@ def __repr__(self) -> str: class MessageContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, channel_sid: str, sid: str): """ Initialize the MessageContext @@ -464,6 +466,7 @@ def __repr__(self) -> str: class MessagePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> MessageInstance: """ Build an instance of MessageInstance @@ -487,6 +490,7 @@ def __repr__(self) -> str: class MessageList(ListResource): + def __init__(self, version: Version, service_sid: str, channel_sid: str): """ Initialize the MessageList @@ -534,6 +538,7 @@ def create( :returns: The created MessageInstance """ + data = values.of( { "From": from_, @@ -550,6 +555,7 @@ def create( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -588,6 +594,7 @@ async def create_async( :returns: The created MessageInstance """ + data = values.of( { "From": from_, @@ -604,6 +611,7 @@ 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 072fe1cba..ca738bac4 100644 --- a/twilio/rest/chat/v2/service/channel/webhook.py +++ b/twilio/rest/chat/v2/service/channel/webhook.py @@ -23,6 +23,7 @@ class WebhookInstance(InstanceResource): + class Method(object): GET = "GET" POST = "POST" @@ -199,6 +200,7 @@ def __repr__(self) -> str: class WebhookContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, channel_sid: str, sid: str): """ Initialize the WebhookContext @@ -399,6 +401,7 @@ def __repr__(self) -> str: class WebhookPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> WebhookInstance: """ Build an instance of WebhookInstance @@ -422,6 +425,7 @@ def __repr__(self) -> str: class WebhookList(ListResource): + def __init__(self, version: Version, service_sid: str, channel_sid: str): """ Initialize the WebhookList @@ -465,6 +469,7 @@ def create( :returns: The created WebhookInstance """ + data = values.of( { "Type": type, @@ -517,6 +522,7 @@ 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 4fddd4c9e..5bb373c9a 100644 --- a/twilio/rest/chat/v2/service/role.py +++ b/twilio/rest/chat/v2/service/role.py @@ -23,6 +23,7 @@ class RoleInstance(InstanceResource): + class RoleType(object): CHANNEL = "channel" DEPLOYMENT = "deployment" @@ -155,6 +156,7 @@ def __repr__(self) -> str: class RoleContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the RoleContext @@ -301,6 +303,7 @@ def __repr__(self) -> str: class RolePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> RoleInstance: """ Build an instance of RoleInstance @@ -321,6 +324,7 @@ def __repr__(self) -> str: class RoleList(ListResource): + def __init__(self, version: Version, service_sid: str): """ Initialize the RoleList @@ -349,6 +353,7 @@ def create( :returns: The created RoleInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -379,6 +384,7 @@ 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 bfb71480c..2c4ac5a3b 100644 --- a/twilio/rest/chat/v2/service/user/__init__.py +++ b/twilio/rest/chat/v2/service/user/__init__.py @@ -25,6 +25,7 @@ class UserInstance(InstanceResource): + class WebhookEnabledType(object): TRUE = "true" FALSE = "false" @@ -211,6 +212,7 @@ def __repr__(self) -> str: class UserContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the UserContext @@ -418,6 +420,7 @@ def __repr__(self) -> str: class UserPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> UserInstance: """ Build an instance of UserInstance @@ -438,6 +441,7 @@ def __repr__(self) -> str: class UserList(ListResource): + def __init__(self, version: Version, service_sid: str): """ Initialize the UserList @@ -475,6 +479,7 @@ def create( :returns: The created UserInstance """ + data = values.of( { "Identity": identity, @@ -488,6 +493,7 @@ def create( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -517,6 +523,7 @@ async def create_async( :returns: The created UserInstance """ + data = values.of( { "Identity": identity, @@ -530,6 +537,7 @@ 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/user/user_binding.py b/twilio/rest/chat/v2/service/user/user_binding.py index ef934a6d3..4170c74fb 100644 --- a/twilio/rest/chat/v2/service/user/user_binding.py +++ b/twilio/rest/chat/v2/service/user/user_binding.py @@ -23,6 +23,7 @@ class UserBindingInstance(InstanceResource): + class BindingType(object): GCM = "gcm" APN = "apn" @@ -143,6 +144,7 @@ def __repr__(self) -> str: class UserBindingContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, user_sid: str, sid: str): """ Initialize the UserBindingContext @@ -241,6 +243,7 @@ def __repr__(self) -> str: class UserBindingPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> UserBindingInstance: """ Build an instance of UserBindingInstance @@ -264,6 +267,7 @@ def __repr__(self) -> str: class UserBindingList(ListResource): + def __init__(self, version: Version, service_sid: str, user_sid: str): """ Initialize the UserBindingList diff --git a/twilio/rest/chat/v2/service/user/user_channel.py b/twilio/rest/chat/v2/service/user/user_channel.py index 94b9ddbd7..1fd25254a 100644 --- a/twilio/rest/chat/v2/service/user/user_channel.py +++ b/twilio/rest/chat/v2/service/user/user_channel.py @@ -23,6 +23,7 @@ class UserChannelInstance(InstanceResource): + class ChannelStatus(object): JOINED = "joined" INVITED = "invited" @@ -213,6 +214,7 @@ def __repr__(self) -> str: class UserChannelContext(InstanceContext): + def __init__( self, version: Version, service_sid: str, user_sid: str, channel_sid: str ): @@ -417,6 +419,7 @@ def __repr__(self) -> str: class UserChannelPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> UserChannelInstance: """ Build an instance of UserChannelInstance @@ -440,6 +443,7 @@ def __repr__(self) -> str: class UserChannelList(ListResource): + def __init__(self, version: Version, service_sid: str, user_sid: str): """ Initialize the UserChannelList diff --git a/twilio/rest/chat/v3/__init__.py b/twilio/rest/chat/v3/__init__.py index 7fdfc8977..582dc4406 100644 --- a/twilio/rest/chat/v3/__init__.py +++ b/twilio/rest/chat/v3/__init__.py @@ -19,6 +19,7 @@ class V3(Version): + def __init__(self, domain: Domain): """ Initialize the V3 version of Chat diff --git a/twilio/rest/chat/v3/channel.py b/twilio/rest/chat/v3/channel.py index 92ba531ed..e9d10b55b 100644 --- a/twilio/rest/chat/v3/channel.py +++ b/twilio/rest/chat/v3/channel.py @@ -22,6 +22,7 @@ class ChannelInstance(InstanceResource): + class ChannelType(object): PUBLIC = "public" PRIVATE = "private" @@ -158,6 +159,7 @@ def __repr__(self) -> str: class ChannelContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the ChannelContext @@ -266,6 +268,7 @@ def __repr__(self) -> str: class ChannelList(ListResource): + def __init__(self, version: Version): """ Initialize the ChannelList diff --git a/twilio/rest/content/ContentBase.py b/twilio/rest/content/ContentBase.py index 72dfbad76..a8511f9ff 100644 --- a/twilio/rest/content/ContentBase.py +++ b/twilio/rest/content/ContentBase.py @@ -17,6 +17,7 @@ class ContentBase(Domain): + def __init__(self, twilio: Client): """ Initialize the Content Domain diff --git a/twilio/rest/content/v1/__init__.py b/twilio/rest/content/v1/__init__.py index 68f3f13a6..1410fe478 100644 --- a/twilio/rest/content/v1/__init__.py +++ b/twilio/rest/content/v1/__init__.py @@ -21,6 +21,7 @@ class V1(Version): + def __init__(self, domain: Domain): """ Initialize the V1 version of Content diff --git a/twilio/rest/content/v1/content/__init__.py b/twilio/rest/content/v1/content/__init__.py index 87ed5b58e..b057cb4f8 100644 --- a/twilio/rest/content/v1/content/__init__.py +++ b/twilio/rest/content/v1/content/__init__.py @@ -32,7 +32,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-api/content-types-overview) (e.g. twilio/text) for this Content resource. + :ivar types: The [Content types](https://www.twilio.com/docs/content/content-types-overview) (e.g. twilio/text) for this Content resource. :ivar url: The URL of the resource, relative to `https://content.twilio.com`. :ivar links: A list of links related to the Content resource, such as approval_fetch and approval_create """ @@ -131,6 +131,7 @@ def __repr__(self) -> str: class ContentContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the ContentContext @@ -233,6 +234,7 @@ def __repr__(self) -> str: class ContentPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ContentInstance: """ Build an instance of ContentInstance @@ -251,6 +253,7 @@ def __repr__(self) -> str: class ContentList(ListResource): + def __init__(self, version: Version): """ Initialize the ContentList diff --git a/twilio/rest/content/v1/content/approval_fetch.py b/twilio/rest/content/v1/content/approval_fetch.py index 31466a4e9..f35ef6a48 100644 --- a/twilio/rest/content/v1/content/approval_fetch.py +++ b/twilio/rest/content/v1/content/approval_fetch.py @@ -84,6 +84,7 @@ def __repr__(self) -> str: class ApprovalFetchContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the ApprovalFetchContext @@ -148,6 +149,7 @@ def __repr__(self) -> str: class ApprovalFetchList(ListResource): + def __init__(self, version: Version, sid: str): """ Initialize the ApprovalFetchList diff --git a/twilio/rest/content/v1/content_and_approvals.py b/twilio/rest/content/v1/content_and_approvals.py index b826a1b28..e2d6d72aa 100644 --- a/twilio/rest/content/v1/content_and_approvals.py +++ b/twilio/rest/content/v1/content_and_approvals.py @@ -31,7 +31,7 @@ class ContentAndApprovalsInstance(InstanceResource): :ivar friendly_name: A string name used to describe the Content resource. Not visible to the end recipient. :ivar language: Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in. :ivar variables: Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}. - :ivar types: The [Content types](https://www.twilio.com/docs/content-api/content-types-overview) (e.g. twilio/text) for this Content resource. + :ivar types: The [Content types](https://www.twilio.com/docs/content/content-types-overview) (e.g. twilio/text) for this Content resource. :ivar approval_requests: The submitted information and approval request status of the Content resource. """ @@ -65,6 +65,7 @@ def __repr__(self) -> str: class ContentAndApprovalsPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ContentAndApprovalsInstance: """ Build an instance of ContentAndApprovalsInstance @@ -83,6 +84,7 @@ def __repr__(self) -> str: class ContentAndApprovalsList(ListResource): + def __init__(self, version: Version): """ Initialize the ContentAndApprovalsList diff --git a/twilio/rest/content/v1/legacy_content.py b/twilio/rest/content/v1/legacy_content.py index 15ea2f939..5705c33b0 100644 --- a/twilio/rest/content/v1/legacy_content.py +++ b/twilio/rest/content/v1/legacy_content.py @@ -31,7 +31,7 @@ class LegacyContentInstance(InstanceResource): :ivar friendly_name: A string name used to describe the Content resource. Not visible to the end recipient. :ivar language: Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in. :ivar variables: Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}. - :ivar types: The [Content types](https://www.twilio.com/docs/content-api/content-types-overview) (e.g. twilio/text) for this Content resource. + :ivar types: The [Content types](https://www.twilio.com/docs/content/content-types-overview) (e.g. twilio/text) for this Content resource. :ivar legacy_template_name: The string name of the legacy content template associated with this Content resource, unique across all template names for its account. Only lowercase letters, numbers and underscores are allowed :ivar legacy_body: The string body field of the legacy content template associated with this Content resource :ivar url: The URL of the resource, relative to `https://content.twilio.com`. @@ -67,6 +67,7 @@ def __repr__(self) -> str: class LegacyContentPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> LegacyContentInstance: """ Build an instance of LegacyContentInstance @@ -85,6 +86,7 @@ def __repr__(self) -> str: class LegacyContentList(ListResource): + def __init__(self, version: Version): """ Initialize the LegacyContentList diff --git a/twilio/rest/conversations/ConversationsBase.py b/twilio/rest/conversations/ConversationsBase.py index 06d5533e3..890430836 100644 --- a/twilio/rest/conversations/ConversationsBase.py +++ b/twilio/rest/conversations/ConversationsBase.py @@ -17,6 +17,7 @@ class ConversationsBase(Domain): + def __init__(self, twilio: Client): """ Initialize the Conversations Domain diff --git a/twilio/rest/conversations/v1/__init__.py b/twilio/rest/conversations/v1/__init__.py index 0fbe314fa..3296ba2b4 100644 --- a/twilio/rest/conversations/v1/__init__.py +++ b/twilio/rest/conversations/v1/__init__.py @@ -28,6 +28,7 @@ class V1(Version): + def __init__(self, domain: Domain): """ Initialize the V1 version of Conversations diff --git a/twilio/rest/conversations/v1/address_configuration.py b/twilio/rest/conversations/v1/address_configuration.py index 17310d8e3..3295eade6 100644 --- a/twilio/rest/conversations/v1/address_configuration.py +++ b/twilio/rest/conversations/v1/address_configuration.py @@ -23,6 +23,7 @@ class AddressConfigurationInstance(InstanceResource): + class AutoCreationType(object): WEBHOOK = "webhook" STUDIO = "studio" @@ -227,6 +228,7 @@ def __repr__(self) -> str: class AddressConfigurationContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the AddressConfigurationContext @@ -431,6 +433,7 @@ def __repr__(self) -> str: class AddressConfigurationPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> AddressConfigurationInstance: """ Build an instance of AddressConfigurationInstance @@ -449,6 +452,7 @@ def __repr__(self) -> str: class AddressConfigurationList(ListResource): + def __init__(self, version: Version): """ Initialize the AddressConfigurationList @@ -497,6 +501,7 @@ def create( :returns: The created AddressConfigurationInstance """ + data = values.of( { "Type": type, @@ -561,6 +566,7 @@ async def create_async( :returns: The created AddressConfigurationInstance """ + data = values.of( { "Type": type, diff --git a/twilio/rest/conversations/v1/configuration/__init__.py b/twilio/rest/conversations/v1/configuration/__init__.py index 64a5a6b1b..46f511aa1 100644 --- a/twilio/rest/conversations/v1/configuration/__init__.py +++ b/twilio/rest/conversations/v1/configuration/__init__.py @@ -143,6 +143,7 @@ def __repr__(self) -> str: class ConfigurationContext(InstanceContext): + def __init__(self, version: Version): """ Initialize the ConfigurationContext @@ -268,6 +269,7 @@ def __repr__(self) -> str: class ConfigurationList(ListResource): + def __init__(self, version: Version): """ Initialize the ConfigurationList diff --git a/twilio/rest/conversations/v1/configuration/webhook.py b/twilio/rest/conversations/v1/configuration/webhook.py index d357acbea..4ece54232 100644 --- a/twilio/rest/conversations/v1/configuration/webhook.py +++ b/twilio/rest/conversations/v1/configuration/webhook.py @@ -21,6 +21,7 @@ class WebhookInstance(InstanceResource): + class Method(object): GET = "GET" POST = "POST" @@ -149,6 +150,7 @@ def __repr__(self) -> str: class WebhookContext(InstanceContext): + def __init__(self, version: Version): """ Initialize the WebhookContext @@ -280,6 +282,7 @@ def __repr__(self) -> str: class WebhookList(ListResource): + def __init__(self, version: Version): """ Initialize the WebhookList diff --git a/twilio/rest/conversations/v1/conversation/__init__.py b/twilio/rest/conversations/v1/conversation/__init__.py index d3ea6dfb1..bdb4bda32 100644 --- a/twilio/rest/conversations/v1/conversation/__init__.py +++ b/twilio/rest/conversations/v1/conversation/__init__.py @@ -26,6 +26,7 @@ class ConversationInstance(InstanceResource): + class State(object): INACTIVE = "inactive" ACTIVE = "active" @@ -280,6 +281,7 @@ def __repr__(self) -> str: class ConversationContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the ConversationContext @@ -552,6 +554,7 @@ def __repr__(self) -> str: class ConversationPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ConversationInstance: """ Build an instance of ConversationInstance @@ -570,6 +573,7 @@ def __repr__(self) -> str: class ConversationList(ListResource): + def __init__(self, version: Version): """ Initialize the ConversationList @@ -616,6 +620,7 @@ def create( :returns: The created ConversationInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -636,6 +641,7 @@ def create( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -677,6 +683,7 @@ async def create_async( :returns: The created ConversationInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -697,6 +704,7 @@ 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 87b3fd048..e3e9dea1b 100644 --- a/twilio/rest/conversations/v1/conversation/message/__init__.py +++ b/twilio/rest/conversations/v1/conversation/message/__init__.py @@ -26,6 +26,7 @@ class MessageInstance(InstanceResource): + class OrderType(object): ASC = "asc" DESC = "desc" @@ -49,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-api) template. + :ivar content_sid: The unique ID of the multi-channel [Rich Content](https://www.twilio.com/docs/content) template. """ def __init__( @@ -67,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[object]] = payload.get("media") + self.media: Optional[List[Dict[str, 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( @@ -243,6 +244,7 @@ def __repr__(self) -> str: class MessageContext(InstanceContext): + def __init__(self, version: Version, conversation_sid: str, sid: str): """ Initialize the MessageContext @@ -476,6 +478,7 @@ def __repr__(self) -> str: class MessagePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> MessageInstance: """ Build an instance of MessageInstance @@ -496,6 +499,7 @@ def __repr__(self) -> str: class MessageList(ListResource): + def __init__(self, version: Version, conversation_sid: str): """ Initialize the MessageList @@ -539,12 +543,13 @@ 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-api) 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) 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, @@ -563,6 +568,7 @@ def create( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -596,12 +602,13 @@ 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-api) 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) 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, @@ -620,6 +627,7 @@ 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/delivery_receipt.py b/twilio/rest/conversations/v1/conversation/message/delivery_receipt.py index f8b74d74b..16af7892e 100644 --- a/twilio/rest/conversations/v1/conversation/message/delivery_receipt.py +++ b/twilio/rest/conversations/v1/conversation/message/delivery_receipt.py @@ -23,6 +23,7 @@ class DeliveryReceiptInstance(InstanceResource): + class DeliveryStatus(object): READ = "read" FAILED = "failed" @@ -125,6 +126,7 @@ def __repr__(self) -> str: class DeliveryReceiptContext(InstanceContext): + def __init__( self, version: Version, conversation_sid: str, message_sid: str, sid: str ): @@ -201,6 +203,7 @@ def __repr__(self) -> str: class DeliveryReceiptPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> DeliveryReceiptInstance: """ Build an instance of DeliveryReceiptInstance @@ -224,6 +227,7 @@ def __repr__(self) -> str: class DeliveryReceiptList(ListResource): + def __init__(self, version: Version, conversation_sid: str, message_sid: str): """ Initialize the DeliveryReceiptList diff --git a/twilio/rest/conversations/v1/conversation/participant.py b/twilio/rest/conversations/v1/conversation/participant.py index 2a9c45a59..499bdbf30 100644 --- a/twilio/rest/conversations/v1/conversation/participant.py +++ b/twilio/rest/conversations/v1/conversation/participant.py @@ -23,6 +23,7 @@ class ParticipantInstance(InstanceResource): + class WebhookEnabledType(object): TRUE = "true" FALSE = "false" @@ -245,6 +246,7 @@ def __repr__(self) -> str: class ParticipantContext(InstanceContext): + def __init__(self, version: Version, conversation_sid: str, sid: str): """ Initialize the ParticipantContext @@ -481,6 +483,7 @@ def __repr__(self) -> str: class ParticipantPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ParticipantInstance: """ Build an instance of ParticipantInstance @@ -501,6 +504,7 @@ def __repr__(self) -> str: class ParticipantList(ListResource): + def __init__(self, version: Version, conversation_sid: str): """ Initialize the ParticipantList @@ -548,6 +552,7 @@ def create( :returns: The created ParticipantInstance """ + data = values.of( { "Identity": identity, @@ -565,6 +570,7 @@ def create( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -602,6 +608,7 @@ async def create_async( :returns: The created ParticipantInstance """ + data = values.of( { "Identity": identity, @@ -619,6 +626,7 @@ 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 cb7690cfc..623887986 100644 --- a/twilio/rest/conversations/v1/conversation/webhook.py +++ b/twilio/rest/conversations/v1/conversation/webhook.py @@ -23,6 +23,7 @@ class WebhookInstance(InstanceResource): + class Method(object): GET = "GET" POST = "POST" @@ -188,6 +189,7 @@ def __repr__(self) -> str: class WebhookContext(InstanceContext): + def __init__(self, version: Version, conversation_sid: str, sid: str): """ Initialize the WebhookContext @@ -374,6 +376,7 @@ def __repr__(self) -> str: class WebhookPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> WebhookInstance: """ Build an instance of WebhookInstance @@ -394,6 +397,7 @@ def __repr__(self) -> str: class WebhookList(ListResource): + def __init__(self, version: Version, conversation_sid: str): """ Initialize the WebhookList @@ -435,6 +439,7 @@ def create( :returns: The created WebhookInstance """ + data = values.of( { "Target": target, @@ -484,6 +489,7 @@ 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 1a5c0fb95..92f26d1f0 100644 --- a/twilio/rest/conversations/v1/credential.py +++ b/twilio/rest/conversations/v1/credential.py @@ -23,6 +23,7 @@ class CredentialInstance(InstanceResource): + class PushType(object): APN = "apn" GCM = "gcm" @@ -190,6 +191,7 @@ def __repr__(self) -> str: class CredentialContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the CredentialContext @@ -364,6 +366,7 @@ def __repr__(self) -> str: class CredentialPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> CredentialInstance: """ Build an instance of CredentialInstance @@ -382,6 +385,7 @@ def __repr__(self) -> str: class CredentialList(ListResource): + def __init__(self, version: Version): """ Initialize the CredentialList @@ -416,6 +420,7 @@ def create( :returns: The created CredentialInstance """ + data = values.of( { "Type": type, @@ -459,6 +464,7 @@ async def create_async( :returns: The created CredentialInstance """ + data = values.of( { "Type": type, diff --git a/twilio/rest/conversations/v1/participant_conversation.py b/twilio/rest/conversations/v1/participant_conversation.py index e61383c32..741304715 100644 --- a/twilio/rest/conversations/v1/participant_conversation.py +++ b/twilio/rest/conversations/v1/participant_conversation.py @@ -23,6 +23,7 @@ class ParticipantConversationInstance(InstanceResource): + class State(object): INACTIVE = "inactive" ACTIVE = "active" @@ -96,6 +97,7 @@ def __repr__(self) -> str: class ParticipantConversationPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ParticipantConversationInstance: """ Build an instance of ParticipantConversationInstance @@ -114,6 +116,7 @@ def __repr__(self) -> str: class ParticipantConversationList(ListResource): + def __init__(self, version: Version): """ Initialize the ParticipantConversationList diff --git a/twilio/rest/conversations/v1/role.py b/twilio/rest/conversations/v1/role.py index 4a8dccfaa..b5d4d2c6d 100644 --- a/twilio/rest/conversations/v1/role.py +++ b/twilio/rest/conversations/v1/role.py @@ -23,6 +23,7 @@ class RoleInstance(InstanceResource): + class RoleType(object): CONVERSATION = "conversation" SERVICE = "service" @@ -149,6 +150,7 @@ def __repr__(self) -> str: class RoleContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the RoleContext @@ -281,6 +283,7 @@ def __repr__(self) -> str: class RolePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> RoleInstance: """ Build an instance of RoleInstance @@ -299,6 +302,7 @@ def __repr__(self) -> str: class RoleList(ListResource): + def __init__(self, version: Version): """ Initialize the RoleList @@ -322,6 +326,7 @@ def create( :returns: The created RoleInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -350,6 +355,7 @@ 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 e8bf95e97..2a9f12090 100644 --- a/twilio/rest/conversations/v1/service/__init__.py +++ b/twilio/rest/conversations/v1/service/__init__.py @@ -167,6 +167,7 @@ def __repr__(self) -> str: class ServiceContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the ServiceContext @@ -334,6 +335,7 @@ def __repr__(self) -> str: class ServicePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ServiceInstance: """ Build an instance of ServiceInstance @@ -352,6 +354,7 @@ def __repr__(self) -> str: class ServiceList(ListResource): + def __init__(self, version: Version): """ Initialize the ServiceList @@ -371,6 +374,7 @@ def create(self, friendly_name: str) -> ServiceInstance: :returns: The created ServiceInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -393,6 +397,7 @@ 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/binding.py b/twilio/rest/conversations/v1/service/binding.py index 5a9f2d1e2..6e6684449 100644 --- a/twilio/rest/conversations/v1/service/binding.py +++ b/twilio/rest/conversations/v1/service/binding.py @@ -23,6 +23,7 @@ class BindingInstance(InstanceResource): + class BindingType(object): APN = "apn" GCM = "gcm" @@ -138,6 +139,7 @@ def __repr__(self) -> str: class BindingContext(InstanceContext): + def __init__(self, version: Version, chat_service_sid: str, sid: str): """ Initialize the BindingContext @@ -232,6 +234,7 @@ def __repr__(self) -> str: class BindingPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> BindingInstance: """ Build an instance of BindingInstance @@ -252,6 +255,7 @@ def __repr__(self) -> str: class BindingList(ListResource): + def __init__(self, version: Version, chat_service_sid: str): """ Initialize the BindingList diff --git a/twilio/rest/conversations/v1/service/configuration/__init__.py b/twilio/rest/conversations/v1/service/configuration/__init__.py index 4f2191882..15de8dfda 100644 --- a/twilio/rest/conversations/v1/service/configuration/__init__.py +++ b/twilio/rest/conversations/v1/service/configuration/__init__.py @@ -152,6 +152,7 @@ def __repr__(self) -> str: class ConfigurationContext(InstanceContext): + def __init__(self, version: Version, chat_service_sid: str): """ Initialize the ConfigurationContext @@ -290,6 +291,7 @@ def __repr__(self) -> str: class ConfigurationList(ListResource): + def __init__(self, version: Version, chat_service_sid: str): """ Initialize the ConfigurationList diff --git a/twilio/rest/conversations/v1/service/configuration/notification.py b/twilio/rest/conversations/v1/service/configuration/notification.py index cc79c5362..498478fdf 100644 --- a/twilio/rest/conversations/v1/service/configuration/notification.py +++ b/twilio/rest/conversations/v1/service/configuration/notification.py @@ -199,6 +199,7 @@ def __repr__(self) -> str: class NotificationContext(InstanceContext): + def __init__(self, version: Version, chat_service_sid: str): """ Initialize the NotificationContext @@ -391,6 +392,7 @@ def __repr__(self) -> str: class NotificationList(ListResource): + def __init__(self, version: Version, chat_service_sid: str): """ Initialize the NotificationList diff --git a/twilio/rest/conversations/v1/service/configuration/webhook.py b/twilio/rest/conversations/v1/service/configuration/webhook.py index 7d6ad0df0..aa4015361 100644 --- a/twilio/rest/conversations/v1/service/configuration/webhook.py +++ b/twilio/rest/conversations/v1/service/configuration/webhook.py @@ -21,6 +21,7 @@ class WebhookInstance(InstanceResource): + class Method(object): GET = "GET" POST = "POST" @@ -145,6 +146,7 @@ def __repr__(self) -> str: class WebhookContext(InstanceContext): + def __init__(self, version: Version, chat_service_sid: str): """ Initialize the WebhookContext @@ -283,6 +285,7 @@ def __repr__(self) -> str: class WebhookList(ListResource): + def __init__(self, version: Version, chat_service_sid: str): """ Initialize the WebhookList diff --git a/twilio/rest/conversations/v1/service/conversation/__init__.py b/twilio/rest/conversations/v1/service/conversation/__init__.py index 8f072a653..c347977a4 100644 --- a/twilio/rest/conversations/v1/service/conversation/__init__.py +++ b/twilio/rest/conversations/v1/service/conversation/__init__.py @@ -28,6 +28,7 @@ class ConversationInstance(InstanceResource): + class State(object): INACTIVE = "inactive" ACTIVE = "active" @@ -288,6 +289,7 @@ def __repr__(self) -> str: class ConversationContext(InstanceContext): + def __init__(self, version: Version, chat_service_sid: str, sid: str): """ Initialize the ConversationContext @@ -579,6 +581,7 @@ def __repr__(self) -> str: class ConversationPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ConversationInstance: """ Build an instance of ConversationInstance @@ -599,6 +602,7 @@ def __repr__(self) -> str: class ConversationList(ListResource): + def __init__(self, version: Version, chat_service_sid: str): """ Initialize the ConversationList @@ -652,6 +656,7 @@ def create( :returns: The created ConversationInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -672,6 +677,7 @@ def create( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -715,6 +721,7 @@ async def create_async( :returns: The created ConversationInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -735,6 +742,7 @@ 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 d6bc253b6..753df1835 100644 --- a/twilio/rest/conversations/v1/service/conversation/message/__init__.py +++ b/twilio/rest/conversations/v1/service/conversation/message/__init__.py @@ -26,6 +26,7 @@ class MessageInstance(InstanceResource): + class OrderType(object): ASC = "asc" DESC = "desc" @@ -50,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-api) template. + :ivar content_sid: The unique ID of the multi-channel [Rich Content](https://www.twilio.com/docs/content) template. """ def __init__( @@ -70,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[object]] = payload.get("media") + self.media: Optional[List[Dict[str, 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( @@ -248,6 +249,7 @@ def __repr__(self) -> str: class MessageContext(InstanceContext): + def __init__( self, version: Version, chat_service_sid: str, conversation_sid: str, sid: str ): @@ -490,6 +492,7 @@ def __repr__(self) -> str: class MessagePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> MessageInstance: """ Build an instance of MessageInstance @@ -513,6 +516,7 @@ def __repr__(self) -> str: class MessageList(ListResource): + def __init__(self, version: Version, chat_service_sid: str, conversation_sid: str): """ Initialize the MessageList @@ -558,12 +562,13 @@ 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-api) 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) 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, @@ -582,6 +587,7 @@ def create( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -618,12 +624,13 @@ 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-api) 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) 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, @@ -642,6 +649,7 @@ 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/delivery_receipt.py b/twilio/rest/conversations/v1/service/conversation/message/delivery_receipt.py index 73c197cd7..b9bf8a70c 100644 --- a/twilio/rest/conversations/v1/service/conversation/message/delivery_receipt.py +++ b/twilio/rest/conversations/v1/service/conversation/message/delivery_receipt.py @@ -23,6 +23,7 @@ class DeliveryReceiptInstance(InstanceResource): + class DeliveryStatus(object): READ = "read" FAILED = "failed" @@ -130,6 +131,7 @@ def __repr__(self) -> str: class DeliveryReceiptContext(InstanceContext): + def __init__( self, version: Version, @@ -215,6 +217,7 @@ def __repr__(self) -> str: class DeliveryReceiptPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> DeliveryReceiptInstance: """ Build an instance of DeliveryReceiptInstance @@ -239,6 +242,7 @@ def __repr__(self) -> str: class DeliveryReceiptList(ListResource): + def __init__( self, version: Version, diff --git a/twilio/rest/conversations/v1/service/conversation/participant.py b/twilio/rest/conversations/v1/service/conversation/participant.py index a2f4497db..6f6eee61e 100644 --- a/twilio/rest/conversations/v1/service/conversation/participant.py +++ b/twilio/rest/conversations/v1/service/conversation/participant.py @@ -23,6 +23,7 @@ class ParticipantInstance(InstanceResource): + class WebhookEnabledType(object): TRUE = "true" FALSE = "false" @@ -250,6 +251,7 @@ def __repr__(self) -> str: class ParticipantContext(InstanceContext): + def __init__( self, version: Version, chat_service_sid: str, conversation_sid: str, sid: str ): @@ -494,6 +496,7 @@ def __repr__(self) -> str: class ParticipantPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ParticipantInstance: """ Build an instance of ParticipantInstance @@ -517,6 +520,7 @@ def __repr__(self) -> str: class ParticipantList(ListResource): + def __init__(self, version: Version, chat_service_sid: str, conversation_sid: str): """ Initialize the ParticipantList @@ -566,6 +570,7 @@ def create( :returns: The created ParticipantInstance """ + data = values.of( { "Identity": identity, @@ -583,6 +588,7 @@ def create( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -623,6 +629,7 @@ async def create_async( :returns: The created ParticipantInstance """ + data = values.of( { "Identity": identity, @@ -640,6 +647,7 @@ 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 cd3b8a73d..83b267406 100644 --- a/twilio/rest/conversations/v1/service/conversation/webhook.py +++ b/twilio/rest/conversations/v1/service/conversation/webhook.py @@ -23,6 +23,7 @@ class WebhookInstance(InstanceResource): + class Method(object): GET = "GET" POST = "POST" @@ -193,6 +194,7 @@ def __repr__(self) -> str: class WebhookContext(InstanceContext): + def __init__( self, version: Version, chat_service_sid: str, conversation_sid: str, sid: str ): @@ -387,6 +389,7 @@ def __repr__(self) -> str: class WebhookPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> WebhookInstance: """ Build an instance of WebhookInstance @@ -410,6 +413,7 @@ def __repr__(self) -> str: class WebhookList(ListResource): + def __init__(self, version: Version, chat_service_sid: str, conversation_sid: str): """ Initialize the WebhookList @@ -453,6 +457,7 @@ def create( :returns: The created WebhookInstance """ + data = values.of( { "Target": target, @@ -505,6 +510,7 @@ async def create_async( :returns: The created WebhookInstance """ + data = values.of( { "Target": target, diff --git a/twilio/rest/conversations/v1/service/participant_conversation.py b/twilio/rest/conversations/v1/service/participant_conversation.py index 156fc6534..2c3bebcc1 100644 --- a/twilio/rest/conversations/v1/service/participant_conversation.py +++ b/twilio/rest/conversations/v1/service/participant_conversation.py @@ -23,6 +23,7 @@ class ParticipantConversationInstance(InstanceResource): + class State(object): INACTIVE = "inactive" ACTIVE = "active" @@ -104,6 +105,7 @@ def __repr__(self) -> str: class ParticipantConversationPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ParticipantConversationInstance: """ Build an instance of ParticipantConversationInstance @@ -124,6 +126,7 @@ def __repr__(self) -> str: class ParticipantConversationList(ListResource): + def __init__(self, version: Version, chat_service_sid: str): """ Initialize the ParticipantConversationList diff --git a/twilio/rest/conversations/v1/service/role.py b/twilio/rest/conversations/v1/service/role.py index dfd7391c6..3c0a0fc90 100644 --- a/twilio/rest/conversations/v1/service/role.py +++ b/twilio/rest/conversations/v1/service/role.py @@ -23,6 +23,7 @@ class RoleInstance(InstanceResource): + class RoleType(object): CONVERSATION = "conversation" SERVICE = "service" @@ -155,6 +156,7 @@ def __repr__(self) -> str: class RoleContext(InstanceContext): + def __init__(self, version: Version, chat_service_sid: str, sid: str): """ Initialize the RoleContext @@ -301,6 +303,7 @@ def __repr__(self) -> str: class RolePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> RoleInstance: """ Build an instance of RoleInstance @@ -321,6 +324,7 @@ def __repr__(self) -> str: class RoleList(ListResource): + def __init__(self, version: Version, chat_service_sid: str): """ Initialize the RoleList @@ -349,6 +353,7 @@ def create( :returns: The created RoleInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -379,6 +384,7 @@ 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 7d8be91f8..37a8d2e4f 100644 --- a/twilio/rest/conversations/v1/service/user/__init__.py +++ b/twilio/rest/conversations/v1/service/user/__init__.py @@ -26,6 +26,7 @@ class UserInstance(InstanceResource): + class WebhookEnabledType(object): TRUE = "true" FALSE = "false" @@ -217,6 +218,7 @@ def __repr__(self) -> str: class UserContext(InstanceContext): + def __init__(self, version: Version, chat_service_sid: str, sid: str): """ Initialize the UserContext @@ -430,6 +432,7 @@ def __repr__(self) -> str: class UserPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> UserInstance: """ Build an instance of UserInstance @@ -450,6 +453,7 @@ def __repr__(self) -> str: class UserList(ListResource): + def __init__(self, version: Version, chat_service_sid: str): """ Initialize the UserList @@ -487,6 +491,7 @@ def create( :returns: The created UserInstance """ + data = values.of( { "Identity": identity, @@ -500,6 +505,7 @@ def create( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -529,6 +535,7 @@ async def create_async( :returns: The created UserInstance """ + data = values.of( { "Identity": identity, @@ -542,6 +549,7 @@ 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/user/user_conversation.py b/twilio/rest/conversations/v1/service/user/user_conversation.py index 625d219d4..7a836505b 100644 --- a/twilio/rest/conversations/v1/service/user/user_conversation.py +++ b/twilio/rest/conversations/v1/service/user/user_conversation.py @@ -23,6 +23,7 @@ class UserConversationInstance(InstanceResource): + class NotificationLevel(object): DEFAULT = "default" MUTED = "muted" @@ -211,6 +212,7 @@ def __repr__(self) -> str: class UserConversationContext(InstanceContext): + def __init__( self, version: Version, @@ -393,6 +395,7 @@ def __repr__(self) -> str: class UserConversationPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> UserConversationInstance: """ Build an instance of UserConversationInstance @@ -416,6 +419,7 @@ def __repr__(self) -> str: class UserConversationList(ListResource): + def __init__(self, version: Version, chat_service_sid: str, user_sid: str): """ Initialize the UserConversationList diff --git a/twilio/rest/conversations/v1/user/__init__.py b/twilio/rest/conversations/v1/user/__init__.py index e983da13a..d8017c510 100644 --- a/twilio/rest/conversations/v1/user/__init__.py +++ b/twilio/rest/conversations/v1/user/__init__.py @@ -24,6 +24,7 @@ class UserInstance(InstanceResource): + class WebhookEnabledType(object): TRUE = "true" FALSE = "false" @@ -209,6 +210,7 @@ def __repr__(self) -> str: class UserContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the UserContext @@ -407,6 +409,7 @@ def __repr__(self) -> str: class UserPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> UserInstance: """ Build an instance of UserInstance @@ -425,6 +428,7 @@ def __repr__(self) -> str: class UserList(ListResource): + def __init__(self, version: Version): """ Initialize the UserList @@ -457,6 +461,7 @@ def create( :returns: The created UserInstance """ + data = values.of( { "Identity": identity, @@ -470,6 +475,7 @@ def create( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -497,6 +503,7 @@ async def create_async( :returns: The created UserInstance """ + data = values.of( { "Identity": identity, @@ -510,6 +517,7 @@ 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/user_conversation.py b/twilio/rest/conversations/v1/user/user_conversation.py index d7d06a6ee..e16244115 100644 --- a/twilio/rest/conversations/v1/user/user_conversation.py +++ b/twilio/rest/conversations/v1/user/user_conversation.py @@ -23,6 +23,7 @@ class UserConversationInstance(InstanceResource): + class NotificationLevel(object): DEFAULT = "default" MUTED = "muted" @@ -208,6 +209,7 @@ def __repr__(self) -> str: class UserConversationContext(InstanceContext): + def __init__(self, version: Version, user_sid: str, conversation_sid: str): """ Initialize the UserConversationContext @@ -378,6 +380,7 @@ def __repr__(self) -> str: class UserConversationPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> UserConversationInstance: """ Build an instance of UserConversationInstance @@ -398,6 +401,7 @@ def __repr__(self) -> str: class UserConversationList(ListResource): + def __init__(self, version: Version, user_sid: str): """ Initialize the UserConversationList diff --git a/twilio/rest/events/EventsBase.py b/twilio/rest/events/EventsBase.py index 17c087a1d..eb2251ae4 100644 --- a/twilio/rest/events/EventsBase.py +++ b/twilio/rest/events/EventsBase.py @@ -17,6 +17,7 @@ class EventsBase(Domain): + def __init__(self, twilio: Client): """ Initialize the Events Domain diff --git a/twilio/rest/events/v1/__init__.py b/twilio/rest/events/v1/__init__.py index d62e813d5..6b9135544 100644 --- a/twilio/rest/events/v1/__init__.py +++ b/twilio/rest/events/v1/__init__.py @@ -22,6 +22,7 @@ class V1(Version): + def __init__(self, domain: Domain): """ Initialize the V1 version of Events diff --git a/twilio/rest/events/v1/event_type.py b/twilio/rest/events/v1/event_type.py index 451c74d2a..7215df8f2 100644 --- a/twilio/rest/events/v1/event_type.py +++ b/twilio/rest/events/v1/event_type.py @@ -99,6 +99,7 @@ def __repr__(self) -> str: class EventTypeContext(InstanceContext): + def __init__(self, version: Version, type: str): """ Initialize the EventTypeContext @@ -163,6 +164,7 @@ def __repr__(self) -> str: class EventTypePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> EventTypeInstance: """ Build an instance of EventTypeInstance @@ -181,6 +183,7 @@ def __repr__(self) -> str: class EventTypeList(ListResource): + def __init__(self, version: Version): """ Initialize the EventTypeList diff --git a/twilio/rest/events/v1/schema/__init__.py b/twilio/rest/events/v1/schema/__init__.py index 22383e76d..c3b6593c0 100644 --- a/twilio/rest/events/v1/schema/__init__.py +++ b/twilio/rest/events/v1/schema/__init__.py @@ -103,6 +103,7 @@ def __repr__(self) -> str: class SchemaContext(InstanceContext): + def __init__(self, version: Version, id: str): """ Initialize the SchemaContext @@ -181,6 +182,7 @@ def __repr__(self) -> str: class SchemaList(ListResource): + def __init__(self, version: Version): """ Initialize the SchemaList diff --git a/twilio/rest/events/v1/schema/schema_version.py b/twilio/rest/events/v1/schema/schema_version.py index 58c8207ca..3557cb293 100644 --- a/twilio/rest/events/v1/schema/schema_version.py +++ b/twilio/rest/events/v1/schema/schema_version.py @@ -101,6 +101,7 @@ def __repr__(self) -> str: class SchemaVersionContext(InstanceContext): + def __init__(self, version: Version, id: str, schema_version: int): """ Initialize the SchemaVersionContext @@ -169,6 +170,7 @@ def __repr__(self) -> str: class SchemaVersionPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> SchemaVersionInstance: """ Build an instance of SchemaVersionInstance @@ -187,6 +189,7 @@ def __repr__(self) -> str: class SchemaVersionList(ListResource): + def __init__(self, version: Version, id: str): """ Initialize the SchemaVersionList diff --git a/twilio/rest/events/v1/sink/__init__.py b/twilio/rest/events/v1/sink/__init__.py index 51d25b800..67688f296 100644 --- a/twilio/rest/events/v1/sink/__init__.py +++ b/twilio/rest/events/v1/sink/__init__.py @@ -25,6 +25,7 @@ class SinkInstance(InstanceResource): + class SinkType(object): KINESIS = "kinesis" WEBHOOK = "webhook" @@ -174,6 +175,7 @@ def __repr__(self) -> str: class SinkContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the SinkContext @@ -333,6 +335,7 @@ def __repr__(self) -> str: class SinkPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> SinkInstance: """ Build an instance of SinkInstance @@ -351,6 +354,7 @@ def __repr__(self) -> str: class SinkList(ListResource): + def __init__(self, version: Version): """ Initialize the SinkList @@ -377,6 +381,7 @@ def create( :returns: The created SinkInstance """ + data = values.of( { "Description": description, @@ -408,6 +413,7 @@ async def create_async( :returns: The created SinkInstance """ + data = values.of( { "Description": description, diff --git a/twilio/rest/events/v1/sink/sink_test.py b/twilio/rest/events/v1/sink/sink_test.py index 3b49a36cf..adf04f582 100644 --- a/twilio/rest/events/v1/sink/sink_test.py +++ b/twilio/rest/events/v1/sink/sink_test.py @@ -44,6 +44,7 @@ def __repr__(self) -> str: class SinkTestList(ListResource): + def __init__(self, version: Version, sid: str): """ Initialize the SinkTestList diff --git a/twilio/rest/events/v1/sink/sink_validate.py b/twilio/rest/events/v1/sink/sink_validate.py index be24c8869..4c24dd76b 100644 --- a/twilio/rest/events/v1/sink/sink_validate.py +++ b/twilio/rest/events/v1/sink/sink_validate.py @@ -45,6 +45,7 @@ def __repr__(self) -> str: class SinkValidateList(ListResource): + def __init__(self, version: Version, sid: str): """ Initialize the SinkValidateList @@ -69,6 +70,7 @@ def create(self, test_id: str) -> SinkValidateInstance: :returns: The created SinkValidateInstance """ + data = values.of( { "TestId": test_id, @@ -91,6 +93,7 @@ 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 5b0651a01..666b26aa7 100644 --- a/twilio/rest/events/v1/subscription/__init__.py +++ b/twilio/rest/events/v1/subscription/__init__.py @@ -163,6 +163,7 @@ def __repr__(self) -> str: class SubscriptionContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the SubscriptionContext @@ -321,6 +322,7 @@ def __repr__(self) -> str: class SubscriptionPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> SubscriptionInstance: """ Build an instance of SubscriptionInstance @@ -339,6 +341,7 @@ def __repr__(self) -> str: class SubscriptionList(ListResource): + def __init__(self, version: Version): """ Initialize the SubscriptionList @@ -362,6 +365,7 @@ def create( :returns: The created SubscriptionInstance """ + data = values.of( { "Description": description, @@ -390,6 +394,7 @@ 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 03017f0dd..80c9ce149 100644 --- a/twilio/rest/events/v1/subscription/subscribed_event.py +++ b/twilio/rest/events/v1/subscription/subscribed_event.py @@ -25,7 +25,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. """ @@ -111,7 +111,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 """ @@ -125,7 +125,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 """ @@ -144,6 +144,7 @@ def __repr__(self) -> str: class SubscribedEventContext(InstanceContext): + def __init__(self, version: Version, subscription_sid: str, type: str): """ Initialize the SubscribedEventContext @@ -233,7 +234,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 """ @@ -262,7 +263,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 """ @@ -296,6 +297,7 @@ def __repr__(self) -> str: class SubscribedEventPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> SubscribedEventInstance: """ Build an instance of SubscribedEventInstance @@ -316,6 +318,7 @@ def __repr__(self) -> str: class SubscribedEventList(ListResource): + def __init__(self, version: Version, subscription_sid: str): """ Initialize the SubscribedEventList @@ -341,10 +344,11 @@ 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, @@ -369,10 +373,11 @@ 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/FlexApiBase.py b/twilio/rest/flex_api/FlexApiBase.py index afdad4734..3bda5b6b4 100644 --- a/twilio/rest/flex_api/FlexApiBase.py +++ b/twilio/rest/flex_api/FlexApiBase.py @@ -18,6 +18,7 @@ class FlexApiBase(Domain): + def __init__(self, twilio: Client): """ Initialize the FlexApi Domain diff --git a/twilio/rest/flex_api/v1/__init__.py b/twilio/rest/flex_api/v1/__init__.py index 1b895467f..7ee41b75f 100644 --- a/twilio/rest/flex_api/v1/__init__.py +++ b/twilio/rest/flex_api/v1/__init__.py @@ -22,6 +22,12 @@ from twilio.rest.flex_api.v1.insights_assessments_comment import ( InsightsAssessmentsCommentList, ) +from twilio.rest.flex_api.v1.insights_conversational_ai import ( + InsightsConversationalAiList, +) +from twilio.rest.flex_api.v1.insights_conversational_ai_report_insights import ( + InsightsConversationalAiReportInsightsList, +) from twilio.rest.flex_api.v1.insights_conversations import InsightsConversationsList from twilio.rest.flex_api.v1.insights_questionnaires import InsightsQuestionnairesList from twilio.rest.flex_api.v1.insights_questionnaires_category import ( @@ -40,10 +46,12 @@ ) 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 class V1(Version): + def __init__(self, domain: Domain): """ Initialize the V1 version of FlexApi @@ -58,6 +66,10 @@ def __init__(self, domain: Domain): self._insights_assessments_comment: Optional[InsightsAssessmentsCommentList] = ( None ) + self._insights_conversational_ai: Optional[InsightsConversationalAiList] = None + self._insights_conversational_ai_report_insights: Optional[ + InsightsConversationalAiReportInsightsList + ] = None self._insights_conversations: Optional[InsightsConversationsList] = None self._insights_questionnaires: Optional[InsightsQuestionnairesList] = None self._insights_questionnaires_category: Optional[ @@ -74,6 +86,7 @@ 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 @@ -106,6 +119,22 @@ def insights_assessments_comment(self) -> InsightsAssessmentsCommentList: self._insights_assessments_comment = InsightsAssessmentsCommentList(self) return self._insights_assessments_comment + @property + def insights_conversational_ai(self) -> InsightsConversationalAiList: + if self._insights_conversational_ai is None: + self._insights_conversational_ai = InsightsConversationalAiList(self) + return self._insights_conversational_ai + + @property + def insights_conversational_ai_report_insights( + self, + ) -> InsightsConversationalAiReportInsightsList: + if self._insights_conversational_ai_report_insights is None: + self._insights_conversational_ai_report_insights = ( + InsightsConversationalAiReportInsightsList(self) + ) + return self._insights_conversational_ai_report_insights + @property def insights_conversations(self) -> InsightsConversationsList: if self._insights_conversations is None: @@ -170,6 +199,12 @@ 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 1e2030a8f..23648b104 100644 --- a/twilio/rest/flex_api/v1/assessments.py +++ b/twilio/rest/flex_api/v1/assessments.py @@ -141,6 +141,7 @@ def __repr__(self) -> str: class AssessmentsContext(InstanceContext): + def __init__(self, version: Version, assessment_sid: str): """ Initialize the AssessmentsContext @@ -245,6 +246,7 @@ def __repr__(self) -> str: class AssessmentsPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> AssessmentsInstance: """ Build an instance of AssessmentsInstance @@ -263,6 +265,7 @@ def __repr__(self) -> str: class AssessmentsList(ListResource): + def __init__(self, version: Version): """ Initialize the AssessmentsList @@ -305,6 +308,7 @@ def create( :returns: The created AssessmentsInstance """ + data = values.of( { "CategorySid": category_sid, @@ -324,6 +328,7 @@ def create( "Authorization": authorization, } ) + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -361,6 +366,7 @@ async def create_async( :returns: The created AssessmentsInstance """ + data = values.of( { "CategorySid": category_sid, @@ -380,6 +386,7 @@ 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 5b2300952..a2f1e1af0 100644 --- a/twilio/rest/flex_api/v1/channel.py +++ b/twilio/rest/flex_api/v1/channel.py @@ -119,6 +119,7 @@ def __repr__(self) -> str: class ChannelContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the ChannelContext @@ -207,6 +208,7 @@ def __repr__(self) -> str: class ChannelPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ChannelInstance: """ Build an instance of ChannelInstance @@ -225,6 +227,7 @@ def __repr__(self) -> str: class ChannelList(ListResource): + def __init__(self, version: Version): """ Initialize the ChannelList @@ -265,6 +268,7 @@ def create( :returns: The created ChannelInstance """ + data = values.of( { "FlexFlowSid": flex_flow_sid, @@ -317,6 +321,7 @@ 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 fc9a60923..511321a58 100644 --- a/twilio/rest/flex_api/v1/configuration.py +++ b/twilio/rest/flex_api/v1/configuration.py @@ -22,6 +22,7 @@ class ConfigurationInstance(InstanceResource): + class Status(object): OK = "ok" INPROGRESS = "inprogress" @@ -45,6 +46,7 @@ class Status(object): :ivar messaging_service_instance_sid: The SID of the Messaging service instance. :ivar chat_service_instance_sid: The SID of the chat service this user belongs to. :ivar flex_service_instance_sid: The SID of the Flex service instance. + :ivar flex_instance_sid: The SID of the Flex instance. :ivar ui_language: The primary language of the Flex UI. :ivar ui_attributes: The object that describes Flex UI characteristics and settings. :ivar ui_dependencies: The object that defines the NPM packages and versions to be used in Hosted Flex. @@ -75,6 +77,7 @@ 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]): @@ -98,10 +101,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[object]] = payload.get( + self.taskrouter_taskqueues: Optional[List[Dict[str, object]]] = payload.get( "taskrouter_taskqueues" ) - self.taskrouter_skills: Optional[List[object]] = payload.get( + self.taskrouter_skills: Optional[List[Dict[str, object]]] = payload.get( "taskrouter_skills" ) self.taskrouter_worker_channels: Optional[Dict[str, object]] = payload.get( @@ -123,6 +126,7 @@ def __init__(self, version: Version, payload: Dict[str, Any]): self.flex_service_instance_sid: Optional[str] = payload.get( "flex_service_instance_sid" ) + self.flex_instance_sid: Optional[str] = payload.get("flex_instance_sid") self.ui_language: Optional[str] = payload.get("ui_language") self.ui_attributes: Optional[Dict[str, object]] = payload.get("ui_attributes") self.ui_dependencies: Optional[Dict[str, object]] = payload.get( @@ -150,7 +154,9 @@ 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[object]] = payload.get("integrations") + self.integrations: Optional[List[Dict[str, object]]] = payload.get( + "integrations" + ) self.outbound_call_flows: Optional[Dict[str, object]] = payload.get( "outbound_call_flows" ) @@ -170,7 +176,9 @@ 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[object]] = payload.get("channel_configs") + self.channel_configs: Optional[List[Dict[str, object]]] = payload.get( + "channel_configs" + ) self.debugger_integration: Optional[Dict[str, object]] = payload.get( "debugger_integration" ) @@ -183,6 +191,7 @@ 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 @@ -239,6 +248,7 @@ def __repr__(self) -> str: class ConfigurationContext(InstanceContext): + def __init__(self, version: Version): """ Initialize the ConfigurationContext @@ -310,6 +320,7 @@ def __repr__(self) -> str: class ConfigurationList(ListResource): + def __init__(self, version: Version): """ Initialize the ConfigurationList diff --git a/twilio/rest/flex_api/v1/flex_flow.py b/twilio/rest/flex_api/v1/flex_flow.py index 15e327650..57c9a8f43 100644 --- a/twilio/rest/flex_api/v1/flex_flow.py +++ b/twilio/rest/flex_api/v1/flex_flow.py @@ -23,6 +23,7 @@ class FlexFlowInstance(InstanceResource): + class ChannelType(object): WEB = "web" SMS = "sms" @@ -278,6 +279,7 @@ def __repr__(self) -> str: class FlexFlowContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the FlexFlowContext @@ -516,6 +518,7 @@ def __repr__(self) -> str: class FlexFlowPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> FlexFlowInstance: """ Build an instance of FlexFlowInstance @@ -534,6 +537,7 @@ def __repr__(self) -> str: class FlexFlowList(ListResource): + def __init__(self, version: Version): """ Initialize the FlexFlowList @@ -590,6 +594,7 @@ def create( :returns: The created FlexFlowInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -665,6 +670,7 @@ 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 8ac4a527a..eed32fefb 100644 --- a/twilio/rest/flex_api/v1/insights_assessments_comment.py +++ b/twilio/rest/flex_api/v1/insights_assessments_comment.py @@ -64,6 +64,7 @@ def __repr__(self) -> str: class InsightsAssessmentsCommentPage(Page): + def get_instance( self, payload: Dict[str, Any] ) -> InsightsAssessmentsCommentInstance: @@ -84,6 +85,7 @@ def __repr__(self) -> str: class InsightsAssessmentsCommentList(ListResource): + def __init__(self, version: Version): """ Initialize the InsightsAssessmentsCommentList @@ -118,6 +120,7 @@ def create( :returns: The created InsightsAssessmentsCommentInstance """ + data = values.of( { "CategoryId": category_id, @@ -133,6 +136,7 @@ def create( "Authorization": authorization, } ) + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -162,6 +166,7 @@ async def create_async( :returns: The created InsightsAssessmentsCommentInstance """ + data = values.of( { "CategoryId": category_id, @@ -177,6 +182,7 @@ 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_conversational_ai.py b/twilio/rest/flex_api/v1/insights_conversational_ai.py new file mode 100644 index 000000000..0cce79ad9 --- /dev/null +++ b/twilio/rest/flex_api/v1/insights_conversational_ai.py @@ -0,0 +1,295 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Flex + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +from datetime import datetime +from typing import Any, Dict, List, Optional, Union +from twilio.base import deserialize, serialize, values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class InsightsConversationalAiInstance(InstanceResource): + + class Granularity(object): + DAYS = "days" + WEEKS = "weeks" + MONTHS = "months" + QUARTERS = "quarters" + YEARS = "years" + + """ + :ivar instance_sid: Sid of Flex Service Instance + :ivar report_id: The type of report required to fetch.Like gauge,channel-metrics,queue-metrics + :ivar granularity: + :ivar period_start: The start date from which report data is included + :ivar period_end: The end date till report data is included + :ivar updated: Updated time of the report + :ivar total_pages: Represents total number of pages fetched report has + :ivar page: Page offset required for pagination + :ivar rows: List of report breakdown + :ivar url: The URL of this resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + instance_sid: Optional[str] = None, + ): + super().__init__(version) + + self.instance_sid: Optional[str] = payload.get("instance_sid") + self.report_id: Optional[str] = payload.get("report_id") + self.granularity: Optional["InsightsConversationalAiInstance.Granularity"] = ( + payload.get("granularity") + ) + self.period_start: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("period_start") + ) + self.period_end: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("period_end") + ) + self.updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("updated") + ) + self.total_pages: Optional[int] = deserialize.integer( + payload.get("total_pages") + ) + self.page: Optional[int] = deserialize.integer(payload.get("page")) + self.rows: Optional[List[Dict[str, object]]] = payload.get("rows") + self.url: Optional[str] = payload.get("url") + + self._solution = { + "instance_sid": instance_sid or self.instance_sid, + } + self._context: Optional[InsightsConversationalAiContext] = None + + @property + def _proxy(self) -> "InsightsConversationalAiContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: InsightsConversationalAiContext for this InsightsConversationalAiInstance + """ + if self._context is None: + self._context = InsightsConversationalAiContext( + self._version, + instance_sid=self._solution["instance_sid"], + ) + return self._context + + def fetch( + self, + max_rows: Union[int, object] = values.unset, + report_id: Union[str, object] = values.unset, + granularity: Union[ + "InsightsConversationalAiInstance.Granularity", object + ] = values.unset, + include_date: Union[datetime, object] = values.unset, + ) -> "InsightsConversationalAiInstance": + """ + Fetch the InsightsConversationalAiInstance + + :param max_rows: Maximum number of rows to return + :param report_id: The type of report required to fetch.Like gauge,channel-metrics,queue-metrics + :param granularity: The time period for which report is needed + :param include_date: A reference date that should be included in the returned period + + :returns: The fetched InsightsConversationalAiInstance + """ + return self._proxy.fetch( + max_rows=max_rows, + report_id=report_id, + granularity=granularity, + include_date=include_date, + ) + + async def fetch_async( + self, + max_rows: Union[int, object] = values.unset, + report_id: Union[str, object] = values.unset, + granularity: Union[ + "InsightsConversationalAiInstance.Granularity", object + ] = values.unset, + include_date: Union[datetime, object] = values.unset, + ) -> "InsightsConversationalAiInstance": + """ + Asynchronous coroutine to fetch the InsightsConversationalAiInstance + + :param max_rows: Maximum number of rows to return + :param report_id: The type of report required to fetch.Like gauge,channel-metrics,queue-metrics + :param granularity: The time period for which report is needed + :param include_date: A reference date that should be included in the returned period + + :returns: The fetched InsightsConversationalAiInstance + """ + return await self._proxy.fetch_async( + max_rows=max_rows, + report_id=report_id, + granularity=granularity, + include_date=include_date, + ) + + 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 InsightsConversationalAiContext(InstanceContext): + + def __init__(self, version: Version, instance_sid: str): + """ + Initialize the InsightsConversationalAiContext + + :param version: Version that contains the resource + :param instance_sid: Sid of Flex Service Instance + """ + super().__init__(version) + + # Path Solution + self._solution = { + "instance_sid": instance_sid, + } + self._uri = "/Insights/Instances/{instance_sid}/AI/Reports".format( + **self._solution + ) + + def fetch( + self, + max_rows: Union[int, object] = values.unset, + report_id: Union[str, object] = values.unset, + granularity: Union[ + "InsightsConversationalAiInstance.Granularity", object + ] = values.unset, + include_date: Union[datetime, object] = values.unset, + ) -> InsightsConversationalAiInstance: + """ + Fetch the InsightsConversationalAiInstance + + :param max_rows: Maximum number of rows to return + :param report_id: The type of report required to fetch.Like gauge,channel-metrics,queue-metrics + :param granularity: The time period for which report is needed + :param include_date: A reference date that should be included in the returned period + + :returns: The fetched InsightsConversationalAiInstance + """ + + data = values.of( + { + "MaxRows": max_rows, + "ReportId": report_id, + "Granularity": granularity, + "IncludeDate": serialize.iso8601_datetime(include_date), + } + ) + + payload = self._version.fetch(method="GET", uri=self._uri, params=data) + + return InsightsConversationalAiInstance( + self._version, + payload, + instance_sid=self._solution["instance_sid"], + ) + + async def fetch_async( + self, + max_rows: Union[int, object] = values.unset, + report_id: Union[str, object] = values.unset, + granularity: Union[ + "InsightsConversationalAiInstance.Granularity", object + ] = values.unset, + include_date: Union[datetime, object] = values.unset, + ) -> InsightsConversationalAiInstance: + """ + Asynchronous coroutine to fetch the InsightsConversationalAiInstance + + :param max_rows: Maximum number of rows to return + :param report_id: The type of report required to fetch.Like gauge,channel-metrics,queue-metrics + :param granularity: The time period for which report is needed + :param include_date: A reference date that should be included in the returned period + + :returns: The fetched InsightsConversationalAiInstance + """ + + data = values.of( + { + "MaxRows": max_rows, + "ReportId": report_id, + "Granularity": granularity, + "IncludeDate": serialize.iso8601_datetime(include_date), + } + ) + + payload = await self._version.fetch_async( + method="GET", uri=self._uri, params=data + ) + + return InsightsConversationalAiInstance( + self._version, + payload, + instance_sid=self._solution["instance_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 InsightsConversationalAiList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the InsightsConversationalAiList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + def get(self, instance_sid: str) -> InsightsConversationalAiContext: + """ + Constructs a InsightsConversationalAiContext + + :param instance_sid: Sid of Flex Service Instance + """ + return InsightsConversationalAiContext(self._version, instance_sid=instance_sid) + + def __call__(self, instance_sid: str) -> InsightsConversationalAiContext: + """ + Constructs a InsightsConversationalAiContext + + :param instance_sid: Sid of Flex Service Instance + """ + return InsightsConversationalAiContext(self._version, instance_sid=instance_sid) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/flex_api/v1/insights_conversational_ai_report_insights.py b/twilio/rest/flex_api/v1/insights_conversational_ai_report_insights.py new file mode 100644 index 000000000..59ac5a04b --- /dev/null +++ b/twilio/rest/flex_api/v1/insights_conversational_ai_report_insights.py @@ -0,0 +1,279 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Flex + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +from datetime import datetime +from typing import Any, Dict, List, Optional, Union +from twilio.base import deserialize, serialize, values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class InsightsConversationalAiReportInsightsInstance(InstanceResource): + """ + :ivar instance_sid: The Instance SID of the instance for which report insights is fetched + :ivar report_id: The type of report insights required to fetch.Like gauge,channel-metrics,queue-metrics + :ivar period_start: The start date from which report insights data is included + :ivar period_end: The end date till report insights data is included + :ivar updated: Updated time of the report insights + :ivar insights: List of report insights breakdown + :ivar url: The URL of this resource + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + instance_sid: Optional[str] = None, + ): + super().__init__(version) + + self.instance_sid: Optional[str] = payload.get("instance_sid") + self.report_id: Optional[str] = payload.get("report_id") + self.period_start: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("period_start") + ) + self.period_end: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("period_end") + ) + self.updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("updated") + ) + self.insights: Optional[List[Dict[str, object]]] = payload.get("insights") + self.url: Optional[str] = payload.get("url") + + self._solution = { + "instance_sid": instance_sid or self.instance_sid, + } + self._context: Optional[InsightsConversationalAiReportInsightsContext] = None + + @property + def _proxy(self) -> "InsightsConversationalAiReportInsightsContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: InsightsConversationalAiReportInsightsContext for this InsightsConversationalAiReportInsightsInstance + """ + if self._context is None: + self._context = InsightsConversationalAiReportInsightsContext( + self._version, + instance_sid=self._solution["instance_sid"], + ) + return self._context + + def fetch( + self, + max_rows: Union[int, object] = values.unset, + report_id: Union[str, object] = values.unset, + granularity: Union[str, object] = values.unset, + include_date: Union[datetime, object] = values.unset, + ) -> "InsightsConversationalAiReportInsightsInstance": + """ + Fetch the InsightsConversationalAiReportInsightsInstance + + :param max_rows: Maximum number of rows to return + :param report_id: The type of report insights required to fetch.Like gauge,channel-metrics,queue-metrics + :param granularity: The time period for which report insights is needed + :param include_date: A reference date that should be included in the returned period + + :returns: The fetched InsightsConversationalAiReportInsightsInstance + """ + return self._proxy.fetch( + max_rows=max_rows, + report_id=report_id, + granularity=granularity, + include_date=include_date, + ) + + async def fetch_async( + self, + max_rows: Union[int, object] = values.unset, + report_id: Union[str, object] = values.unset, + granularity: Union[str, object] = values.unset, + include_date: Union[datetime, object] = values.unset, + ) -> "InsightsConversationalAiReportInsightsInstance": + """ + Asynchronous coroutine to fetch the InsightsConversationalAiReportInsightsInstance + + :param max_rows: Maximum number of rows to return + :param report_id: The type of report insights required to fetch.Like gauge,channel-metrics,queue-metrics + :param granularity: The time period for which report insights is needed + :param include_date: A reference date that should be included in the returned period + + :returns: The fetched InsightsConversationalAiReportInsightsInstance + """ + return await self._proxy.fetch_async( + max_rows=max_rows, + report_id=report_id, + granularity=granularity, + include_date=include_date, + ) + + 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 InsightsConversationalAiReportInsightsContext(InstanceContext): + + def __init__(self, version: Version, instance_sid: str): + """ + Initialize the InsightsConversationalAiReportInsightsContext + + :param version: Version that contains the resource + :param instance_sid: The Instance SID of the instance for which report insights will be fetched + """ + super().__init__(version) + + # Path Solution + self._solution = { + "instance_sid": instance_sid, + } + self._uri = "/Insights/Instances/{instance_sid}/AI/ReportInsights".format( + **self._solution + ) + + def fetch( + self, + max_rows: Union[int, object] = values.unset, + report_id: Union[str, object] = values.unset, + granularity: Union[str, object] = values.unset, + include_date: Union[datetime, object] = values.unset, + ) -> InsightsConversationalAiReportInsightsInstance: + """ + Fetch the InsightsConversationalAiReportInsightsInstance + + :param max_rows: Maximum number of rows to return + :param report_id: The type of report insights required to fetch.Like gauge,channel-metrics,queue-metrics + :param granularity: The time period for which report insights is needed + :param include_date: A reference date that should be included in the returned period + + :returns: The fetched InsightsConversationalAiReportInsightsInstance + """ + + data = values.of( + { + "MaxRows": max_rows, + "ReportId": report_id, + "Granularity": granularity, + "IncludeDate": serialize.iso8601_datetime(include_date), + } + ) + + payload = self._version.fetch(method="GET", uri=self._uri, params=data) + + return InsightsConversationalAiReportInsightsInstance( + self._version, + payload, + instance_sid=self._solution["instance_sid"], + ) + + async def fetch_async( + self, + max_rows: Union[int, object] = values.unset, + report_id: Union[str, object] = values.unset, + granularity: Union[str, object] = values.unset, + include_date: Union[datetime, object] = values.unset, + ) -> InsightsConversationalAiReportInsightsInstance: + """ + Asynchronous coroutine to fetch the InsightsConversationalAiReportInsightsInstance + + :param max_rows: Maximum number of rows to return + :param report_id: The type of report insights required to fetch.Like gauge,channel-metrics,queue-metrics + :param granularity: The time period for which report insights is needed + :param include_date: A reference date that should be included in the returned period + + :returns: The fetched InsightsConversationalAiReportInsightsInstance + """ + + data = values.of( + { + "MaxRows": max_rows, + "ReportId": report_id, + "Granularity": granularity, + "IncludeDate": serialize.iso8601_datetime(include_date), + } + ) + + payload = await self._version.fetch_async( + method="GET", uri=self._uri, params=data + ) + + return InsightsConversationalAiReportInsightsInstance( + self._version, + payload, + instance_sid=self._solution["instance_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 InsightsConversationalAiReportInsightsList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the InsightsConversationalAiReportInsightsList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + def get(self, instance_sid: str) -> InsightsConversationalAiReportInsightsContext: + """ + Constructs a InsightsConversationalAiReportInsightsContext + + :param instance_sid: The Instance SID of the instance for which report insights will be fetched + """ + return InsightsConversationalAiReportInsightsContext( + self._version, instance_sid=instance_sid + ) + + def __call__( + self, instance_sid: str + ) -> InsightsConversationalAiReportInsightsContext: + """ + Constructs a InsightsConversationalAiReportInsightsContext + + :param instance_sid: The Instance SID of the instance for which report insights will be fetched + """ + return InsightsConversationalAiReportInsightsContext( + self._version, instance_sid=instance_sid + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/flex_api/v1/insights_conversations.py b/twilio/rest/flex_api/v1/insights_conversations.py index 54b33ad8e..d08608c7e 100644 --- a/twilio/rest/flex_api/v1/insights_conversations.py +++ b/twilio/rest/flex_api/v1/insights_conversations.py @@ -37,7 +37,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[object]] = payload.get("segments") + self.segments: Optional[List[Dict[str, object]]] = payload.get("segments") def __repr__(self) -> str: """ @@ -50,6 +50,7 @@ def __repr__(self) -> str: class InsightsConversationsPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> InsightsConversationsInstance: """ Build an instance of InsightsConversationsInstance @@ -68,6 +69,7 @@ def __repr__(self) -> str: class InsightsConversationsList(ListResource): + def __init__(self, version: Version): """ Initialize the InsightsConversationsList diff --git a/twilio/rest/flex_api/v1/insights_questionnaires.py b/twilio/rest/flex_api/v1/insights_questionnaires.py index f4bb0fad0..fe0338a9f 100644 --- a/twilio/rest/flex_api/v1/insights_questionnaires.py +++ b/twilio/rest/flex_api/v1/insights_questionnaires.py @@ -45,7 +45,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[object]] = payload.get("questions") + self.questions: Optional[List[Dict[str, object]]] = payload.get("questions") self.url: Optional[str] = payload.get("url") self._solution = { @@ -187,6 +187,7 @@ def __repr__(self) -> str: class InsightsQuestionnairesContext(InstanceContext): + def __init__(self, version: Version, questionnaire_sid: str): """ Initialize the InsightsQuestionnairesContext @@ -391,6 +392,7 @@ def __repr__(self) -> str: class InsightsQuestionnairesPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> InsightsQuestionnairesInstance: """ Build an instance of InsightsQuestionnairesInstance @@ -409,6 +411,7 @@ def __repr__(self) -> str: class InsightsQuestionnairesList(ListResource): + def __init__(self, version: Version): """ Initialize the InsightsQuestionnairesList @@ -439,6 +442,7 @@ def create( :returns: The created InsightsQuestionnairesInstance """ + data = values.of( { "Name": name, @@ -452,6 +456,7 @@ def create( "Authorization": authorization, } ) + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -477,6 +482,7 @@ async def create_async( :returns: The created InsightsQuestionnairesInstance """ + data = values.of( { "Name": name, @@ -490,6 +496,7 @@ 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 3f95d9656..28057dbc0 100644 --- a/twilio/rest/flex_api/v1/insights_questionnaires_category.py +++ b/twilio/rest/flex_api/v1/insights_questionnaires_category.py @@ -133,6 +133,7 @@ def __repr__(self) -> str: class InsightsQuestionnairesCategoryContext(InstanceContext): + def __init__(self, version: Version, category_sid: str): """ Initialize the InsightsQuestionnairesCategoryContext @@ -259,6 +260,7 @@ def __repr__(self) -> str: class InsightsQuestionnairesCategoryPage(Page): + def get_instance( self, payload: Dict[str, Any] ) -> InsightsQuestionnairesCategoryInstance: @@ -279,6 +281,7 @@ def __repr__(self) -> str: class InsightsQuestionnairesCategoryList(ListResource): + def __init__(self, version: Version): """ Initialize the InsightsQuestionnairesCategoryList @@ -301,6 +304,7 @@ def create( :returns: The created InsightsQuestionnairesCategoryInstance """ + data = values.of( { "Name": name, @@ -311,6 +315,7 @@ def create( "Authorization": authorization, } ) + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -328,6 +333,7 @@ async def create_async( :returns: The created InsightsQuestionnairesCategoryInstance """ + data = values.of( { "Name": name, @@ -338,6 +344,7 @@ 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 e68e04e2a..b796ff6af 100644 --- a/twilio/rest/flex_api/v1/insights_questionnaires_question.py +++ b/twilio/rest/flex_api/v1/insights_questionnaires_question.py @@ -173,6 +173,7 @@ def __repr__(self) -> str: class InsightsQuestionnairesQuestionContext(InstanceContext): + def __init__(self, version: Version, question_sid: str): """ Initialize the InsightsQuestionnairesQuestionContext @@ -327,6 +328,7 @@ def __repr__(self) -> str: class InsightsQuestionnairesQuestionPage(Page): + def get_instance( self, payload: Dict[str, Any] ) -> InsightsQuestionnairesQuestionInstance: @@ -347,6 +349,7 @@ def __repr__(self) -> str: class InsightsQuestionnairesQuestionList(ListResource): + def __init__(self, version: Version): """ Initialize the InsightsQuestionnairesQuestionList @@ -379,6 +382,7 @@ def create( :returns: The created InsightsQuestionnairesQuestionInstance """ + data = values.of( { "CategorySid": category_sid, @@ -393,6 +397,7 @@ def create( "Authorization": authorization, } ) + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -420,6 +425,7 @@ async def create_async( :returns: The created InsightsQuestionnairesQuestionInstance """ + data = values.of( { "CategorySid": category_sid, @@ -434,6 +440,7 @@ 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_segments.py b/twilio/rest/flex_api/v1/insights_segments.py index a0d12d4bf..2d509802a 100644 --- a/twilio/rest/flex_api/v1/insights_segments.py +++ b/twilio/rest/flex_api/v1/insights_segments.py @@ -94,6 +94,7 @@ def __repr__(self) -> str: class InsightsSegmentsPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> InsightsSegmentsInstance: """ Build an instance of InsightsSegmentsInstance @@ -112,6 +113,7 @@ def __repr__(self) -> str: class InsightsSegmentsList(ListResource): + def __init__(self, version: Version): """ Initialize the InsightsSegmentsList diff --git a/twilio/rest/flex_api/v1/insights_session.py b/twilio/rest/flex_api/v1/insights_session.py index 32fa5c81e..b4174aa94 100644 --- a/twilio/rest/flex_api/v1/insights_session.py +++ b/twilio/rest/flex_api/v1/insights_session.py @@ -93,6 +93,7 @@ def __repr__(self) -> str: class InsightsSessionContext(InstanceContext): + def __init__(self, version: Version): """ Initialize the InsightsSessionContext @@ -156,6 +157,7 @@ def __repr__(self) -> str: class InsightsSessionList(ListResource): + def __init__(self, version: Version): """ Initialize the InsightsSessionList 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 a8be81c91..767737da6 100644 --- a/twilio/rest/flex_api/v1/insights_settings_answer_sets.py +++ b/twilio/rest/flex_api/v1/insights_settings_answer_sets.py @@ -12,7 +12,8 @@ Do not edit the class manually. """ -from typing import Any, Dict, Optional +from typing import Any, Dict, Optional, Union +from twilio.base import values from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -50,6 +51,7 @@ def __repr__(self) -> str: class InsightsSettingsAnswerSetsList(ListResource): + def __init__(self, version: Version): """ Initialize the InsightsSettingsAnswerSetsList @@ -61,23 +63,43 @@ def __init__(self, version: Version): self._uri = "/Insights/QualityManagement/Settings/AnswerSets" - def fetch(self) -> InsightsSettingsAnswerSetsInstance: + def fetch( + self, authorization: Union[str, object] = values.unset + ) -> InsightsSettingsAnswerSetsInstance: """ Asynchronously fetch the InsightsSettingsAnswerSetsInstance + :param authorization: The Authorization HTTP request header :returns: The fetched InsightsSettingsAnswerSetsInstance """ - payload = self._version.fetch(method="GET", uri=self._uri) + headers = values.of( + { + "Authorization": authorization, + } + ) + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return InsightsSettingsAnswerSetsInstance(self._version, payload) - async def fetch_async(self) -> InsightsSettingsAnswerSetsInstance: + async def fetch_async( + self, authorization: Union[str, object] = values.unset + ) -> InsightsSettingsAnswerSetsInstance: """ Asynchronously fetch the InsightsSettingsAnswerSetsInstance + :param authorization: The Authorization HTTP request header :returns: The fetched InsightsSettingsAnswerSetsInstance """ - payload = await self._version.fetch_async(method="GET", uri=self._uri) + headers = values.of( + { + "Authorization": authorization, + } + ) + + payload = await self._version.fetch_async( + method="GET", uri=self._uri, headers=headers + ) 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 1d4c2f19a..5d41e8d3b 100644 --- a/twilio/rest/flex_api/v1/insights_settings_comment.py +++ b/twilio/rest/flex_api/v1/insights_settings_comment.py @@ -12,7 +12,8 @@ Do not edit the class manually. """ -from typing import Any, Dict, Optional +from typing import Any, Dict, Optional, Union +from twilio.base import values from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -44,6 +45,7 @@ def __repr__(self) -> str: class InsightsSettingsCommentList(ListResource): + def __init__(self, version: Version): """ Initialize the InsightsSettingsCommentList @@ -55,23 +57,43 @@ def __init__(self, version: Version): self._uri = "/Insights/QualityManagement/Settings/CommentTags" - def fetch(self) -> InsightsSettingsCommentInstance: + def fetch( + self, authorization: Union[str, object] = values.unset + ) -> InsightsSettingsCommentInstance: """ Asynchronously fetch the InsightsSettingsCommentInstance + :param authorization: The Authorization HTTP request header :returns: The fetched InsightsSettingsCommentInstance """ - payload = self._version.fetch(method="GET", uri=self._uri) + headers = values.of( + { + "Authorization": authorization, + } + ) + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) return InsightsSettingsCommentInstance(self._version, payload) - async def fetch_async(self) -> InsightsSettingsCommentInstance: + async def fetch_async( + self, authorization: Union[str, object] = values.unset + ) -> InsightsSettingsCommentInstance: """ Asynchronously fetch the InsightsSettingsCommentInstance + :param authorization: The Authorization HTTP request header :returns: The fetched InsightsSettingsCommentInstance """ - payload = await self._version.fetch_async(method="GET", uri=self._uri) + headers = values.of( + { + "Authorization": authorization, + } + ) + + payload = await self._version.fetch_async( + method="GET", uri=self._uri, headers=headers + ) return InsightsSettingsCommentInstance(self._version, payload) diff --git a/twilio/rest/flex_api/v1/insights_user_roles.py b/twilio/rest/flex_api/v1/insights_user_roles.py index 705c0e97d..9dbea5fa3 100644 --- a/twilio/rest/flex_api/v1/insights_user_roles.py +++ b/twilio/rest/flex_api/v1/insights_user_roles.py @@ -87,6 +87,7 @@ def __repr__(self) -> str: class InsightsUserRolesContext(InstanceContext): + def __init__(self, version: Version): """ Initialize the InsightsUserRolesContext @@ -158,6 +159,7 @@ def __repr__(self) -> str: class InsightsUserRolesList(ListResource): + def __init__(self, version: Version): """ Initialize the InsightsUserRolesList diff --git a/twilio/rest/flex_api/v1/interaction/__init__.py b/twilio/rest/flex_api/v1/interaction/__init__.py index 90a48bc06..992cc9b01 100644 --- a/twilio/rest/flex_api/v1/interaction/__init__.py +++ b/twilio/rest/flex_api/v1/interaction/__init__.py @@ -104,6 +104,7 @@ def __repr__(self) -> str: class InteractionContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the InteractionContext @@ -182,6 +183,7 @@ def __repr__(self) -> str: class InteractionList(ListResource): + def __init__(self, version: Version): """ Initialize the InteractionList @@ -208,6 +210,7 @@ def create( :returns: The created InteractionInstance """ + data = values.of( { "Channel": serialize.object(channel), @@ -239,6 +242,7 @@ 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/__init__.py b/twilio/rest/flex_api/v1/interaction/interaction_channel/__init__.py index 791ad4d67..a26dc0425 100644 --- a/twilio/rest/flex_api/v1/interaction/interaction_channel/__init__.py +++ b/twilio/rest/flex_api/v1/interaction/interaction_channel/__init__.py @@ -28,6 +28,7 @@ class InteractionChannelInstance(InstanceResource): + class ChannelStatus(object): SETUP = "setup" ACTIVE = "active" @@ -181,6 +182,7 @@ def __repr__(self) -> str: class InteractionChannelContext(InstanceContext): + def __init__(self, version: Version, interaction_sid: str, sid: str): """ Initialize the InteractionChannelContext @@ -346,6 +348,7 @@ def __repr__(self) -> str: class InteractionChannelPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> InteractionChannelInstance: """ Build an instance of InteractionChannelInstance @@ -366,6 +369,7 @@ def __repr__(self) -> str: class InteractionChannelList(ListResource): + def __init__(self, version: Version, interaction_sid: str): """ Initialize the InteractionChannelList 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 9c97a85ce..5292297b9 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 @@ -61,6 +61,7 @@ def __repr__(self) -> str: class InteractionChannelInvitePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> InteractionChannelInviteInstance: """ Build an instance of InteractionChannelInviteInstance @@ -84,6 +85,7 @@ def __repr__(self) -> str: class InteractionChannelInviteList(ListResource): + def __init__(self, version: Version, interaction_sid: str, channel_sid: str): """ Initialize the InteractionChannelInviteList @@ -114,6 +116,7 @@ def create(self, routing: object) -> InteractionChannelInviteInstance: :returns: The created InteractionChannelInviteInstance """ + data = values.of( { "Routing": serialize.object(routing), @@ -141,6 +144,7 @@ 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 d76a2275a..649439ba2 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 @@ -22,6 +22,7 @@ class InteractionChannelParticipantInstance(InstanceResource): + class Status(object): CLOSED = "closed" WRAPUP = "wrapup" @@ -124,6 +125,7 @@ def __repr__(self) -> str: class InteractionChannelParticipantContext(InstanceContext): + def __init__( self, version: Version, interaction_sid: str, channel_sid: str, sid: str ): @@ -220,6 +222,7 @@ def __repr__(self) -> str: class InteractionChannelParticipantPage(Page): + def get_instance( self, payload: Dict[str, Any] ) -> InteractionChannelParticipantInstance: @@ -245,6 +248,7 @@ def __repr__(self) -> str: class InteractionChannelParticipantList(ListResource): + def __init__(self, version: Version, interaction_sid: str, channel_sid: str): """ Initialize the InteractionChannelParticipantList @@ -278,6 +282,7 @@ def create( :returns: The created InteractionChannelParticipantInstance """ + data = values.of( { "Type": type, @@ -311,6 +316,7 @@ async def create_async( :returns: The created InteractionChannelParticipantInstance """ + data = values.of( { "Type": type, diff --git a/twilio/rest/oauth/v1/user_info.py b/twilio/rest/flex_api/v1/provisioning_status.py similarity index 54% rename from twilio/rest/oauth/v1/user_info.py rename to twilio/rest/flex_api/v1/provisioning_status.py index e59ab8b0c..9cc9144dc 100644 --- a/twilio/rest/oauth/v1/user_info.py +++ b/twilio/rest/flex_api/v1/provisioning_status.py @@ -4,7 +4,7 @@ | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - Twilio - Oauth + Twilio - Flex This is the public Twilio REST API. NOTE: This class is auto generated by OpenAPI Generator. @@ -19,57 +19,58 @@ from twilio.base.version import Version -class UserInfoInstance(InstanceResource): +class ProvisioningStatusInstance(InstanceResource): + + class Status(object): + ACTIVE = "active" + IN_PROGRESS = "in-progress" + NOT_CONFIGURED = "not-configured" + FAILED = "failed" + """ - :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: + :ivar status: + :ivar url: The absolute URL of the resource. """ def __init__(self, version: Version, payload: Dict[str, Any]): super().__init__(version) - 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.status: Optional["ProvisioningStatusInstance.Status"] = payload.get( + "status" + ) self.url: Optional[str] = payload.get("url") - self._context: Optional[UserInfoContext] = None + self._context: Optional[ProvisioningStatusContext] = None @property - def _proxy(self) -> "UserInfoContext": + def _proxy(self) -> "ProvisioningStatusContext": """ Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context - :returns: UserInfoContext for this UserInfoInstance + :returns: ProvisioningStatusContext for this ProvisioningStatusInstance """ if self._context is None: - self._context = UserInfoContext( + self._context = ProvisioningStatusContext( self._version, ) return self._context - def fetch(self) -> "UserInfoInstance": + def fetch(self) -> "ProvisioningStatusInstance": """ - Fetch the UserInfoInstance + Fetch the ProvisioningStatusInstance - :returns: The fetched UserInfoInstance + :returns: The fetched ProvisioningStatusInstance """ return self._proxy.fetch() - async def fetch_async(self) -> "UserInfoInstance": + async def fetch_async(self) -> "ProvisioningStatusInstance": """ - Asynchronous coroutine to fetch the UserInfoInstance + Asynchronous coroutine to fetch the ProvisioningStatusInstance - :returns: The fetched UserInfoInstance + :returns: The fetched ProvisioningStatusInstance """ return await self._proxy.fetch_async() @@ -80,26 +81,27 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" -class UserInfoContext(InstanceContext): +class ProvisioningStatusContext(InstanceContext): + def __init__(self, version: Version): """ - Initialize the UserInfoContext + Initialize the ProvisioningStatusContext :param version: Version that contains the resource """ super().__init__(version) - self._uri = "/userinfo" + self._uri = "/account/provision/status" - def fetch(self) -> UserInfoInstance: + def fetch(self) -> ProvisioningStatusInstance: """ - Fetch the UserInfoInstance + Fetch the ProvisioningStatusInstance - :returns: The fetched UserInfoInstance + :returns: The fetched ProvisioningStatusInstance """ payload = self._version.fetch( @@ -107,17 +109,17 @@ def fetch(self) -> UserInfoInstance: uri=self._uri, ) - return UserInfoInstance( + return ProvisioningStatusInstance( self._version, payload, ) - async def fetch_async(self) -> UserInfoInstance: + async def fetch_async(self) -> ProvisioningStatusInstance: """ - Asynchronous coroutine to fetch the UserInfoInstance + Asynchronous coroutine to fetch the ProvisioningStatusInstance - :returns: The fetched UserInfoInstance + :returns: The fetched ProvisioningStatusInstance """ payload = await self._version.fetch_async( @@ -125,7 +127,7 @@ async def fetch_async(self) -> UserInfoInstance: uri=self._uri, ) - return UserInfoInstance( + return ProvisioningStatusInstance( self._version, payload, ) @@ -137,32 +139,33 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" + +class ProvisioningStatusList(ListResource): -class UserInfoList(ListResource): def __init__(self, version: Version): """ - Initialize the UserInfoList + Initialize the ProvisioningStatusList :param version: Version that contains the resource """ super().__init__(version) - def get(self) -> UserInfoContext: + def get(self) -> ProvisioningStatusContext: """ - Constructs a UserInfoContext + Constructs a ProvisioningStatusContext """ - return UserInfoContext(self._version) + return ProvisioningStatusContext(self._version) - def __call__(self) -> UserInfoContext: + def __call__(self) -> ProvisioningStatusContext: """ - Constructs a UserInfoContext + Constructs a ProvisioningStatusContext """ - return UserInfoContext(self._version) + return ProvisioningStatusContext(self._version) def __repr__(self) -> str: """ @@ -170,4 +173,4 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" diff --git a/twilio/rest/flex_api/v1/web_channel.py b/twilio/rest/flex_api/v1/web_channel.py index 0ff675533..ddf9c8f90 100644 --- a/twilio/rest/flex_api/v1/web_channel.py +++ b/twilio/rest/flex_api/v1/web_channel.py @@ -23,6 +23,7 @@ class WebChannelInstance(InstanceResource): + class ChatStatus(object): INACTIVE = "inactive" @@ -154,6 +155,7 @@ def __repr__(self) -> str: class WebChannelContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the WebChannelContext @@ -298,6 +300,7 @@ def __repr__(self) -> str: class WebChannelPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> WebChannelInstance: """ Build an instance of WebChannelInstance @@ -316,6 +319,7 @@ def __repr__(self) -> str: class WebChannelList(ListResource): + def __init__(self, version: Version): """ Initialize the WebChannelList @@ -348,6 +352,7 @@ def create( :returns: The created WebChannelInstance """ + data = values.of( { "FlexFlowSid": flex_flow_sid, @@ -388,6 +393,7 @@ async def create_async( :returns: The created WebChannelInstance """ + data = values.of( { "FlexFlowSid": flex_flow_sid, diff --git a/twilio/rest/flex_api/v2/__init__.py b/twilio/rest/flex_api/v2/__init__.py index e48012241..021615e19 100644 --- a/twilio/rest/flex_api/v2/__init__.py +++ b/twilio/rest/flex_api/v2/__init__.py @@ -19,6 +19,7 @@ class V2(Version): + def __init__(self, domain: Domain): """ Initialize the V2 version of FlexApi diff --git a/twilio/rest/flex_api/v2/web_channels.py b/twilio/rest/flex_api/v2/web_channels.py index d4c2e3396..13e5b28d7 100644 --- a/twilio/rest/flex_api/v2/web_channels.py +++ b/twilio/rest/flex_api/v2/web_channels.py @@ -43,6 +43,7 @@ def __repr__(self) -> str: class WebChannelsList(ListResource): + def __init__(self, version: Version): """ Initialize the WebChannelsList @@ -71,6 +72,7 @@ def create( :returns: The created WebChannelsInstance """ + data = values.of( { "AddressSid": address_sid, @@ -105,6 +107,7 @@ async def create_async( :returns: The created WebChannelsInstance """ + data = values.of( { "AddressSid": address_sid, diff --git a/twilio/rest/frontline_api/FrontlineApiBase.py b/twilio/rest/frontline_api/FrontlineApiBase.py index 302854dc0..d9dadc16e 100644 --- a/twilio/rest/frontline_api/FrontlineApiBase.py +++ b/twilio/rest/frontline_api/FrontlineApiBase.py @@ -17,6 +17,7 @@ class FrontlineApiBase(Domain): + def __init__(self, twilio: Client): """ Initialize the FrontlineApi Domain diff --git a/twilio/rest/frontline_api/v1/__init__.py b/twilio/rest/frontline_api/v1/__init__.py index d2629dd5a..610ed3719 100644 --- a/twilio/rest/frontline_api/v1/__init__.py +++ b/twilio/rest/frontline_api/v1/__init__.py @@ -19,6 +19,7 @@ class V1(Version): + def __init__(self, domain: Domain): """ Initialize the V1 version of FrontlineApi diff --git a/twilio/rest/frontline_api/v1/user.py b/twilio/rest/frontline_api/v1/user.py index 7c032ac5e..b14fbd098 100644 --- a/twilio/rest/frontline_api/v1/user.py +++ b/twilio/rest/frontline_api/v1/user.py @@ -21,6 +21,7 @@ class UserInstance(InstanceResource): + class StateType(object): ACTIVE = "active" DEACTIVATED = "deactivated" @@ -145,6 +146,7 @@ def __repr__(self) -> str: class UserContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the UserContext @@ -277,6 +279,7 @@ def __repr__(self) -> str: class UserList(ListResource): + def __init__(self, version: Version): """ Initialize the UserList diff --git a/twilio/rest/insights/InsightsBase.py b/twilio/rest/insights/InsightsBase.py index efe713ba0..458122cec 100644 --- a/twilio/rest/insights/InsightsBase.py +++ b/twilio/rest/insights/InsightsBase.py @@ -17,6 +17,7 @@ class InsightsBase(Domain): + def __init__(self, twilio: Client): """ Initialize the Insights Domain diff --git a/twilio/rest/insights/v1/__init__.py b/twilio/rest/insights/v1/__init__.py index b5b6c4486..8f7d1946f 100644 --- a/twilio/rest/insights/v1/__init__.py +++ b/twilio/rest/insights/v1/__init__.py @@ -23,6 +23,7 @@ class V1(Version): + def __init__(self, domain: Domain): """ Initialize the V1 version of Insights diff --git a/twilio/rest/insights/v1/call/__init__.py b/twilio/rest/insights/v1/call/__init__.py index 824793a6a..ff628b7d0 100644 --- a/twilio/rest/insights/v1/call/__init__.py +++ b/twilio/rest/insights/v1/call/__init__.py @@ -117,6 +117,7 @@ def __repr__(self) -> str: class CallContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the CallContext @@ -234,6 +235,7 @@ def __repr__(self) -> str: class CallList(ListResource): + def __init__(self, version: Version): """ Initialize the CallList diff --git a/twilio/rest/insights/v1/call/annotation.py b/twilio/rest/insights/v1/call/annotation.py index ddf1f829f..0d3f7bb4f 100644 --- a/twilio/rest/insights/v1/call/annotation.py +++ b/twilio/rest/insights/v1/call/annotation.py @@ -21,6 +21,7 @@ class AnnotationInstance(InstanceResource): + class AnsweredBy(object): UNKNOWN_ANSWERED_BY = "unknown_answered_by" HUMAN = "human" @@ -44,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: The URL of this resource. + :ivar url: """ def __init__(self, version: Version, payload: Dict[str, Any], call_sid: str): @@ -184,6 +185,7 @@ def __repr__(self) -> str: class AnnotationContext(InstanceContext): + def __init__(self, version: Version, call_sid: str): """ Initialize the AnnotationContext @@ -342,6 +344,7 @@ def __repr__(self) -> str: class AnnotationList(ListResource): + def __init__(self, version: Version, call_sid: str): """ Initialize the AnnotationList diff --git a/twilio/rest/insights/v1/call/call_summary.py b/twilio/rest/insights/v1/call/call_summary.py index ce52583a1..0e256b36c 100644 --- a/twilio/rest/insights/v1/call/call_summary.py +++ b/twilio/rest/insights/v1/call/call_summary.py @@ -22,6 +22,7 @@ class CallSummaryInstance(InstanceResource): + class AnsweredBy(object): UNKNOWN = "unknown" MACHINE_START = "machine_start" @@ -185,6 +186,7 @@ def __repr__(self) -> str: class CallSummaryContext(InstanceContext): + def __init__(self, version: Version, call_sid: str): """ Initialize the CallSummaryContext @@ -269,6 +271,7 @@ def __repr__(self) -> str: class CallSummaryList(ListResource): + def __init__(self, version: Version, call_sid: str): """ Initialize the CallSummaryList diff --git a/twilio/rest/insights/v1/call/event.py b/twilio/rest/insights/v1/call/event.py index fa118a726..89734f110 100644 --- a/twilio/rest/insights/v1/call/event.py +++ b/twilio/rest/insights/v1/call/event.py @@ -22,6 +22,7 @@ class EventInstance(InstanceResource): + class Level(object): UNKNOWN = "UNKNOWN" DEBUG = "DEBUG" @@ -80,6 +81,7 @@ def __repr__(self) -> str: class EventPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> EventInstance: """ Build an instance of EventInstance @@ -100,6 +102,7 @@ def __repr__(self) -> str: class EventList(ListResource): + def __init__(self, version: Version, call_sid: str): """ Initialize the EventList diff --git a/twilio/rest/insights/v1/call/metric.py b/twilio/rest/insights/v1/call/metric.py index 586952773..3cf9decc5 100644 --- a/twilio/rest/insights/v1/call/metric.py +++ b/twilio/rest/insights/v1/call/metric.py @@ -22,6 +22,7 @@ class MetricInstance(InstanceResource): + class StreamDirection(object): UNKNOWN = "unknown" INBOUND = "inbound" @@ -77,6 +78,7 @@ def __repr__(self) -> str: class MetricPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> MetricInstance: """ Build an instance of MetricInstance @@ -97,6 +99,7 @@ def __repr__(self) -> str: class MetricList(ListResource): + def __init__(self, version: Version, call_sid: str): """ Initialize the MetricList diff --git a/twilio/rest/insights/v1/call_summaries.py b/twilio/rest/insights/v1/call_summaries.py index e7c27ea73..78cd5b506 100644 --- a/twilio/rest/insights/v1/call_summaries.py +++ b/twilio/rest/insights/v1/call_summaries.py @@ -23,6 +23,7 @@ class CallSummariesInstance(InstanceResource): + class AnsweredBy(object): UNKNOWN = "unknown" MACHINE_START = "machine_start" @@ -142,6 +143,7 @@ def __repr__(self) -> str: class CallSummariesPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> CallSummariesInstance: """ Build an instance of CallSummariesInstance @@ -160,6 +162,7 @@ def __repr__(self) -> str: class CallSummariesList(ListResource): + def __init__(self, version: Version): """ Initialize the CallSummariesList diff --git a/twilio/rest/insights/v1/conference/__init__.py b/twilio/rest/insights/v1/conference/__init__.py index cd3203aa1..1ee8c09dc 100644 --- a/twilio/rest/insights/v1/conference/__init__.py +++ b/twilio/rest/insights/v1/conference/__init__.py @@ -26,6 +26,7 @@ class ConferenceInstance(InstanceResource): + class ConferenceEndReason(object): LAST_PARTICIPANT_LEFT = "last_participant_left" CONFERENCE_ENDED_VIA_API = "conference_ended_via_api" @@ -212,6 +213,7 @@ def __repr__(self) -> str: class ConferenceContext(InstanceContext): + def __init__(self, version: Version, conference_sid: str): """ Initialize the ConferenceContext @@ -290,6 +292,7 @@ def __repr__(self) -> str: class ConferencePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ConferenceInstance: """ Build an instance of ConferenceInstance @@ -308,6 +311,7 @@ def __repr__(self) -> str: class ConferenceList(ListResource): + def __init__(self, version: Version): """ Initialize the ConferenceList diff --git a/twilio/rest/insights/v1/conference/conference_participant.py b/twilio/rest/insights/v1/conference/conference_participant.py index 6489c50ed..68faa690b 100644 --- a/twilio/rest/insights/v1/conference/conference_participant.py +++ b/twilio/rest/insights/v1/conference/conference_participant.py @@ -23,6 +23,7 @@ class ConferenceParticipantInstance(InstanceResource): + class CallDirection(object): INBOUND = "inbound" OUTBOUND = "outbound" @@ -224,6 +225,7 @@ def __repr__(self) -> str: class ConferenceParticipantContext(InstanceContext): + def __init__(self, version: Version, conference_sid: str, participant_sid: str): """ Initialize the ConferenceParticipantContext @@ -318,6 +320,7 @@ def __repr__(self) -> str: class ConferenceParticipantPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ConferenceParticipantInstance: """ Build an instance of ConferenceParticipantInstance @@ -338,6 +341,7 @@ def __repr__(self) -> str: class ConferenceParticipantList(ListResource): + def __init__(self, version: Version, conference_sid: str): """ Initialize the ConferenceParticipantList diff --git a/twilio/rest/insights/v1/room/__init__.py b/twilio/rest/insights/v1/room/__init__.py index 1730be8b3..7361018e2 100644 --- a/twilio/rest/insights/v1/room/__init__.py +++ b/twilio/rest/insights/v1/room/__init__.py @@ -24,6 +24,7 @@ class RoomInstance(InstanceResource): + class Codec(object): VP8 = "VP8" H264 = "H264" @@ -222,6 +223,7 @@ def __repr__(self) -> str: class RoomContext(InstanceContext): + def __init__(self, version: Version, room_sid: str): """ Initialize the RoomContext @@ -300,6 +302,7 @@ def __repr__(self) -> str: class RoomPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> RoomInstance: """ Build an instance of RoomInstance @@ -318,6 +321,7 @@ def __repr__(self) -> str: class RoomList(ListResource): + def __init__(self, version: Version): """ Initialize the RoomList diff --git a/twilio/rest/insights/v1/room/participant.py b/twilio/rest/insights/v1/room/participant.py index 7d7103af3..0f6617f54 100644 --- a/twilio/rest/insights/v1/room/participant.py +++ b/twilio/rest/insights/v1/room/participant.py @@ -23,6 +23,7 @@ class ParticipantInstance(InstanceResource): + class Codec(object): VP8 = "VP8" H264 = "H264" @@ -161,6 +162,7 @@ def __repr__(self) -> str: class ParticipantContext(InstanceContext): + def __init__(self, version: Version, room_sid: str, participant_sid: str): """ Initialize the ParticipantContext @@ -231,6 +233,7 @@ def __repr__(self) -> str: class ParticipantPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ParticipantInstance: """ Build an instance of ParticipantInstance @@ -251,6 +254,7 @@ def __repr__(self) -> str: class ParticipantList(ListResource): + def __init__(self, version: Version, room_sid: str): """ Initialize the ParticipantList diff --git a/twilio/rest/insights/v1/setting.py b/twilio/rest/insights/v1/setting.py index 649fd001a..f0bb5f60d 100644 --- a/twilio/rest/insights/v1/setting.py +++ b/twilio/rest/insights/v1/setting.py @@ -133,6 +133,7 @@ def __repr__(self) -> str: class SettingContext(InstanceContext): + def __init__(self, version: Version): """ Initialize the SettingContext @@ -266,6 +267,7 @@ def __repr__(self) -> str: class SettingList(ListResource): + def __init__(self, version: Version): """ Initialize the SettingList diff --git a/twilio/rest/intelligence/IntelligenceBase.py b/twilio/rest/intelligence/IntelligenceBase.py index 2cece972e..0546bc15a 100644 --- a/twilio/rest/intelligence/IntelligenceBase.py +++ b/twilio/rest/intelligence/IntelligenceBase.py @@ -17,6 +17,7 @@ class IntelligenceBase(Domain): + def __init__(self, twilio: Client): """ Initialize the Intelligence Domain diff --git a/twilio/rest/intelligence/v2/__init__.py b/twilio/rest/intelligence/v2/__init__.py index 448b323e3..e20b125ce 100644 --- a/twilio/rest/intelligence/v2/__init__.py +++ b/twilio/rest/intelligence/v2/__init__.py @@ -20,6 +20,7 @@ class V2(Version): + def __init__(self, domain: Domain): """ Initialize the V2 version of Intelligence diff --git a/twilio/rest/intelligence/v2/service.py b/twilio/rest/intelligence/v2/service.py index fa27ee1a9..0761da544 100644 --- a/twilio/rest/intelligence/v2/service.py +++ b/twilio/rest/intelligence/v2/service.py @@ -23,6 +23,7 @@ class ServiceInstance(InstanceResource): + class HttpMethod(object): GET = "GET" POST = "POST" @@ -33,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 through using customer data to refine its speech recognition models. + :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 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. @@ -147,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 through using customer data to refine its speech recognition models. + :param data_logging: Data logging allows Twilio to improve the quality of the speech recognition & language understanding services through using customer data to refine, fine tune and evaluate machine learning models. Note: Data logging cannot be activated via API, only via www.twilio.com, as it requires additional consent. :param friendly_name: A human readable description of this resource, up to 64 characters. :param language_code: The default language code of the audio. :param unique_name: Provides a unique and addressable name to be assigned to this Service, assigned by the developer, to be optionally used in addition to SID. @@ -189,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 through using customer data to refine its speech recognition models. + :param data_logging: Data logging allows Twilio to improve the quality of the speech recognition & language understanding services through using customer data to refine, fine tune and evaluate machine learning models. Note: Data logging cannot be activated via API, only via www.twilio.com, as it requires additional consent. :param friendly_name: A human readable description of this resource, up to 64 characters. :param language_code: The default language code of the audio. :param unique_name: Provides a unique and addressable name to be assigned to this Service, assigned by the developer, to be optionally used in addition to SID. @@ -224,6 +225,7 @@ def __repr__(self) -> str: class ServiceContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the ServiceContext @@ -319,7 +321,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 through using customer data to refine its speech recognition models. + :param data_logging: Data logging allows Twilio to improve the quality of the speech recognition & language understanding services through using customer data to refine, fine tune and evaluate machine learning models. Note: Data logging cannot be activated via API, only via www.twilio.com, as it requires additional consent. :param friendly_name: A human readable description of this resource, up to 64 characters. :param language_code: The default language code of the audio. :param unique_name: Provides a unique and addressable name to be assigned to this Service, assigned by the developer, to be optionally used in addition to SID. @@ -373,7 +375,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 through using customer data to refine its speech recognition models. + :param data_logging: Data logging allows Twilio to improve the quality of the speech recognition & language understanding services through using customer data to refine, fine tune and evaluate machine learning models. Note: Data logging cannot be activated via API, only via www.twilio.com, as it requires additional consent. :param friendly_name: A human readable description of this resource, up to 64 characters. :param language_code: The default language code of the audio. :param unique_name: Provides a unique and addressable name to be assigned to this Service, assigned by the developer, to be optionally used in addition to SID. @@ -420,6 +422,7 @@ def __repr__(self) -> str: class ServicePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ServiceInstance: """ Build an instance of ServiceInstance @@ -438,6 +441,7 @@ def __repr__(self) -> str: class ServiceList(ListResource): + def __init__(self, version: Version): """ Initialize the ServiceList @@ -466,7 +470,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 through using customer data to refine its speech recognition models. + :param data_logging: Data logging allows Twilio to improve the quality of the speech recognition & language understanding services through using customer data to refine, fine tune and evaluate machine learning models. Note: Data logging cannot be activated via API, only via www.twilio.com, as it requires additional consent. :param friendly_name: A human readable description of this resource, up to 64 characters. :param language_code: The default language code of the audio. :param auto_redaction: Instructs the Speech Recognition service to automatically redact PII from all transcripts made on this service. @@ -476,6 +480,7 @@ def create( :returns: The created ServiceInstance """ + data = values.of( { "UniqueName": unique_name, @@ -515,7 +520,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 through using customer data to refine its speech recognition models. + :param data_logging: Data logging allows Twilio to improve the quality of the speech recognition & language understanding services through using customer data to refine, fine tune and evaluate machine learning models. Note: Data logging cannot be activated via API, only via www.twilio.com, as it requires additional consent. :param friendly_name: A human readable description of this resource, up to 64 characters. :param language_code: The default language code of the audio. :param auto_redaction: Instructs the Speech Recognition service to automatically redact PII from all transcripts made on this service. @@ -525,6 +530,7 @@ 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 4f4b3bb58..30b97f89b 100644 --- a/twilio/rest/intelligence/v2/transcript/__init__.py +++ b/twilio/rest/intelligence/v2/transcript/__init__.py @@ -26,6 +26,7 @@ class TranscriptInstance(InstanceResource): + class Status(object): QUEUED = "queued" IN_PROGRESS = "in-progress" @@ -41,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 through using customer data to refine its speech recognition models. + :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 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. @@ -166,6 +167,7 @@ def __repr__(self) -> str: class TranscriptContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the TranscriptContext @@ -294,6 +296,7 @@ def __repr__(self) -> str: class TranscriptPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> TranscriptInstance: """ Build an instance of TranscriptInstance @@ -312,6 +315,7 @@ def __repr__(self) -> str: class TranscriptList(ListResource): + def __init__(self, version: Version): """ Initialize the TranscriptList @@ -340,6 +344,7 @@ def create( :returns: The created TranscriptInstance """ + data = values.of( { "ServiceSid": service_sid, @@ -374,6 +379,7 @@ async def create_async( :returns: The created TranscriptInstance """ + data = values.of( { "ServiceSid": service_sid, diff --git a/twilio/rest/intelligence/v2/transcript/media.py b/twilio/rest/intelligence/v2/transcript/media.py index 469d4a4f6..cb129b436 100644 --- a/twilio/rest/intelligence/v2/transcript/media.py +++ b/twilio/rest/intelligence/v2/transcript/media.py @@ -95,6 +95,7 @@ def __repr__(self) -> str: class MediaContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the MediaContext @@ -171,6 +172,7 @@ def __repr__(self) -> str: class MediaList(ListResource): + def __init__(self, version: Version, sid: str): """ Initialize the MediaList diff --git a/twilio/rest/intelligence/v2/transcript/operator_result.py b/twilio/rest/intelligence/v2/transcript/operator_result.py index 00e9cbae4..086567332 100644 --- a/twilio/rest/intelligence/v2/transcript/operator_result.py +++ b/twilio/rest/intelligence/v2/transcript/operator_result.py @@ -22,6 +22,7 @@ class OperatorResultInstance(InstanceResource): + class OperatorType(object): CONVERSATION_CLASSIFY = "conversation_classify" UTTERANCE_CLASSIFY = "utterance_classify" @@ -42,6 +43,7 @@ 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. """ @@ -65,7 +67,7 @@ def __init__( payload.get("match_probability") ) self.normalized_result: Optional[str] = payload.get("normalized_result") - self.utterance_results: Optional[List[object]] = payload.get( + self.utterance_results: Optional[List[Dict[str, object]]] = payload.get( "utterance_results" ) self.utterance_match: Optional[bool] = payload.get("utterance_match") @@ -79,6 +81,9 @@ 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") @@ -143,6 +148,7 @@ def __repr__(self) -> str: class OperatorResultContext(InstanceContext): + def __init__(self, version: Version, transcript_sid: str, operator_sid: str): """ Initialize the OperatorResultContext @@ -229,6 +235,7 @@ def __repr__(self) -> str: class OperatorResultPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> OperatorResultInstance: """ Build an instance of OperatorResultInstance @@ -249,6 +256,7 @@ def __repr__(self) -> str: class OperatorResultList(ListResource): + def __init__(self, version: Version, transcript_sid: str): """ Initialize the OperatorResultList diff --git a/twilio/rest/intelligence/v2/transcript/sentence.py b/twilio/rest/intelligence/v2/transcript/sentence.py index a85953b80..f41913541 100644 --- a/twilio/rest/intelligence/v2/transcript/sentence.py +++ b/twilio/rest/intelligence/v2/transcript/sentence.py @@ -66,6 +66,7 @@ def __repr__(self) -> str: class SentencePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> SentenceInstance: """ Build an instance of SentenceInstance @@ -86,6 +87,7 @@ def __repr__(self) -> str: class SentenceList(ListResource): + def __init__(self, version: Version, transcript_sid: str): """ Initialize the SentenceList diff --git a/twilio/rest/ip_messaging/IpMessagingBase.py b/twilio/rest/ip_messaging/IpMessagingBase.py index d9e063c30..752d41adc 100644 --- a/twilio/rest/ip_messaging/IpMessagingBase.py +++ b/twilio/rest/ip_messaging/IpMessagingBase.py @@ -18,6 +18,7 @@ class IpMessagingBase(Domain): + def __init__(self, twilio: Client): """ Initialize the IpMessaging Domain diff --git a/twilio/rest/ip_messaging/v1/__init__.py b/twilio/rest/ip_messaging/v1/__init__.py index 1fd53b76b..d1f40c791 100644 --- a/twilio/rest/ip_messaging/v1/__init__.py +++ b/twilio/rest/ip_messaging/v1/__init__.py @@ -20,6 +20,7 @@ class V1(Version): + def __init__(self, domain: Domain): """ Initialize the V1 version of IpMessaging diff --git a/twilio/rest/ip_messaging/v1/credential.py b/twilio/rest/ip_messaging/v1/credential.py index f7f847e83..01423f490 100644 --- a/twilio/rest/ip_messaging/v1/credential.py +++ b/twilio/rest/ip_messaging/v1/credential.py @@ -23,6 +23,7 @@ class CredentialInstance(InstanceResource): + class PushService(object): GCM = "gcm" APN = "apn" @@ -184,6 +185,7 @@ def __repr__(self) -> str: class CredentialContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the CredentialContext @@ -352,6 +354,7 @@ def __repr__(self) -> str: class CredentialPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> CredentialInstance: """ Build an instance of CredentialInstance @@ -370,6 +373,7 @@ def __repr__(self) -> str: class CredentialList(ListResource): + def __init__(self, version: Version): """ Initialize the CredentialList @@ -404,6 +408,7 @@ def create( :returns: The created CredentialInstance """ + data = values.of( { "Type": type, @@ -447,6 +452,7 @@ 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 f70358dad..8e080657b 100644 --- a/twilio/rest/ip_messaging/v1/service/__init__.py +++ b/twilio/rest/ip_messaging/v1/service/__init__.py @@ -527,6 +527,7 @@ def __repr__(self) -> str: class ServiceContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the ServiceContext @@ -1023,6 +1024,7 @@ def __repr__(self) -> str: class ServicePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ServiceInstance: """ Build an instance of ServiceInstance @@ -1041,6 +1043,7 @@ def __repr__(self) -> str: class ServiceList(ListResource): + def __init__(self, version: Version): """ Initialize the ServiceList @@ -1060,6 +1063,7 @@ def create(self, friendly_name: str) -> ServiceInstance: :returns: The created ServiceInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -1082,6 +1086,7 @@ 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 343f744df..ef469e97f 100644 --- a/twilio/rest/ip_messaging/v1/service/channel/__init__.py +++ b/twilio/rest/ip_messaging/v1/service/channel/__init__.py @@ -26,6 +26,7 @@ class ChannelInstance(InstanceResource): + class ChannelType(object): PUBLIC = "public" PRIVATE = "private" @@ -211,6 +212,7 @@ def __repr__(self) -> str: class ChannelContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the ChannelContext @@ -418,6 +420,7 @@ def __repr__(self) -> str: class ChannelPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ChannelInstance: """ Build an instance of ChannelInstance @@ -438,6 +441,7 @@ def __repr__(self) -> str: class ChannelList(ListResource): + def __init__(self, version: Version, service_sid: str): """ Initialize the ChannelList @@ -471,6 +475,7 @@ def create( :returns: The created ChannelInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -507,6 +512,7 @@ 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 b76f91fac..7078058a4 100644 --- a/twilio/rest/ip_messaging/v1/service/channel/invite.py +++ b/twilio/rest/ip_messaging/v1/service/channel/invite.py @@ -132,6 +132,7 @@ def __repr__(self) -> str: class InviteContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, channel_sid: str, sid: str): """ Initialize the InviteContext @@ -232,6 +233,7 @@ def __repr__(self) -> str: class InvitePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> InviteInstance: """ Build an instance of InviteInstance @@ -255,6 +257,7 @@ def __repr__(self) -> str: class InviteList(ListResource): + def __init__(self, version: Version, service_sid: str, channel_sid: str): """ Initialize the InviteList @@ -286,6 +289,7 @@ def create( :returns: The created InviteInstance """ + data = values.of( { "Identity": identity, @@ -317,6 +321,7 @@ 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 4bc382774..c52fde5a8 100644 --- a/twilio/rest/ip_messaging/v1/service/channel/member.py +++ b/twilio/rest/ip_messaging/v1/service/channel/member.py @@ -174,6 +174,7 @@ def __repr__(self) -> str: class MemberContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, channel_sid: str, sid: str): """ Initialize the MemberContext @@ -342,6 +343,7 @@ def __repr__(self) -> str: class MemberPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> MemberInstance: """ Build an instance of MemberInstance @@ -365,6 +367,7 @@ def __repr__(self) -> str: class MemberList(ListResource): + def __init__(self, version: Version, service_sid: str, channel_sid: str): """ Initialize the MemberList @@ -396,6 +399,7 @@ def create( :returns: The created MemberInstance """ + data = values.of( { "Identity": identity, @@ -427,6 +431,7 @@ 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 c5e597377..f9f2a2b1a 100644 --- a/twilio/rest/ip_messaging/v1/service/channel/message.py +++ b/twilio/rest/ip_messaging/v1/service/channel/message.py @@ -23,6 +23,7 @@ class MessageInstance(InstanceResource): + class OrderType(object): ASC = "asc" DESC = "desc" @@ -178,6 +179,7 @@ def __repr__(self) -> str: class MessageContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, channel_sid: str, sid: str): """ Initialize the MessageContext @@ -346,6 +348,7 @@ def __repr__(self) -> str: class MessagePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> MessageInstance: """ Build an instance of MessageInstance @@ -369,6 +372,7 @@ def __repr__(self) -> str: class MessageList(ListResource): + def __init__(self, version: Version, service_sid: str, channel_sid: str): """ Initialize the MessageList @@ -404,6 +408,7 @@ def create( :returns: The created MessageInstance """ + data = values.of( { "Body": body, @@ -440,6 +445,7 @@ 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 05234ed2e..935a99e18 100644 --- a/twilio/rest/ip_messaging/v1/service/role.py +++ b/twilio/rest/ip_messaging/v1/service/role.py @@ -23,6 +23,7 @@ class RoleInstance(InstanceResource): + class RoleType(object): CHANNEL = "channel" DEPLOYMENT = "deployment" @@ -155,6 +156,7 @@ def __repr__(self) -> str: class RoleContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the RoleContext @@ -301,6 +303,7 @@ def __repr__(self) -> str: class RolePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> RoleInstance: """ Build an instance of RoleInstance @@ -321,6 +324,7 @@ def __repr__(self) -> str: class RoleList(ListResource): + def __init__(self, version: Version, service_sid: str): """ Initialize the RoleList @@ -349,6 +353,7 @@ def create( :returns: The created RoleInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -379,6 +384,7 @@ 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 76888f912..ef24fa776 100644 --- a/twilio/rest/ip_messaging/v1/service/user/__init__.py +++ b/twilio/rest/ip_messaging/v1/service/user/__init__.py @@ -189,6 +189,7 @@ def __repr__(self) -> str: class UserContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the UserContext @@ -368,6 +369,7 @@ def __repr__(self) -> str: class UserPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> UserInstance: """ Build an instance of UserInstance @@ -388,6 +390,7 @@ def __repr__(self) -> str: class UserList(ListResource): + def __init__(self, version: Version, service_sid: str): """ Initialize the UserList @@ -421,6 +424,7 @@ def create( :returns: The created UserInstance """ + data = values.of( { "Identity": identity, @@ -457,6 +461,7 @@ async def create_async( :returns: The created UserInstance """ + data = values.of( { "Identity": identity, diff --git a/twilio/rest/ip_messaging/v1/service/user/user_channel.py b/twilio/rest/ip_messaging/v1/service/user/user_channel.py index 8286725e6..192aafb38 100644 --- a/twilio/rest/ip_messaging/v1/service/user/user_channel.py +++ b/twilio/rest/ip_messaging/v1/service/user/user_channel.py @@ -22,6 +22,7 @@ class UserChannelInstance(InstanceResource): + class ChannelStatus(object): JOINED = "joined" INVITED = "invited" @@ -74,6 +75,7 @@ def __repr__(self) -> str: class UserChannelPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> UserChannelInstance: """ Build an instance of UserChannelInstance @@ -97,6 +99,7 @@ def __repr__(self) -> str: class UserChannelList(ListResource): + def __init__(self, version: Version, service_sid: str, user_sid: str): """ Initialize the UserChannelList diff --git a/twilio/rest/ip_messaging/v2/__init__.py b/twilio/rest/ip_messaging/v2/__init__.py index 966a35a44..6003c86b1 100644 --- a/twilio/rest/ip_messaging/v2/__init__.py +++ b/twilio/rest/ip_messaging/v2/__init__.py @@ -20,6 +20,7 @@ class V2(Version): + def __init__(self, domain: Domain): """ Initialize the V2 version of IpMessaging diff --git a/twilio/rest/ip_messaging/v2/credential.py b/twilio/rest/ip_messaging/v2/credential.py index 93f54df5f..f81892c74 100644 --- a/twilio/rest/ip_messaging/v2/credential.py +++ b/twilio/rest/ip_messaging/v2/credential.py @@ -23,6 +23,7 @@ class CredentialInstance(InstanceResource): + class PushService(object): GCM = "gcm" APN = "apn" @@ -184,6 +185,7 @@ def __repr__(self) -> str: class CredentialContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the CredentialContext @@ -352,6 +354,7 @@ def __repr__(self) -> str: class CredentialPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> CredentialInstance: """ Build an instance of CredentialInstance @@ -370,6 +373,7 @@ def __repr__(self) -> str: class CredentialList(ListResource): + def __init__(self, version: Version): """ Initialize the CredentialList @@ -404,6 +408,7 @@ def create( :returns: The created CredentialInstance """ + data = values.of( { "Type": type, @@ -447,6 +452,7 @@ 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 8bea3947c..227789bab 100644 --- a/twilio/rest/ip_messaging/v2/service/__init__.py +++ b/twilio/rest/ip_messaging/v2/service/__init__.py @@ -409,6 +409,7 @@ def __repr__(self) -> str: class ServiceContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the ServiceContext @@ -784,6 +785,7 @@ def __repr__(self) -> str: class ServicePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ServiceInstance: """ Build an instance of ServiceInstance @@ -802,6 +804,7 @@ def __repr__(self) -> str: class ServiceList(ListResource): + def __init__(self, version: Version): """ Initialize the ServiceList @@ -821,6 +824,7 @@ def create(self, friendly_name: str) -> ServiceInstance: :returns: The created ServiceInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -843,6 +847,7 @@ 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/binding.py b/twilio/rest/ip_messaging/v2/service/binding.py index dcc7e93d7..24c4f65a4 100644 --- a/twilio/rest/ip_messaging/v2/service/binding.py +++ b/twilio/rest/ip_messaging/v2/service/binding.py @@ -23,6 +23,7 @@ class BindingInstance(InstanceResource): + class BindingType(object): GCM = "gcm" APN = "apn" @@ -140,6 +141,7 @@ def __repr__(self) -> str: class BindingContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the BindingContext @@ -232,6 +234,7 @@ def __repr__(self) -> str: class BindingPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> BindingInstance: """ Build an instance of BindingInstance @@ -252,6 +255,7 @@ def __repr__(self) -> str: class BindingList(ListResource): + def __init__(self, version: Version, service_sid: str): """ Initialize the BindingList diff --git a/twilio/rest/ip_messaging/v2/service/channel/__init__.py b/twilio/rest/ip_messaging/v2/service/channel/__init__.py index 1eda6522f..c4e03d453 100644 --- a/twilio/rest/ip_messaging/v2/service/channel/__init__.py +++ b/twilio/rest/ip_messaging/v2/service/channel/__init__.py @@ -27,6 +27,7 @@ class ChannelInstance(InstanceResource): + class ChannelType(object): PUBLIC = "public" PRIVATE = "private" @@ -267,6 +268,7 @@ def __repr__(self) -> str: class ChannelContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the ChannelContext @@ -540,6 +542,7 @@ def __repr__(self) -> str: class ChannelPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ChannelInstance: """ Build an instance of ChannelInstance @@ -560,6 +563,7 @@ def __repr__(self) -> str: class ChannelList(ListResource): + def __init__(self, version: Version, service_sid: str): """ Initialize the ChannelList @@ -603,6 +607,7 @@ def create( :returns: The created ChannelInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -619,6 +624,7 @@ def create( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -654,6 +660,7 @@ async def create_async( :returns: The created ChannelInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -670,6 +677,7 @@ 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 ab862e72c..0f863d70f 100644 --- a/twilio/rest/ip_messaging/v2/service/channel/invite.py +++ b/twilio/rest/ip_messaging/v2/service/channel/invite.py @@ -132,6 +132,7 @@ def __repr__(self) -> str: class InviteContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, channel_sid: str, sid: str): """ Initialize the InviteContext @@ -232,6 +233,7 @@ def __repr__(self) -> str: class InvitePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> InviteInstance: """ Build an instance of InviteInstance @@ -255,6 +257,7 @@ def __repr__(self) -> str: class InviteList(ListResource): + def __init__(self, version: Version, service_sid: str, channel_sid: str): """ Initialize the InviteList @@ -286,6 +289,7 @@ def create( :returns: The created InviteInstance """ + data = values.of( { "Identity": identity, @@ -317,6 +321,7 @@ 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 9c50f8d56..5de4520ed 100644 --- a/twilio/rest/ip_messaging/v2/service/channel/member.py +++ b/twilio/rest/ip_messaging/v2/service/channel/member.py @@ -23,6 +23,7 @@ class MemberInstance(InstanceResource): + class WebhookEnabledType(object): TRUE = "true" FALSE = "false" @@ -230,6 +231,7 @@ def __repr__(self) -> str: class MemberContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, channel_sid: str, sid: str): """ Initialize the MemberContext @@ -460,6 +462,7 @@ def __repr__(self) -> str: class MemberPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> MemberInstance: """ Build an instance of MemberInstance @@ -483,6 +486,7 @@ def __repr__(self) -> str: class MemberList(ListResource): + def __init__(self, version: Version, service_sid: str, channel_sid: str): """ Initialize the MemberList @@ -530,6 +534,7 @@ def create( :returns: The created MemberInstance """ + data = values.of( { "Identity": identity, @@ -548,6 +553,7 @@ def create( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -586,6 +592,7 @@ async def create_async( :returns: The created MemberInstance """ + data = values.of( { "Identity": identity, @@ -604,6 +611,7 @@ 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 d0d5ceca7..057571c2a 100644 --- a/twilio/rest/ip_messaging/v2/service/channel/message.py +++ b/twilio/rest/ip_messaging/v2/service/channel/message.py @@ -23,6 +23,7 @@ class MessageInstance(InstanceResource): + class OrderType(object): ASC = "asc" DESC = "desc" @@ -238,6 +239,7 @@ def __repr__(self) -> str: class MessageContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, channel_sid: str, sid: str): """ Initialize the MessageContext @@ -464,6 +466,7 @@ def __repr__(self) -> str: class MessagePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> MessageInstance: """ Build an instance of MessageInstance @@ -487,6 +490,7 @@ def __repr__(self) -> str: class MessageList(ListResource): + def __init__(self, version: Version, service_sid: str, channel_sid: str): """ Initialize the MessageList @@ -534,6 +538,7 @@ def create( :returns: The created MessageInstance """ + data = values.of( { "From": from_, @@ -550,6 +555,7 @@ def create( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -588,6 +594,7 @@ async def create_async( :returns: The created MessageInstance """ + data = values.of( { "From": from_, @@ -604,6 +611,7 @@ 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 bf02e7c63..633acfd51 100644 --- a/twilio/rest/ip_messaging/v2/service/channel/webhook.py +++ b/twilio/rest/ip_messaging/v2/service/channel/webhook.py @@ -23,6 +23,7 @@ class WebhookInstance(InstanceResource): + class Method(object): GET = "GET" POST = "POST" @@ -199,6 +200,7 @@ def __repr__(self) -> str: class WebhookContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, channel_sid: str, sid: str): """ Initialize the WebhookContext @@ -399,6 +401,7 @@ def __repr__(self) -> str: class WebhookPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> WebhookInstance: """ Build an instance of WebhookInstance @@ -422,6 +425,7 @@ def __repr__(self) -> str: class WebhookList(ListResource): + def __init__(self, version: Version, service_sid: str, channel_sid: str): """ Initialize the WebhookList @@ -465,6 +469,7 @@ def create( :returns: The created WebhookInstance """ + data = values.of( { "Type": type, @@ -517,6 +522,7 @@ 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 bb816fd5f..91fc1af93 100644 --- a/twilio/rest/ip_messaging/v2/service/role.py +++ b/twilio/rest/ip_messaging/v2/service/role.py @@ -23,6 +23,7 @@ class RoleInstance(InstanceResource): + class RoleType(object): CHANNEL = "channel" DEPLOYMENT = "deployment" @@ -155,6 +156,7 @@ def __repr__(self) -> str: class RoleContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the RoleContext @@ -301,6 +303,7 @@ def __repr__(self) -> str: class RolePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> RoleInstance: """ Build an instance of RoleInstance @@ -321,6 +324,7 @@ def __repr__(self) -> str: class RoleList(ListResource): + def __init__(self, version: Version, service_sid: str): """ Initialize the RoleList @@ -349,6 +353,7 @@ def create( :returns: The created RoleInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -379,6 +384,7 @@ 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 6d87f2b71..1b3ba1b39 100644 --- a/twilio/rest/ip_messaging/v2/service/user/__init__.py +++ b/twilio/rest/ip_messaging/v2/service/user/__init__.py @@ -25,6 +25,7 @@ class UserInstance(InstanceResource): + class WebhookEnabledType(object): TRUE = "true" FALSE = "false" @@ -211,6 +212,7 @@ def __repr__(self) -> str: class UserContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the UserContext @@ -418,6 +420,7 @@ def __repr__(self) -> str: class UserPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> UserInstance: """ Build an instance of UserInstance @@ -438,6 +441,7 @@ def __repr__(self) -> str: class UserList(ListResource): + def __init__(self, version: Version, service_sid: str): """ Initialize the UserList @@ -475,6 +479,7 @@ def create( :returns: The created UserInstance """ + data = values.of( { "Identity": identity, @@ -488,6 +493,7 @@ def create( "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, } ) + payload = self._version.create( method="POST", uri=self._uri, data=data, headers=headers ) @@ -517,6 +523,7 @@ async def create_async( :returns: The created UserInstance """ + data = values.of( { "Identity": identity, @@ -530,6 +537,7 @@ 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/user/user_binding.py b/twilio/rest/ip_messaging/v2/service/user/user_binding.py index 9ff3bb9e0..575a295cb 100644 --- a/twilio/rest/ip_messaging/v2/service/user/user_binding.py +++ b/twilio/rest/ip_messaging/v2/service/user/user_binding.py @@ -23,6 +23,7 @@ class UserBindingInstance(InstanceResource): + class BindingType(object): GCM = "gcm" APN = "apn" @@ -143,6 +144,7 @@ def __repr__(self) -> str: class UserBindingContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, user_sid: str, sid: str): """ Initialize the UserBindingContext @@ -241,6 +243,7 @@ def __repr__(self) -> str: class UserBindingPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> UserBindingInstance: """ Build an instance of UserBindingInstance @@ -264,6 +267,7 @@ def __repr__(self) -> str: class UserBindingList(ListResource): + def __init__(self, version: Version, service_sid: str, user_sid: str): """ Initialize the UserBindingList diff --git a/twilio/rest/ip_messaging/v2/service/user/user_channel.py b/twilio/rest/ip_messaging/v2/service/user/user_channel.py index cb7f1a4fc..d89e6cb80 100644 --- a/twilio/rest/ip_messaging/v2/service/user/user_channel.py +++ b/twilio/rest/ip_messaging/v2/service/user/user_channel.py @@ -23,6 +23,7 @@ class UserChannelInstance(InstanceResource): + class ChannelStatus(object): JOINED = "joined" INVITED = "invited" @@ -193,6 +194,7 @@ def __repr__(self) -> str: class UserChannelContext(InstanceContext): + def __init__( self, version: Version, service_sid: str, user_sid: str, channel_sid: str ): @@ -377,6 +379,7 @@ def __repr__(self) -> str: class UserChannelPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> UserChannelInstance: """ Build an instance of UserChannelInstance @@ -400,6 +403,7 @@ def __repr__(self) -> str: class UserChannelList(ListResource): + def __init__(self, version: Version, service_sid: str, user_sid: str): """ Initialize the UserChannelList diff --git a/twilio/rest/lookups/LookupsBase.py b/twilio/rest/lookups/LookupsBase.py index fe3aa2aa6..e24f8dc61 100644 --- a/twilio/rest/lookups/LookupsBase.py +++ b/twilio/rest/lookups/LookupsBase.py @@ -18,6 +18,7 @@ class LookupsBase(Domain): + def __init__(self, twilio: Client): """ Initialize the Lookups Domain diff --git a/twilio/rest/lookups/v1/__init__.py b/twilio/rest/lookups/v1/__init__.py index 82f17cc04..72204da36 100644 --- a/twilio/rest/lookups/v1/__init__.py +++ b/twilio/rest/lookups/v1/__init__.py @@ -19,6 +19,7 @@ class V1(Version): + def __init__(self, domain: Domain): """ Initialize the V1 version of Lookups diff --git a/twilio/rest/lookups/v1/phone_number.py b/twilio/rest/lookups/v1/phone_number.py index b5d8c8351..fe521c73e 100644 --- a/twilio/rest/lookups/v1/phone_number.py +++ b/twilio/rest/lookups/v1/phone_number.py @@ -126,6 +126,7 @@ def __repr__(self) -> str: class PhoneNumberContext(InstanceContext): + def __init__(self, version: Version, phone_number: str): """ Initialize the PhoneNumberContext @@ -224,6 +225,7 @@ def __repr__(self) -> str: class PhoneNumberList(ListResource): + def __init__(self, version: Version): """ Initialize the PhoneNumberList diff --git a/twilio/rest/lookups/v2/__init__.py b/twilio/rest/lookups/v2/__init__.py index 1cea8ab0b..d795aea16 100644 --- a/twilio/rest/lookups/v2/__init__.py +++ b/twilio/rest/lookups/v2/__init__.py @@ -19,6 +19,7 @@ class V2(Version): + def __init__(self, domain: Domain): """ Initialize the V2 version of Lookups diff --git a/twilio/rest/lookups/v2/phone_number.py b/twilio/rest/lookups/v2/phone_number.py index f72f112f2..97ef39b94 100644 --- a/twilio/rest/lookups/v2/phone_number.py +++ b/twilio/rest/lookups/v2/phone_number.py @@ -21,6 +21,7 @@ class PhoneNumberInstance(InstanceResource): + class ValidationError(object): TOO_SHORT = "TOO_SHORT" TOO_LONG = "TOO_LONG" @@ -218,6 +219,7 @@ def __repr__(self) -> str: class PhoneNumberContext(InstanceContext): + def __init__(self, version: Version, phone_number: str): """ Initialize the PhoneNumberContext @@ -370,6 +372,7 @@ def __repr__(self) -> str: class PhoneNumberList(ListResource): + def __init__(self, version: Version): """ Initialize the PhoneNumberList diff --git a/twilio/rest/media/MediaBase.py b/twilio/rest/media/MediaBase.py index 28c5e37a0..6581eb5d0 100644 --- a/twilio/rest/media/MediaBase.py +++ b/twilio/rest/media/MediaBase.py @@ -17,6 +17,7 @@ class MediaBase(Domain): + def __init__(self, twilio: Client): """ Initialize the Media Domain diff --git a/twilio/rest/media/v1/__init__.py b/twilio/rest/media/v1/__init__.py index cca96fc01..3cef1df9b 100644 --- a/twilio/rest/media/v1/__init__.py +++ b/twilio/rest/media/v1/__init__.py @@ -21,6 +21,7 @@ class V1(Version): + def __init__(self, domain: Domain): """ Initialize the V1 version of Media diff --git a/twilio/rest/media/v1/media_processor.py b/twilio/rest/media/v1/media_processor.py index a55c80db9..7f1d2825b 100644 --- a/twilio/rest/media/v1/media_processor.py +++ b/twilio/rest/media/v1/media_processor.py @@ -23,6 +23,7 @@ class MediaProcessorInstance(InstanceResource): + class Order(object): ASC = "asc" DESC = "desc" @@ -153,6 +154,7 @@ def __repr__(self) -> str: class MediaProcessorContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the MediaProcessorContext @@ -265,6 +267,7 @@ def __repr__(self) -> str: class MediaProcessorPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> MediaProcessorInstance: """ Build an instance of MediaProcessorInstance @@ -283,6 +286,7 @@ def __repr__(self) -> str: class MediaProcessorList(ListResource): + def __init__(self, version: Version): """ Initialize the MediaProcessorList @@ -315,6 +319,7 @@ def create( :returns: The created MediaProcessorInstance """ + data = values.of( { "Extension": extension, @@ -355,6 +360,7 @@ async def create_async( :returns: The created MediaProcessorInstance """ + data = values.of( { "Extension": extension, diff --git a/twilio/rest/media/v1/media_recording.py b/twilio/rest/media/v1/media_recording.py index 837845306..fb916e527 100644 --- a/twilio/rest/media/v1/media_recording.py +++ b/twilio/rest/media/v1/media_recording.py @@ -23,6 +23,7 @@ class MediaRecordingInstance(InstanceResource): + class Format(object): MP4 = "mp4" WEBM = "webm" @@ -149,6 +150,7 @@ def __repr__(self) -> str: class MediaRecordingContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the MediaRecordingContext @@ -237,6 +239,7 @@ def __repr__(self) -> str: class MediaRecordingPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> MediaRecordingInstance: """ Build an instance of MediaRecordingInstance @@ -255,6 +258,7 @@ def __repr__(self) -> str: class MediaRecordingList(ListResource): + def __init__(self, version: Version): """ Initialize the MediaRecordingList diff --git a/twilio/rest/media/v1/player_streamer/__init__.py b/twilio/rest/media/v1/player_streamer/__init__.py index e25fc3f4a..6ea0889fc 100644 --- a/twilio/rest/media/v1/player_streamer/__init__.py +++ b/twilio/rest/media/v1/player_streamer/__init__.py @@ -24,6 +24,7 @@ class PlayerStreamerInstance(InstanceResource): + class EndedReason(object): ENDED_VIA_API = "ended-via-api" MAX_DURATION_EXCEEDED = "max-duration-exceeded" @@ -170,6 +171,7 @@ def __repr__(self) -> str: class PlayerStreamerContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the PlayerStreamerContext @@ -296,6 +298,7 @@ def __repr__(self) -> str: class PlayerStreamerPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> PlayerStreamerInstance: """ Build an instance of PlayerStreamerInstance @@ -314,6 +317,7 @@ def __repr__(self) -> str: class PlayerStreamerList(ListResource): + def __init__(self, version: Version): """ Initialize the PlayerStreamerList @@ -342,6 +346,7 @@ def create( :returns: The created PlayerStreamerInstance """ + data = values.of( { "Video": video, @@ -376,6 +381,7 @@ async def create_async( :returns: The created PlayerStreamerInstance """ + data = values.of( { "Video": video, diff --git a/twilio/rest/media/v1/player_streamer/playback_grant.py b/twilio/rest/media/v1/player_streamer/playback_grant.py index 2aa42efad..a4cdbb402 100644 --- a/twilio/rest/media/v1/player_streamer/playback_grant.py +++ b/twilio/rest/media/v1/player_streamer/playback_grant.py @@ -126,6 +126,7 @@ def __repr__(self) -> str: class PlaybackGrantContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the PlaybackGrantContext @@ -240,6 +241,7 @@ def __repr__(self) -> str: class PlaybackGrantList(ListResource): + def __init__(self, version: Version, sid: str): """ Initialize the PlaybackGrantList diff --git a/twilio/rest/messaging/MessagingBase.py b/twilio/rest/messaging/MessagingBase.py index ea6b0dd0a..4fff74d91 100644 --- a/twilio/rest/messaging/MessagingBase.py +++ b/twilio/rest/messaging/MessagingBase.py @@ -17,6 +17,7 @@ class MessagingBase(Domain): + def __init__(self, twilio: Client): """ Initialize the Messaging Domain diff --git a/twilio/rest/messaging/v1/__init__.py b/twilio/rest/messaging/v1/__init__.py index 20ce090da..6262dfe93 100644 --- a/twilio/rest/messaging/v1/__init__.py +++ b/twilio/rest/messaging/v1/__init__.py @@ -35,6 +35,7 @@ class V1(Version): + def __init__(self, domain: Domain): """ Initialize the V1 version of Messaging diff --git a/twilio/rest/messaging/v1/brand_registration/__init__.py b/twilio/rest/messaging/v1/brand_registration/__init__.py index 54be98b15..5c6dbc824 100644 --- a/twilio/rest/messaging/v1/brand_registration/__init__.py +++ b/twilio/rest/messaging/v1/brand_registration/__init__.py @@ -27,6 +27,7 @@ class BrandRegistrationInstance(InstanceResource): + class BrandFeedback(object): TAX_ID = "TAX_ID" STOCK_SYMBOL = "STOCK_SYMBOL" @@ -195,6 +196,7 @@ def __repr__(self) -> str: class BrandRegistrationContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the BrandRegistrationContext @@ -324,6 +326,7 @@ def __repr__(self) -> str: class BrandRegistrationPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> BrandRegistrationInstance: """ Build an instance of BrandRegistrationInstance @@ -342,6 +345,7 @@ def __repr__(self) -> str: class BrandRegistrationList(ListResource): + def __init__(self, version: Version): """ Initialize the BrandRegistrationList @@ -372,6 +376,7 @@ def create( :returns: The created BrandRegistrationInstance """ + data = values.of( { "CustomerProfileBundleSid": customer_profile_bundle_sid, @@ -409,6 +414,7 @@ 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_registration_otp.py b/twilio/rest/messaging/v1/brand_registration/brand_registration_otp.py index 676d11660..20ce245b3 100644 --- a/twilio/rest/messaging/v1/brand_registration/brand_registration_otp.py +++ b/twilio/rest/messaging/v1/brand_registration/brand_registration_otp.py @@ -50,6 +50,7 @@ def __repr__(self) -> str: class BrandRegistrationOtpList(ListResource): + def __init__(self, version: Version, brand_registration_sid: str): """ Initialize the BrandRegistrationOtpList diff --git a/twilio/rest/messaging/v1/brand_registration/brand_vetting.py b/twilio/rest/messaging/v1/brand_registration/brand_vetting.py index 6517d0860..c801cb12b 100644 --- a/twilio/rest/messaging/v1/brand_registration/brand_vetting.py +++ b/twilio/rest/messaging/v1/brand_registration/brand_vetting.py @@ -23,6 +23,7 @@ class BrandVettingInstance(InstanceResource): + class VettingProvider(object): CAMPAIGN_VERIFY = "campaign-verify" @@ -116,6 +117,7 @@ def __repr__(self) -> str: class BrandVettingContext(InstanceContext): + def __init__(self, version: Version, brand_sid: str, brand_vetting_sid: str): """ Initialize the BrandVettingContext @@ -188,6 +190,7 @@ def __repr__(self) -> str: class BrandVettingPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> BrandVettingInstance: """ Build an instance of BrandVettingInstance @@ -208,6 +211,7 @@ def __repr__(self) -> str: class BrandVettingList(ListResource): + def __init__(self, version: Version, brand_sid: str): """ Initialize the BrandVettingList @@ -239,6 +243,7 @@ def create( :returns: The created BrandVettingInstance """ + data = values.of( { "VettingProvider": vetting_provider, @@ -269,6 +274,7 @@ async def create_async( :returns: The created BrandVettingInstance """ + data = values.of( { "VettingProvider": vetting_provider, diff --git a/twilio/rest/messaging/v1/deactivations.py b/twilio/rest/messaging/v1/deactivations.py index 9081be42a..6616d87df 100644 --- a/twilio/rest/messaging/v1/deactivations.py +++ b/twilio/rest/messaging/v1/deactivations.py @@ -86,6 +86,7 @@ def __repr__(self) -> str: class DeactivationsContext(InstanceContext): + def __init__(self, version: Version): """ Initialize the DeactivationsContext @@ -155,6 +156,7 @@ def __repr__(self) -> str: class DeactivationsList(ListResource): + def __init__(self, version: Version): """ Initialize the DeactivationsList diff --git a/twilio/rest/messaging/v1/domain_certs.py b/twilio/rest/messaging/v1/domain_certs.py index e5586d238..3acc8a18f 100644 --- a/twilio/rest/messaging/v1/domain_certs.py +++ b/twilio/rest/messaging/v1/domain_certs.py @@ -149,6 +149,7 @@ def __repr__(self) -> str: class DomainCertsContext(InstanceContext): + def __init__(self, version: Version, domain_sid: str): """ Initialize the DomainCertsContext @@ -287,6 +288,7 @@ def __repr__(self) -> str: class DomainCertsList(ListResource): + def __init__(self, version: Version): """ Initialize the DomainCertsList diff --git a/twilio/rest/messaging/v1/domain_config.py b/twilio/rest/messaging/v1/domain_config.py index 048ad7952..4889827a6 100644 --- a/twilio/rest/messaging/v1/domain_config.py +++ b/twilio/rest/messaging/v1/domain_config.py @@ -153,6 +153,7 @@ def __repr__(self) -> str: class DomainConfigContext(InstanceContext): + def __init__(self, version: Version, domain_sid: str): """ Initialize the DomainConfigContext @@ -291,6 +292,7 @@ def __repr__(self) -> str: class DomainConfigList(ListResource): + def __init__(self, version: Version): """ Initialize the DomainConfigList diff --git a/twilio/rest/messaging/v1/domain_config_messaging_service.py b/twilio/rest/messaging/v1/domain_config_messaging_service.py index 864e487bd..178ebd544 100644 --- a/twilio/rest/messaging/v1/domain_config_messaging_service.py +++ b/twilio/rest/messaging/v1/domain_config_messaging_service.py @@ -108,6 +108,7 @@ def __repr__(self) -> str: class DomainConfigMessagingServiceContext(InstanceContext): + def __init__(self, version: Version, messaging_service_sid: str): """ Initialize the DomainConfigMessagingServiceContext @@ -176,6 +177,7 @@ def __repr__(self) -> str: class DomainConfigMessagingServiceList(ListResource): + def __init__(self, version: Version): """ Initialize the DomainConfigMessagingServiceList diff --git a/twilio/rest/messaging/v1/external_campaign.py b/twilio/rest/messaging/v1/external_campaign.py index a57261c5a..b70d8a4ee 100644 --- a/twilio/rest/messaging/v1/external_campaign.py +++ b/twilio/rest/messaging/v1/external_campaign.py @@ -52,6 +52,7 @@ def __repr__(self) -> str: class ExternalCampaignList(ListResource): + def __init__(self, version: Version): """ Initialize the ExternalCampaignList @@ -74,6 +75,7 @@ def create( :returns: The created ExternalCampaignInstance """ + data = values.of( { "CampaignId": campaign_id, @@ -100,6 +102,7 @@ async def create_async( :returns: The created ExternalCampaignInstance """ + data = values.of( { "CampaignId": campaign_id, diff --git a/twilio/rest/messaging/v1/linkshortening_messaging_service.py b/twilio/rest/messaging/v1/linkshortening_messaging_service.py index 8c1475da9..94ebfa617 100644 --- a/twilio/rest/messaging/v1/linkshortening_messaging_service.py +++ b/twilio/rest/messaging/v1/linkshortening_messaging_service.py @@ -112,6 +112,7 @@ def __repr__(self) -> str: class LinkshorteningMessagingServiceContext(InstanceContext): + def __init__(self, version: Version, domain_sid: str, messaging_service_sid: str): """ Initialize the LinkshorteningMessagingServiceContext @@ -206,6 +207,7 @@ def __repr__(self) -> str: class LinkshorteningMessagingServiceList(ListResource): + def __init__(self, version: Version): """ Initialize the LinkshorteningMessagingServiceList diff --git a/twilio/rest/messaging/v1/linkshortening_messaging_service_domain_association.py b/twilio/rest/messaging/v1/linkshortening_messaging_service_domain_association.py index 1ec176e0c..a1252d2b3 100644 --- a/twilio/rest/messaging/v1/linkshortening_messaging_service_domain_association.py +++ b/twilio/rest/messaging/v1/linkshortening_messaging_service_domain_association.py @@ -94,6 +94,7 @@ def __repr__(self) -> str: class LinkshorteningMessagingServiceDomainAssociationContext(InstanceContext): + def __init__(self, version: Version, messaging_service_sid: str): """ Initialize the LinkshorteningMessagingServiceDomainAssociationContext @@ -166,6 +167,7 @@ def __repr__(self) -> str: class LinkshorteningMessagingServiceDomainAssociationList(ListResource): + def __init__(self, version: Version): """ Initialize the LinkshorteningMessagingServiceDomainAssociationList diff --git a/twilio/rest/messaging/v1/service/__init__.py b/twilio/rest/messaging/v1/service/__init__.py index 24d707579..3695b744f 100644 --- a/twilio/rest/messaging/v1/service/__init__.py +++ b/twilio/rest/messaging/v1/service/__init__.py @@ -31,6 +31,7 @@ class ServiceInstance(InstanceResource): + class ScanMessageContent(object): INHERIT = "inherit" ENABLE = "enable" @@ -340,6 +341,7 @@ def __repr__(self) -> str: class ServiceContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the ServiceContext @@ -651,6 +653,7 @@ def __repr__(self) -> str: class ServicePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ServiceInstance: """ Build an instance of ServiceInstance @@ -669,6 +672,7 @@ def __repr__(self) -> str: class ServiceList(ListResource): + def __init__(self, version: Version): """ Initialize the ServiceList @@ -723,6 +727,7 @@ def create( :returns: The created ServiceInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -795,6 +800,7 @@ 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 77a1e4e37..38d2d0d5e 100644 --- a/twilio/rest/messaging/v1/service/alpha_sender.py +++ b/twilio/rest/messaging/v1/service/alpha_sender.py @@ -125,6 +125,7 @@ def __repr__(self) -> str: class AlphaSenderContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the AlphaSenderContext @@ -219,6 +220,7 @@ def __repr__(self) -> str: class AlphaSenderPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> AlphaSenderInstance: """ Build an instance of AlphaSenderInstance @@ -239,6 +241,7 @@ def __repr__(self) -> str: class AlphaSenderList(ListResource): + def __init__(self, version: Version, service_sid: str): """ Initialize the AlphaSenderList @@ -263,6 +266,7 @@ def create(self, alpha_sender: str) -> AlphaSenderInstance: :returns: The created AlphaSenderInstance """ + data = values.of( { "AlphaSender": alpha_sender, @@ -287,6 +291,7 @@ 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 c165e64d6..a8de3d0cf 100644 --- a/twilio/rest/messaging/v1/service/channel_sender.py +++ b/twilio/rest/messaging/v1/service/channel_sender.py @@ -32,7 +32,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: + :ivar url: The absolute URL of the ChannelSender resource. """ def __init__( @@ -109,6 +109,7 @@ def __repr__(self) -> str: class ChannelSenderContext(InstanceContext): + def __init__(self, version: Version, messaging_service_sid: str, sid: str): """ Initialize the ChannelSenderContext @@ -179,6 +180,7 @@ def __repr__(self) -> str: class ChannelSenderPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ChannelSenderInstance: """ Build an instance of ChannelSenderInstance @@ -201,6 +203,7 @@ def __repr__(self) -> str: class ChannelSenderList(ListResource): + def __init__(self, version: Version, messaging_service_sid: str): """ Initialize the ChannelSenderList diff --git a/twilio/rest/messaging/v1/service/phone_number.py b/twilio/rest/messaging/v1/service/phone_number.py index 4252b40b1..8b0b4c090 100644 --- a/twilio/rest/messaging/v1/service/phone_number.py +++ b/twilio/rest/messaging/v1/service/phone_number.py @@ -127,6 +127,7 @@ def __repr__(self) -> str: class PhoneNumberContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the PhoneNumberContext @@ -221,6 +222,7 @@ def __repr__(self) -> str: class PhoneNumberPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> PhoneNumberInstance: """ Build an instance of PhoneNumberInstance @@ -241,6 +243,7 @@ def __repr__(self) -> str: class PhoneNumberList(ListResource): + def __init__(self, version: Version, service_sid: str): """ Initialize the PhoneNumberList @@ -265,6 +268,7 @@ def create(self, phone_number_sid: str) -> PhoneNumberInstance: :returns: The created PhoneNumberInstance """ + data = values.of( { "PhoneNumberSid": phone_number_sid, @@ -289,6 +293,7 @@ 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 ca3b0d749..653787589 100644 --- a/twilio/rest/messaging/v1/service/short_code.py +++ b/twilio/rest/messaging/v1/service/short_code.py @@ -127,6 +127,7 @@ def __repr__(self) -> str: class ShortCodeContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the ShortCodeContext @@ -219,6 +220,7 @@ def __repr__(self) -> str: class ShortCodePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ShortCodeInstance: """ Build an instance of ShortCodeInstance @@ -239,6 +241,7 @@ def __repr__(self) -> str: class ShortCodeList(ListResource): + def __init__(self, version: Version, service_sid: str): """ Initialize the ShortCodeList @@ -263,6 +266,7 @@ def create(self, short_code_sid: str) -> ShortCodeInstance: :returns: The created ShortCodeInstance """ + data = values.of( { "ShortCodeSid": short_code_sid, @@ -287,6 +291,7 @@ 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 6cae9d709..cc23f0caf 100644 --- a/twilio/rest/messaging/v1/service/us_app_to_person.py +++ b/twilio/rest/messaging/v1/service/us_app_to_person.py @@ -33,6 +33,9 @@ class UsAppToPersonInstance(InstanceResource): :ivar us_app_to_person_usecase: A2P Campaign Use Case. Examples: [ 2FA, EMERGENCY, MARKETING, SOLE_PROPRIETOR...]. SOLE_PROPRIETOR campaign use cases can only be created by SOLE_PROPRIETOR Brands, and there can only be one SOLE_PROPRIETOR campaign created per SOLE_PROPRIETOR Brand. :ivar has_embedded_links: Indicate that this SMS campaign will send messages that contain links. :ivar has_embedded_phone: Indicates that this SMS campaign will send messages that contain phone numbers. + :ivar subscriber_opt_in: A boolean that specifies whether campaign has Subscriber Optin or not. + :ivar age_gated: A boolean that specifies whether campaign is age gated or not. + :ivar direct_lending: A boolean that specifies whether campaign allows direct lending or not. :ivar campaign_status: Campaign status. Examples: IN_PROGRESS, VERIFIED, FAILED. :ivar campaign_id: The Campaign Registry (TCR) Campaign ID. :ivar is_externally_registered: Indicates whether the campaign was registered externally or not. @@ -73,6 +76,9 @@ def __init__( ) self.has_embedded_links: Optional[bool] = payload.get("has_embedded_links") self.has_embedded_phone: Optional[bool] = payload.get("has_embedded_phone") + self.subscriber_opt_in: Optional[bool] = payload.get("subscriber_opt_in") + self.age_gated: Optional[bool] = payload.get("age_gated") + self.direct_lending: Optional[bool] = payload.get("direct_lending") self.campaign_status: Optional[str] = payload.get("campaign_status") self.campaign_id: Optional[str] = payload.get("campaign_id") self.is_externally_registered: Optional[bool] = payload.get( @@ -94,7 +100,7 @@ def __init__( ) self.url: Optional[str] = payload.get("url") self.mock: Optional[bool] = payload.get("mock") - self.errors: Optional[List[object]] = payload.get("errors") + self.errors: Optional[List[Dict[str, object]]] = payload.get("errors") self._solution = { "messaging_service_sid": messaging_service_sid, @@ -154,6 +160,72 @@ async def fetch_async(self) -> "UsAppToPersonInstance": """ return await self._proxy.fetch_async() + def update( + self, + has_embedded_links: bool, + has_embedded_phone: bool, + message_samples: List[str], + message_flow: str, + description: str, + age_gated: bool, + direct_lending: bool, + ) -> "UsAppToPersonInstance": + """ + Update the UsAppToPersonInstance + + :param has_embedded_links: Indicates that this SMS campaign will send messages that contain links. + :param has_embedded_phone: Indicates that this SMS campaign will send messages that contain phone numbers. + :param message_samples: An array of sample message strings, min two and max five. Min length for each sample: 20 chars. Max length for each sample: 1024 chars. + :param message_flow: Required for all Campaigns. Details around how a consumer opts-in to their campaign, therefore giving consent to receive their messages. If multiple opt-in methods can be used for the same campaign, they must all be listed. 40 character minimum. 2048 character maximum. + :param description: A short description of what this SMS campaign does. Min length: 40 characters. Max length: 4096 characters. + :param age_gated: A boolean that specifies whether campaign requires age gate for federally legal content. + :param direct_lending: A boolean that specifies whether campaign allows direct lending or not. + + :returns: The updated UsAppToPersonInstance + """ + return self._proxy.update( + has_embedded_links=has_embedded_links, + has_embedded_phone=has_embedded_phone, + message_samples=message_samples, + message_flow=message_flow, + description=description, + age_gated=age_gated, + direct_lending=direct_lending, + ) + + async def update_async( + self, + has_embedded_links: bool, + has_embedded_phone: bool, + message_samples: List[str], + message_flow: str, + description: str, + age_gated: bool, + direct_lending: bool, + ) -> "UsAppToPersonInstance": + """ + Asynchronous coroutine to update the UsAppToPersonInstance + + :param has_embedded_links: Indicates that this SMS campaign will send messages that contain links. + :param has_embedded_phone: Indicates that this SMS campaign will send messages that contain phone numbers. + :param message_samples: An array of sample message strings, min two and max five. Min length for each sample: 20 chars. Max length for each sample: 1024 chars. + :param message_flow: Required for all Campaigns. Details around how a consumer opts-in to their campaign, therefore giving consent to receive their messages. If multiple opt-in methods can be used for the same campaign, they must all be listed. 40 character minimum. 2048 character maximum. + :param description: A short description of what this SMS campaign does. Min length: 40 characters. Max length: 4096 characters. + :param age_gated: A boolean that specifies whether campaign requires age gate for federally legal content. + :param direct_lending: A boolean that specifies whether campaign allows direct lending or not. + + :returns: The updated UsAppToPersonInstance + """ + return await self._proxy.update_async( + has_embedded_links=has_embedded_links, + has_embedded_phone=has_embedded_phone, + message_samples=message_samples, + message_flow=message_flow, + description=description, + age_gated=age_gated, + direct_lending=direct_lending, + ) + def __repr__(self) -> str: """ Provide a friendly representation @@ -165,13 +237,14 @@ def __repr__(self) -> str: class UsAppToPersonContext(InstanceContext): + def __init__(self, version: Version, messaging_service_sid: str, sid: str): """ Initialize the UsAppToPersonContext :param version: Version that contains the resource - :param messaging_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) to fetch the resource from. - :param sid: The SID of the US A2P Compliance resource to fetch `QE2c6890da8086d771620e9b13fadeba0b`. + :param messaging_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/services/api) to update the resource from. + :param sid: The SID of the US A2P Compliance resource to update `QE2c6890da8086d771620e9b13fadeba0b`. """ super().__init__(version) @@ -248,6 +321,102 @@ async def fetch_async(self) -> UsAppToPersonInstance: sid=self._solution["sid"], ) + def update( + self, + has_embedded_links: bool, + has_embedded_phone: bool, + message_samples: List[str], + message_flow: str, + description: str, + age_gated: bool, + direct_lending: bool, + ) -> UsAppToPersonInstance: + """ + Update the UsAppToPersonInstance + + :param has_embedded_links: Indicates that this SMS campaign will send messages that contain links. + :param has_embedded_phone: Indicates that this SMS campaign will send messages that contain phone numbers. + :param message_samples: An array of sample message strings, min two and max five. Min length for each sample: 20 chars. Max length for each sample: 1024 chars. + :param message_flow: Required for all Campaigns. Details around how a consumer opts-in to their campaign, therefore giving consent to receive their messages. If multiple opt-in methods can be used for the same campaign, they must all be listed. 40 character minimum. 2048 character maximum. + :param description: A short description of what this SMS campaign does. Min length: 40 characters. Max length: 4096 characters. + :param age_gated: A boolean that specifies whether campaign requires age gate for federally legal content. + :param direct_lending: A boolean that specifies whether campaign allows direct lending or not. + + :returns: The updated UsAppToPersonInstance + """ + data = values.of( + { + "HasEmbeddedLinks": has_embedded_links, + "HasEmbeddedPhone": has_embedded_phone, + "MessageSamples": serialize.map(message_samples, lambda e: e), + "MessageFlow": message_flow, + "Description": description, + "AgeGated": age_gated, + "DirectLending": direct_lending, + } + ) + + payload = self._version.update( + method="POST", + uri=self._uri, + data=data, + ) + + return UsAppToPersonInstance( + self._version, + payload, + messaging_service_sid=self._solution["messaging_service_sid"], + sid=self._solution["sid"], + ) + + async def update_async( + self, + has_embedded_links: bool, + has_embedded_phone: bool, + message_samples: List[str], + message_flow: str, + description: str, + age_gated: bool, + direct_lending: bool, + ) -> UsAppToPersonInstance: + """ + Asynchronous coroutine to update the UsAppToPersonInstance + + :param has_embedded_links: Indicates that this SMS campaign will send messages that contain links. + :param has_embedded_phone: Indicates that this SMS campaign will send messages that contain phone numbers. + :param message_samples: An array of sample message strings, min two and max five. Min length for each sample: 20 chars. Max length for each sample: 1024 chars. + :param message_flow: Required for all Campaigns. Details around how a consumer opts-in to their campaign, therefore giving consent to receive their messages. If multiple opt-in methods can be used for the same campaign, they must all be listed. 40 character minimum. 2048 character maximum. + :param description: A short description of what this SMS campaign does. Min length: 40 characters. Max length: 4096 characters. + :param age_gated: A boolean that specifies whether campaign requires age gate for federally legal content. + :param direct_lending: A boolean that specifies whether campaign allows direct lending or not. + + :returns: The updated UsAppToPersonInstance + """ + data = values.of( + { + "HasEmbeddedLinks": has_embedded_links, + "HasEmbeddedPhone": has_embedded_phone, + "MessageSamples": serialize.map(message_samples, lambda e: e), + "MessageFlow": message_flow, + "Description": description, + "AgeGated": age_gated, + "DirectLending": direct_lending, + } + ) + + payload = await self._version.update_async( + method="POST", + uri=self._uri, + data=data, + ) + + return UsAppToPersonInstance( + self._version, + payload, + messaging_service_sid=self._solution["messaging_service_sid"], + sid=self._solution["sid"], + ) + def __repr__(self) -> str: """ Provide a friendly representation @@ -259,6 +428,7 @@ def __repr__(self) -> str: class UsAppToPersonPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> UsAppToPersonInstance: """ Build an instance of UsAppToPersonInstance @@ -281,6 +451,7 @@ def __repr__(self) -> str: class UsAppToPersonList(ListResource): + def __init__(self, version: Version, messaging_service_sid: str): """ Initialize the UsAppToPersonList @@ -314,6 +485,9 @@ def create( opt_in_keywords: Union[List[str], object] = values.unset, opt_out_keywords: Union[List[str], object] = values.unset, help_keywords: Union[List[str], object] = values.unset, + subscriber_opt_in: Union[bool, object] = values.unset, + age_gated: Union[bool, object] = values.unset, + direct_lending: Union[bool, object] = values.unset, ) -> UsAppToPersonInstance: """ Create the UsAppToPersonInstance @@ -331,9 +505,13 @@ def create( :param opt_in_keywords: If end users can text in a keyword to start receiving messages from this campaign, those keywords must be provided. This field is required if end users can text in a keyword to start receiving messages from this campaign. Values must be alphanumeric. 255 character maximum. :param opt_out_keywords: End users should be able to text in a keyword to stop receiving messages from this campaign. Those keywords must be provided. This field is required if managing opt out keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). Values must be alphanumeric. 255 character maximum. :param help_keywords: End users should be able to text in a keyword to receive help. Those keywords must be provided as part of the campaign registration request. This field is required if managing help keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). Values must be alphanumeric. 255 character maximum. + :param subscriber_opt_in: A boolean that specifies whether campaign has Subscriber Optin or not. + :param age_gated: A boolean that specifies whether campaign is age gated or not. + :param direct_lending: A boolean that specifies whether campaign allows direct lending or not. :returns: The created UsAppToPersonInstance """ + data = values.of( { "BrandRegistrationSid": brand_registration_sid, @@ -349,6 +527,9 @@ def create( "OptInKeywords": serialize.map(opt_in_keywords, lambda e: e), "OptOutKeywords": serialize.map(opt_out_keywords, lambda e: e), "HelpKeywords": serialize.map(help_keywords, lambda e: e), + "SubscriberOptIn": subscriber_opt_in, + "AgeGated": age_gated, + "DirectLending": direct_lending, } ) @@ -379,6 +560,9 @@ async def create_async( opt_in_keywords: Union[List[str], object] = values.unset, opt_out_keywords: Union[List[str], object] = values.unset, help_keywords: Union[List[str], object] = values.unset, + subscriber_opt_in: Union[bool, object] = values.unset, + age_gated: Union[bool, object] = values.unset, + direct_lending: Union[bool, object] = values.unset, ) -> UsAppToPersonInstance: """ Asynchronously create the UsAppToPersonInstance @@ -396,9 +580,13 @@ async def create_async( :param opt_in_keywords: If end users can text in a keyword to start receiving messages from this campaign, those keywords must be provided. This field is required if end users can text in a keyword to start receiving messages from this campaign. Values must be alphanumeric. 255 character maximum. :param opt_out_keywords: End users should be able to text in a keyword to stop receiving messages from this campaign. Those keywords must be provided. This field is required if managing opt out keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). Values must be alphanumeric. 255 character maximum. :param help_keywords: End users should be able to text in a keyword to receive help. Those keywords must be provided as part of the campaign registration request. This field is required if managing help keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). Values must be alphanumeric. 255 character maximum. + :param subscriber_opt_in: A boolean that specifies whether campaign has Subscriber Optin or not. + :param age_gated: A boolean that specifies whether campaign is age gated or not. + :param direct_lending: A boolean that specifies whether campaign allows direct lending or not. :returns: The created UsAppToPersonInstance """ + data = values.of( { "BrandRegistrationSid": brand_registration_sid, @@ -414,6 +602,9 @@ async def create_async( "OptInKeywords": serialize.map(opt_in_keywords, lambda e: e), "OptOutKeywords": serialize.map(opt_out_keywords, lambda e: e), "HelpKeywords": serialize.map(help_keywords, lambda e: e), + "SubscriberOptIn": subscriber_opt_in, + "AgeGated": age_gated, + "DirectLending": direct_lending, } ) @@ -616,7 +807,7 @@ def get(self, sid: str) -> UsAppToPersonContext: """ Constructs a UsAppToPersonContext - :param sid: The SID of the US A2P Compliance resource to fetch `QE2c6890da8086d771620e9b13fadeba0b`. + :param sid: The SID of the US A2P Compliance resource to update `QE2c6890da8086d771620e9b13fadeba0b`. """ return UsAppToPersonContext( self._version, @@ -628,7 +819,7 @@ def __call__(self, sid: str) -> UsAppToPersonContext: """ Constructs a UsAppToPersonContext - :param sid: The SID of the US A2P Compliance resource to fetch `QE2c6890da8086d771620e9b13fadeba0b`. + :param sid: The SID of the US A2P Compliance resource to update `QE2c6890da8086d771620e9b13fadeba0b`. """ return UsAppToPersonContext( self._version, 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 2d77f51be..c4f513ab1 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 @@ -12,7 +12,8 @@ Do not edit the class manually. """ -from typing import Any, Dict, List, Optional +from typing import Any, Dict, List, Optional, Union +from twilio.base import values from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -29,7 +30,7 @@ def __init__( ): super().__init__(version) - self.us_app_to_person_usecases: Optional[List[object]] = payload.get( + self.us_app_to_person_usecases: Optional[List[Dict[str, object]]] = payload.get( "us_app_to_person_usecases" ) @@ -48,6 +49,7 @@ def __repr__(self) -> str: class UsAppToPersonUsecaseList(ListResource): + def __init__(self, version: Version, messaging_service_sid: str): """ Initialize the UsAppToPersonUsecaseList @@ -68,13 +70,22 @@ def __init__(self, version: Version, messaging_service_sid: str): ) ) - def fetch(self) -> UsAppToPersonUsecaseInstance: + def fetch( + self, brand_registration_sid: Union[str, object] = values.unset + ) -> UsAppToPersonUsecaseInstance: """ Asynchronously fetch the UsAppToPersonUsecaseInstance + :param brand_registration_sid: The unique string to identify the A2P brand. :returns: The fetched UsAppToPersonUsecaseInstance """ - payload = self._version.fetch(method="GET", uri=self._uri) + + params = values.of( + { + "BrandRegistrationSid": brand_registration_sid, + } + ) + payload = self._version.fetch(method="GET", uri=self._uri, params=params) return UsAppToPersonUsecaseInstance( self._version, @@ -82,13 +93,24 @@ def fetch(self) -> UsAppToPersonUsecaseInstance: messaging_service_sid=self._solution["messaging_service_sid"], ) - async def fetch_async(self) -> UsAppToPersonUsecaseInstance: + async def fetch_async( + self, brand_registration_sid: Union[str, object] = values.unset + ) -> UsAppToPersonUsecaseInstance: """ Asynchronously fetch the UsAppToPersonUsecaseInstance + :param brand_registration_sid: The unique string to identify the A2P brand. :returns: The fetched UsAppToPersonUsecaseInstance """ - payload = await self._version.fetch_async(method="GET", uri=self._uri) + + params = values.of( + { + "BrandRegistrationSid": brand_registration_sid, + } + ) + payload = await self._version.fetch_async( + method="GET", uri=self._uri, params=params + ) return UsAppToPersonUsecaseInstance( self._version, diff --git a/twilio/rest/messaging/v1/tollfree_verification.py b/twilio/rest/messaging/v1/tollfree_verification.py index b8ec79f00..af57cfc5f 100644 --- a/twilio/rest/messaging/v1/tollfree_verification.py +++ b/twilio/rest/messaging/v1/tollfree_verification.py @@ -23,6 +23,7 @@ class TollfreeVerificationInstance(InstanceResource): + class OptInType(object): VERBAL = "VERBAL" WEB_FORM = "WEB_FORM" @@ -70,6 +71,7 @@ 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. """ @@ -144,6 +146,7 @@ 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") @@ -167,6 +170,24 @@ 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 @@ -209,6 +230,7 @@ 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 @@ -233,6 +255,7 @@ 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 """ @@ -257,6 +280,7 @@ 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( @@ -283,6 +307,7 @@ 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 @@ -307,6 +332,7 @@ 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 """ @@ -331,6 +357,7 @@ 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: @@ -344,6 +371,7 @@ def __repr__(self) -> str: class TollfreeVerificationContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the TollfreeVerificationContext @@ -359,6 +387,30 @@ 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 @@ -421,6 +473,7 @@ 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 @@ -445,6 +498,7 @@ 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 """ @@ -470,6 +524,7 @@ def update( "BusinessContactLastName": business_contact_last_name, "BusinessContactEmail": business_contact_email, "BusinessContactPhone": business_contact_phone, + "EditReason": edit_reason, } ) @@ -507,6 +562,7 @@ 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 @@ -531,6 +587,7 @@ 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 """ @@ -556,6 +613,7 @@ async def update_async( "BusinessContactLastName": business_contact_last_name, "BusinessContactEmail": business_contact_email, "BusinessContactPhone": business_contact_phone, + "EditReason": edit_reason, } ) @@ -580,6 +638,7 @@ def __repr__(self) -> str: class TollfreeVerificationPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> TollfreeVerificationInstance: """ Build an instance of TollfreeVerificationInstance @@ -598,6 +657,7 @@ def __repr__(self) -> str: class TollfreeVerificationList(ListResource): + def __init__(self, version: Version): """ Initialize the TollfreeVerificationList @@ -664,6 +724,7 @@ def create( :returns: The created TollfreeVerificationInstance """ + data = values.of( { "BusinessName": business_name, @@ -755,6 +816,7 @@ 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 0b35400e4..d7223f363 100644 --- a/twilio/rest/messaging/v1/usecase.py +++ b/twilio/rest/messaging/v1/usecase.py @@ -27,7 +27,7 @@ class UsecaseInstance(InstanceResource): def __init__(self, version: Version, payload: Dict[str, Any]): super().__init__(version) - self.usecases: Optional[List[object]] = payload.get("usecases") + self.usecases: Optional[List[Dict[str, object]]] = payload.get("usecases") def __repr__(self) -> str: """ @@ -40,6 +40,7 @@ def __repr__(self) -> str: class UsecaseList(ListResource): + def __init__(self, version: Version): """ Initialize the UsecaseList @@ -55,8 +56,10 @@ 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) @@ -65,8 +68,10 @@ 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/MicrovisorBase.py b/twilio/rest/microvisor/MicrovisorBase.py index 57a4c50f5..e8c874b92 100644 --- a/twilio/rest/microvisor/MicrovisorBase.py +++ b/twilio/rest/microvisor/MicrovisorBase.py @@ -17,6 +17,7 @@ class MicrovisorBase(Domain): + def __init__(self, twilio: Client): """ Initialize the Microvisor Domain diff --git a/twilio/rest/microvisor/v1/__init__.py b/twilio/rest/microvisor/v1/__init__.py index d47ed845b..22010d62e 100644 --- a/twilio/rest/microvisor/v1/__init__.py +++ b/twilio/rest/microvisor/v1/__init__.py @@ -22,6 +22,7 @@ class V1(Version): + def __init__(self, domain: Domain): """ Initialize the V1 version of Microvisor diff --git a/twilio/rest/microvisor/v1/account_config.py b/twilio/rest/microvisor/v1/account_config.py index 03198f6f6..3d37b01cd 100644 --- a/twilio/rest/microvisor/v1/account_config.py +++ b/twilio/rest/microvisor/v1/account_config.py @@ -133,6 +133,7 @@ def __repr__(self) -> str: class AccountConfigContext(InstanceContext): + def __init__(self, version: Version, key: str): """ Initialize the AccountConfigContext @@ -265,6 +266,7 @@ def __repr__(self) -> str: class AccountConfigPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> AccountConfigInstance: """ Build an instance of AccountConfigInstance @@ -283,6 +285,7 @@ def __repr__(self) -> str: class AccountConfigList(ListResource): + def __init__(self, version: Version): """ Initialize the AccountConfigList @@ -303,6 +306,7 @@ def create(self, key: str, value: str) -> AccountConfigInstance: :returns: The created AccountConfigInstance """ + data = values.of( { "Key": key, @@ -327,6 +331,7 @@ 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 d4012b3b1..cca0e1d77 100644 --- a/twilio/rest/microvisor/v1/account_secret.py +++ b/twilio/rest/microvisor/v1/account_secret.py @@ -131,6 +131,7 @@ def __repr__(self) -> str: class AccountSecretContext(InstanceContext): + def __init__(self, version: Version, key: str): """ Initialize the AccountSecretContext @@ -263,6 +264,7 @@ def __repr__(self) -> str: class AccountSecretPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> AccountSecretInstance: """ Build an instance of AccountSecretInstance @@ -281,6 +283,7 @@ def __repr__(self) -> str: class AccountSecretList(ListResource): + def __init__(self, version: Version): """ Initialize the AccountSecretList @@ -301,6 +304,7 @@ def create(self, key: str, value: str) -> AccountSecretInstance: :returns: The created AccountSecretInstance """ + data = values.of( { "Key": key, @@ -325,6 +329,7 @@ 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/app/__init__.py b/twilio/rest/microvisor/v1/app/__init__.py index 517e523c7..0c91fe3c5 100644 --- a/twilio/rest/microvisor/v1/app/__init__.py +++ b/twilio/rest/microvisor/v1/app/__init__.py @@ -127,6 +127,7 @@ def __repr__(self) -> str: class AppContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the AppContext @@ -229,6 +230,7 @@ def __repr__(self) -> str: class AppPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> AppInstance: """ Build an instance of AppInstance @@ -247,6 +249,7 @@ def __repr__(self) -> str: class AppList(ListResource): + def __init__(self, version: Version): """ Initialize the AppList diff --git a/twilio/rest/microvisor/v1/app/app_manifest.py b/twilio/rest/microvisor/v1/app/app_manifest.py index 143154b32..4f9eab075 100644 --- a/twilio/rest/microvisor/v1/app/app_manifest.py +++ b/twilio/rest/microvisor/v1/app/app_manifest.py @@ -84,6 +84,7 @@ def __repr__(self) -> str: class AppManifestContext(InstanceContext): + def __init__(self, version: Version, app_sid: str): """ Initialize the AppManifestContext @@ -148,6 +149,7 @@ def __repr__(self) -> str: class AppManifestList(ListResource): + def __init__(self, version: Version, app_sid: str): """ Initialize the AppManifestList diff --git a/twilio/rest/microvisor/v1/device/__init__.py b/twilio/rest/microvisor/v1/device/__init__.py index 0a6bea2d6..56904ee1f 100644 --- a/twilio/rest/microvisor/v1/device/__init__.py +++ b/twilio/rest/microvisor/v1/device/__init__.py @@ -167,6 +167,7 @@ def __repr__(self) -> str: class DeviceContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the DeviceContext @@ -326,6 +327,7 @@ def __repr__(self) -> str: class DevicePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> DeviceInstance: """ Build an instance of DeviceInstance @@ -344,6 +346,7 @@ def __repr__(self) -> str: class DeviceList(ListResource): + def __init__(self, version: Version): """ Initialize the DeviceList diff --git a/twilio/rest/microvisor/v1/device/device_config.py b/twilio/rest/microvisor/v1/device/device_config.py index 0b027ecb5..3607e971f 100644 --- a/twilio/rest/microvisor/v1/device/device_config.py +++ b/twilio/rest/microvisor/v1/device/device_config.py @@ -141,6 +141,7 @@ def __repr__(self) -> str: class DeviceConfigContext(InstanceContext): + def __init__(self, version: Version, device_sid: str, key: str): """ Initialize the DeviceConfigContext @@ -287,6 +288,7 @@ def __repr__(self) -> str: class DeviceConfigPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> DeviceConfigInstance: """ Build an instance of DeviceConfigInstance @@ -307,6 +309,7 @@ def __repr__(self) -> str: class DeviceConfigList(ListResource): + def __init__(self, version: Version, device_sid: str): """ Initialize the DeviceConfigList @@ -332,6 +335,7 @@ def create(self, key: str, value: str) -> DeviceConfigInstance: :returns: The created DeviceConfigInstance """ + data = values.of( { "Key": key, @@ -358,6 +362,7 @@ 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 2f1f1add7..0ab9b1c72 100644 --- a/twilio/rest/microvisor/v1/device/device_secret.py +++ b/twilio/rest/microvisor/v1/device/device_secret.py @@ -139,6 +139,7 @@ def __repr__(self) -> str: class DeviceSecretContext(InstanceContext): + def __init__(self, version: Version, device_sid: str, key: str): """ Initialize the DeviceSecretContext @@ -285,6 +286,7 @@ def __repr__(self) -> str: class DeviceSecretPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> DeviceSecretInstance: """ Build an instance of DeviceSecretInstance @@ -305,6 +307,7 @@ def __repr__(self) -> str: class DeviceSecretList(ListResource): + def __init__(self, version: Version, device_sid: str): """ Initialize the DeviceSecretList @@ -330,6 +333,7 @@ def create(self, key: str, value: str) -> DeviceSecretInstance: :returns: The created DeviceSecretInstance """ + data = values.of( { "Key": key, @@ -356,6 +360,7 @@ async def create_async(self, key: str, value: str) -> DeviceSecretInstance: :returns: The created DeviceSecretInstance """ + data = values.of( { "Key": key, diff --git a/twilio/rest/monitor/MonitorBase.py b/twilio/rest/monitor/MonitorBase.py index d63580761..4c5c6ebcd 100644 --- a/twilio/rest/monitor/MonitorBase.py +++ b/twilio/rest/monitor/MonitorBase.py @@ -17,6 +17,7 @@ class MonitorBase(Domain): + def __init__(self, twilio: Client): """ Initialize the Monitor Domain diff --git a/twilio/rest/monitor/v1/__init__.py b/twilio/rest/monitor/v1/__init__.py index fcf06738f..e892612b3 100644 --- a/twilio/rest/monitor/v1/__init__.py +++ b/twilio/rest/monitor/v1/__init__.py @@ -20,6 +20,7 @@ class V1(Version): + def __init__(self, domain: Domain): """ Initialize the V1 version of Monitor diff --git a/twilio/rest/monitor/v1/alert.py b/twilio/rest/monitor/v1/alert.py index e531f58e7..ef8cf39dd 100644 --- a/twilio/rest/monitor/v1/alert.py +++ b/twilio/rest/monitor/v1/alert.py @@ -125,6 +125,7 @@ def __repr__(self) -> str: class AlertContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the AlertContext @@ -189,6 +190,7 @@ def __repr__(self) -> str: class AlertPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> AlertInstance: """ Build an instance of AlertInstance @@ -207,6 +209,7 @@ def __repr__(self) -> str: class AlertList(ListResource): + def __init__(self, version: Version): """ Initialize the AlertList diff --git a/twilio/rest/monitor/v1/event.py b/twilio/rest/monitor/v1/event.py index 7a810bd6c..6b67a9c02 100644 --- a/twilio/rest/monitor/v1/event.py +++ b/twilio/rest/monitor/v1/event.py @@ -111,6 +111,7 @@ def __repr__(self) -> str: class EventContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the EventContext @@ -175,6 +176,7 @@ def __repr__(self) -> str: class EventPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> EventInstance: """ Build an instance of EventInstance @@ -193,6 +195,7 @@ def __repr__(self) -> str: class EventList(ListResource): + def __init__(self, version: Version): """ Initialize the EventList diff --git a/twilio/rest/notify/NotifyBase.py b/twilio/rest/notify/NotifyBase.py index d8a79bed6..2772ed095 100644 --- a/twilio/rest/notify/NotifyBase.py +++ b/twilio/rest/notify/NotifyBase.py @@ -17,6 +17,7 @@ class NotifyBase(Domain): + def __init__(self, twilio: Client): """ Initialize the Notify Domain diff --git a/twilio/rest/notify/v1/__init__.py b/twilio/rest/notify/v1/__init__.py index 91942a4f7..90cab9502 100644 --- a/twilio/rest/notify/v1/__init__.py +++ b/twilio/rest/notify/v1/__init__.py @@ -20,6 +20,7 @@ class V1(Version): + def __init__(self, domain: Domain): """ Initialize the V1 version of Notify diff --git a/twilio/rest/notify/v1/credential.py b/twilio/rest/notify/v1/credential.py index bd895da81..3dd6380ce 100644 --- a/twilio/rest/notify/v1/credential.py +++ b/twilio/rest/notify/v1/credential.py @@ -23,6 +23,7 @@ class CredentialInstance(InstanceResource): + class PushService(object): GCM = "gcm" APN = "apn" @@ -184,6 +185,7 @@ def __repr__(self) -> str: class CredentialContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the CredentialContext @@ -352,6 +354,7 @@ def __repr__(self) -> str: class CredentialPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> CredentialInstance: """ Build an instance of CredentialInstance @@ -370,6 +373,7 @@ def __repr__(self) -> str: class CredentialList(ListResource): + def __init__(self, version: Version): """ Initialize the CredentialList @@ -404,6 +408,7 @@ def create( :returns: The created CredentialInstance """ + data = values.of( { "Type": type, @@ -447,6 +452,7 @@ 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 7a9f3f730..912d6ba9c 100644 --- a/twilio/rest/notify/v1/service/__init__.py +++ b/twilio/rest/notify/v1/service/__init__.py @@ -34,7 +34,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/send-messages#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/quickstart#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. @@ -169,7 +169,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/send-messages#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/quickstart#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. @@ -223,7 +223,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/send-messages#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/quickstart#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. @@ -279,6 +279,7 @@ def __repr__(self) -> str: class ServiceContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the ServiceContext @@ -382,7 +383,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/send-messages#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/quickstart#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. @@ -446,7 +447,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/send-messages#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/quickstart#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. @@ -522,6 +523,7 @@ def __repr__(self) -> str: class ServicePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ServiceInstance: """ Build an instance of ServiceInstance @@ -540,6 +542,7 @@ def __repr__(self) -> str: class ServiceList(ListResource): + def __init__(self, version: Version): """ Initialize the ServiceList @@ -574,7 +577,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/send-messages#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/quickstart#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. @@ -588,6 +591,7 @@ def create( :returns: The created ServiceInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -638,7 +642,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/send-messages#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/quickstart#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. @@ -652,6 +656,7 @@ 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 52a800f33..a6b1e3f08 100644 --- a/twilio/rest/notify/v1/service/binding.py +++ b/twilio/rest/notify/v1/service/binding.py @@ -23,6 +23,7 @@ class BindingInstance(InstanceResource): + class BindingType(object): APN = "apn" GCM = "gcm" @@ -147,6 +148,7 @@ def __repr__(self) -> str: class BindingContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the BindingContext @@ -239,6 +241,7 @@ def __repr__(self) -> str: class BindingPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> BindingInstance: """ Build an instance of BindingInstance @@ -259,6 +262,7 @@ def __repr__(self) -> str: class BindingList(ListResource): + def __init__(self, version: Version, service_sid: str): """ Initialize the BindingList @@ -298,6 +302,7 @@ def create( :returns: The created BindingInstance """ + data = values.of( { "Identity": identity, @@ -343,6 +348,7 @@ 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 5d5106b2c..e2482be10 100644 --- a/twilio/rest/notify/v1/service/notification.py +++ b/twilio/rest/notify/v1/service/notification.py @@ -22,6 +22,7 @@ class NotificationInstance(InstanceResource): + class Priority(object): HIGH = "high" LOW = "low" @@ -94,6 +95,7 @@ def __repr__(self) -> str: class NotificationList(ListResource): + def __init__(self, version: Version, service_sid: str): """ Initialize the NotificationList @@ -143,7 +145,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/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 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 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. @@ -155,6 +157,7 @@ def create( :returns: The created NotificationInstance """ + data = values.of( { "Body": body, @@ -221,7 +224,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/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 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 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. @@ -233,6 +236,7 @@ async def create_async( :returns: The created NotificationInstance """ + data = values.of( { "Body": body, diff --git a/twilio/rest/numbers/NumbersBase.py b/twilio/rest/numbers/NumbersBase.py index b5c1e0432..7b9e08638 100644 --- a/twilio/rest/numbers/NumbersBase.py +++ b/twilio/rest/numbers/NumbersBase.py @@ -18,6 +18,7 @@ class NumbersBase(Domain): + def __init__(self, twilio: Client): """ Initialize the Numbers Domain diff --git a/twilio/rest/numbers/v1/__init__.py b/twilio/rest/numbers/v1/__init__.py index e7ee222a4..384b0d95e 100644 --- a/twilio/rest/numbers/v1/__init__.py +++ b/twilio/rest/numbers/v1/__init__.py @@ -17,10 +17,12 @@ 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 class V1(Version): + def __init__(self, domain: Domain): """ Initialize the V1 version of Numbers @@ -30,6 +32,7 @@ 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 @@ -44,6 +47,12 @@ 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 acd8d3ecf..64be314b4 100644 --- a/twilio/rest/numbers/v1/bulk_eligibility.py +++ b/twilio/rest/numbers/v1/bulk_eligibility.py @@ -42,7 +42,7 @@ def __init__( self.request_id: Optional[str] = payload.get("request_id") self.url: Optional[str] = payload.get("url") - self.results: Optional[List[object]] = payload.get("results") + self.results: Optional[List[Dict[str, 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( @@ -101,6 +101,7 @@ def __repr__(self) -> str: class BulkEligibilityContext(InstanceContext): + def __init__(self, version: Version, request_id: str): """ Initialize the BulkEligibilityContext @@ -167,6 +168,7 @@ def __repr__(self) -> str: class BulkEligibilityList(ListResource): + def __init__(self, version: Version): """ Initialize the BulkEligibilityList diff --git a/twilio/rest/numbers/v1/porting_bulk_portability.py b/twilio/rest/numbers/v1/porting_bulk_portability.py index 20e47ca6d..c3fedcd5b 100644 --- a/twilio/rest/numbers/v1/porting_bulk_portability.py +++ b/twilio/rest/numbers/v1/porting_bulk_portability.py @@ -22,6 +22,7 @@ class PortingBulkPortabilityInstance(InstanceResource): + class Status(object): IN_PROGRESS = "in-progress" COMPLETED = "completed" @@ -47,7 +48,9 @@ def __init__( self.datetime_created: Optional[datetime] = deserialize.iso8601_datetime( payload.get("datetime_created") ) - self.phone_numbers: Optional[List[object]] = payload.get("phone_numbers") + self.phone_numbers: Optional[List[Dict[str, object]]] = payload.get( + "phone_numbers" + ) self.url: Optional[str] = payload.get("url") self._solution = { @@ -99,6 +102,7 @@ def __repr__(self) -> str: class PortingBulkPortabilityContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the PortingBulkPortabilityContext @@ -163,6 +167,7 @@ def __repr__(self) -> str: class PortingBulkPortabilityList(ListResource): + def __init__(self, version: Version): """ Initialize the PortingBulkPortabilityList @@ -182,6 +187,7 @@ def create(self, phone_numbers: List[str]) -> PortingBulkPortabilityInstance: :returns: The created PortingBulkPortabilityInstance """ + data = values.of( { "PhoneNumbers": serialize.map(phone_numbers, lambda e: e), @@ -206,6 +212,7 @@ 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 new file mode 100644 index 000000000..78e31afbd --- /dev/null +++ b/twilio/rest/numbers/v1/porting_port_in_fetch.py @@ -0,0 +1,219 @@ +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/v1/porting_portability.py b/twilio/rest/numbers/v1/porting_portability.py index c2f3398c8..f1cf0cb8c 100644 --- a/twilio/rest/numbers/v1/porting_portability.py +++ b/twilio/rest/numbers/v1/porting_portability.py @@ -21,6 +21,7 @@ class PortingPortabilityInstance(InstanceResource): + class NumberType(object): LOCAL = "LOCAL" UNKNOWN = "UNKNOWN" @@ -126,6 +127,7 @@ def __repr__(self) -> str: class PortingPortabilityContext(InstanceContext): + def __init__(self, version: Version, phone_number: str): """ Initialize the PortingPortabilityContext @@ -206,6 +208,7 @@ def __repr__(self) -> str: class PortingPortabilityList(ListResource): + def __init__(self, version: Version): """ Initialize the PortingPortabilityList diff --git a/twilio/rest/numbers/v2/__init__.py b/twilio/rest/numbers/v2/__init__.py index 149e7a869..9b5b50154 100644 --- a/twilio/rest/numbers/v2/__init__.py +++ b/twilio/rest/numbers/v2/__init__.py @@ -22,6 +22,7 @@ class V2(Version): + def __init__(self, domain: Domain): """ Initialize the V2 version of Numbers diff --git a/twilio/rest/numbers/v2/authorization_document/__init__.py b/twilio/rest/numbers/v2/authorization_document/__init__.py index 2456debf6..7e0a4d918 100644 --- a/twilio/rest/numbers/v2/authorization_document/__init__.py +++ b/twilio/rest/numbers/v2/authorization_document/__init__.py @@ -26,6 +26,7 @@ class AuthorizationDocumentInstance(InstanceResource): + class Status(object): OPENED = "opened" SIGNING = "signing" @@ -140,6 +141,7 @@ def __repr__(self) -> str: class AuthorizationDocumentContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the AuthorizationDocumentContext @@ -246,6 +248,7 @@ def __repr__(self) -> str: class AuthorizationDocumentPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> AuthorizationDocumentInstance: """ Build an instance of AuthorizationDocumentInstance @@ -264,6 +267,7 @@ def __repr__(self) -> str: class AuthorizationDocumentList(ListResource): + def __init__(self, version: Version): """ Initialize the AuthorizationDocumentList @@ -296,6 +300,7 @@ def create( :returns: The created AuthorizationDocumentInstance """ + data = values.of( { "AddressSid": address_sid, @@ -338,6 +343,7 @@ async def create_async( :returns: The created AuthorizationDocumentInstance """ + data = values.of( { "AddressSid": address_sid, diff --git a/twilio/rest/numbers/v2/authorization_document/dependent_hosted_number_order.py b/twilio/rest/numbers/v2/authorization_document/dependent_hosted_number_order.py index 013b12874..7fc558fee 100644 --- a/twilio/rest/numbers/v2/authorization_document/dependent_hosted_number_order.py +++ b/twilio/rest/numbers/v2/authorization_document/dependent_hosted_number_order.py @@ -23,6 +23,7 @@ class DependentHostedNumberOrderInstance(InstanceResource): + class Status(object): RECEIVED = "received" VERIFIED = "verified" @@ -104,6 +105,7 @@ def __repr__(self) -> str: class DependentHostedNumberOrderPage(Page): + def get_instance( self, payload: Dict[str, Any] ) -> DependentHostedNumberOrderInstance: @@ -128,6 +130,7 @@ def __repr__(self) -> str: class DependentHostedNumberOrderList(ListResource): + def __init__(self, version: Version, signing_document_sid: str): """ Initialize the DependentHostedNumberOrderList diff --git a/twilio/rest/numbers/v2/bulk_hosted_number_order.py b/twilio/rest/numbers/v2/bulk_hosted_number_order.py index 3a7383904..31f95814f 100644 --- a/twilio/rest/numbers/v2/bulk_hosted_number_order.py +++ b/twilio/rest/numbers/v2/bulk_hosted_number_order.py @@ -22,6 +22,7 @@ class BulkHostedNumberOrderInstance(InstanceResource): + class RequestStatus(object): QUEUED = "QUEUED" IN_PROGRESS = "IN_PROGRESS" @@ -63,7 +64,7 @@ def __init__( self.total_count: Optional[int] = deserialize.integer( payload.get("total_count") ) - self.results: Optional[List[object]] = payload.get("results") + self.results: Optional[List[Dict[str, object]]] = payload.get("results") self._solution = { "bulk_hosting_sid": bulk_hosting_sid or self.bulk_hosting_sid, @@ -124,6 +125,7 @@ def __repr__(self) -> str: class BulkHostedNumberOrderContext(InstanceContext): + def __init__(self, version: Version, bulk_hosting_sid: str): """ Initialize the BulkHostedNumberOrderContext @@ -204,6 +206,7 @@ def __repr__(self) -> str: class BulkHostedNumberOrderList(ListResource): + def __init__(self, version: Version): """ Initialize the BulkHostedNumberOrderList diff --git a/twilio/rest/numbers/v2/hosted_number_order.py b/twilio/rest/numbers/v2/hosted_number_order.py index 985faa1f1..c20fc517c 100644 --- a/twilio/rest/numbers/v2/hosted_number_order.py +++ b/twilio/rest/numbers/v2/hosted_number_order.py @@ -23,6 +23,7 @@ class HostedNumberOrderInstance(InstanceResource): + class Status(object): RECEIVED = "received" VERIFIED = "verified" @@ -156,6 +157,7 @@ def __repr__(self) -> str: class HostedNumberOrderContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the HostedNumberOrderContext @@ -244,6 +246,7 @@ def __repr__(self) -> str: class HostedNumberOrderPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> HostedNumberOrderInstance: """ Build an instance of HostedNumberOrderInstance @@ -262,6 +265,7 @@ def __repr__(self) -> str: class HostedNumberOrderList(ListResource): + def __init__(self, version: Version): """ Initialize the HostedNumberOrderList @@ -314,6 +318,7 @@ def create( :returns: The created HostedNumberOrderInstance """ + data = values.of( { "PhoneNumber": phone_number, @@ -384,6 +389,7 @@ async def create_async( :returns: The created HostedNumberOrderInstance """ + data = values.of( { "PhoneNumber": phone_number, diff --git a/twilio/rest/numbers/v2/regulatory_compliance/__init__.py b/twilio/rest/numbers/v2/regulatory_compliance/__init__.py index 10d88d813..189117d85 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/__init__.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/__init__.py @@ -31,6 +31,7 @@ class RegulatoryComplianceList(ListResource): + def __init__(self, version: Version): """ Initialize the RegulatoryComplianceList diff --git a/twilio/rest/numbers/v2/regulatory_compliance/bundle/__init__.py b/twilio/rest/numbers/v2/regulatory_compliance/bundle/__init__.py index 684259fc9..5e1eec5b1 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/bundle/__init__.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/bundle/__init__.py @@ -35,6 +35,7 @@ class BundleInstance(InstanceResource): + class EndUserType(object): INDIVIDUAL = "individual" BUSINESS = "business" @@ -237,6 +238,7 @@ def __repr__(self) -> str: class BundleContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the BundleContext @@ -446,6 +448,7 @@ def __repr__(self) -> str: class BundlePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> BundleInstance: """ Build an instance of BundleInstance @@ -464,6 +467,7 @@ def __repr__(self) -> str: class BundleList(ListResource): + def __init__(self, version: Version): """ Initialize the BundleList @@ -498,6 +502,7 @@ def create( :returns: The created BundleInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -541,6 +546,7 @@ 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 9af90f46d..a8cf77fd1 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/bundle/bundle_copy.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/bundle/bundle_copy.py @@ -23,6 +23,7 @@ class BundleCopyInstance(InstanceResource): + class Status(object): DRAFT = "draft" PENDING_REVIEW = "pending-review" @@ -79,6 +80,7 @@ def __repr__(self) -> str: class BundleCopyPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> BundleCopyInstance: """ Build an instance of BundleCopyInstance @@ -99,6 +101,7 @@ def __repr__(self) -> str: class BundleCopyList(ListResource): + def __init__(self, version: Version, bundle_sid: str): """ Initialize the BundleCopyList @@ -127,6 +130,7 @@ def create( :returns: The created BundleCopyInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -153,6 +157,7 @@ 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 8bfeae12e..39aae3b6e 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/bundle/evaluation.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/bundle/evaluation.py @@ -23,6 +23,7 @@ class EvaluationInstance(InstanceResource): + class Status(object): COMPLIANT = "compliant" NONCOMPLIANT = "noncompliant" @@ -52,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[object]] = payload.get("results") + self.results: Optional[List[Dict[str, object]]] = payload.get("results") self.date_created: Optional[datetime] = deserialize.iso8601_datetime( payload.get("date_created") ) @@ -109,6 +110,7 @@ def __repr__(self) -> str: class EvaluationContext(InstanceContext): + def __init__(self, version: Version, bundle_sid: str, sid: str): """ Initialize the EvaluationContext @@ -181,6 +183,7 @@ def __repr__(self) -> str: class EvaluationPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> EvaluationInstance: """ Build an instance of EvaluationInstance @@ -201,6 +204,7 @@ def __repr__(self) -> str: class EvaluationList(ListResource): + def __init__(self, version: Version, bundle_sid: str): """ Initialize the EvaluationList 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 1483cdb36..d22fc3139 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/bundle/item_assignment.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/bundle/item_assignment.py @@ -119,6 +119,7 @@ def __repr__(self) -> str: class ItemAssignmentContext(InstanceContext): + def __init__(self, version: Version, bundle_sid: str, sid: str): """ Initialize the ItemAssignmentContext @@ -215,6 +216,7 @@ def __repr__(self) -> str: class ItemAssignmentPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ItemAssignmentInstance: """ Build an instance of ItemAssignmentInstance @@ -235,6 +237,7 @@ def __repr__(self) -> str: class ItemAssignmentList(ListResource): + def __init__(self, version: Version, bundle_sid: str): """ Initialize the ItemAssignmentList @@ -261,6 +264,7 @@ def create(self, object_sid: str) -> ItemAssignmentInstance: :returns: The created ItemAssignmentInstance """ + data = values.of( { "ObjectSid": object_sid, @@ -285,6 +289,7 @@ 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 fcf31e953..09e2823ad 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/bundle/replace_items.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/bundle/replace_items.py @@ -22,6 +22,7 @@ class ReplaceItemsInstance(InstanceResource): + class Status(object): DRAFT = "draft" PENDING_REVIEW = "pending-review" @@ -78,6 +79,7 @@ def __repr__(self) -> str: class ReplaceItemsList(ListResource): + def __init__(self, version: Version, bundle_sid: str): """ Initialize the ReplaceItemsList @@ -104,6 +106,7 @@ def create(self, from_bundle_sid: str) -> ReplaceItemsInstance: :returns: The created ReplaceItemsInstance """ + data = values.of( { "FromBundleSid": from_bundle_sid, @@ -128,6 +131,7 @@ 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 bbc133b33..3f9e5ec85 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/end_user.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/end_user.py @@ -23,6 +23,7 @@ class EndUserInstance(InstanceResource): + class Type(object): INDIVIDUAL = "individual" BUSINESS = "business" @@ -159,6 +160,7 @@ def __repr__(self) -> str: class EndUserContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the EndUserContext @@ -303,6 +305,7 @@ def __repr__(self) -> str: class EndUserPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> EndUserInstance: """ Build an instance of EndUserInstance @@ -321,6 +324,7 @@ def __repr__(self) -> str: class EndUserList(ListResource): + def __init__(self, version: Version): """ Initialize the EndUserList @@ -347,6 +351,7 @@ def create( :returns: The created EndUserInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -378,6 +383,7 @@ 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 f9b8069ee..ba155575a 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/end_user_type.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/end_user_type.py @@ -38,7 +38,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[object]] = payload.get("fields") + self.fields: Optional[List[Dict[str, object]]] = payload.get("fields") self.url: Optional[str] = payload.get("url") self._solution = { @@ -90,6 +90,7 @@ def __repr__(self) -> str: class EndUserTypeContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the EndUserTypeContext @@ -154,6 +155,7 @@ def __repr__(self) -> str: class EndUserTypePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> EndUserTypeInstance: """ Build an instance of EndUserTypeInstance @@ -172,6 +174,7 @@ def __repr__(self) -> str: class EndUserTypeList(ListResource): + def __init__(self, version: Version): """ Initialize the EndUserTypeList diff --git a/twilio/rest/numbers/v2/regulatory_compliance/regulation.py b/twilio/rest/numbers/v2/regulatory_compliance/regulation.py index 2698bf0b4..9d9a50881 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/regulation.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/regulation.py @@ -22,6 +22,7 @@ class RegulationInstance(InstanceResource): + class EndUserType(object): INDIVIDUAL = "individual" BUSINESS = "business" @@ -100,6 +101,7 @@ def __repr__(self) -> str: class RegulationContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the RegulationContext @@ -164,6 +166,7 @@ def __repr__(self) -> str: class RegulationPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> RegulationInstance: """ Build an instance of RegulationInstance @@ -182,6 +185,7 @@ def __repr__(self) -> str: class RegulationList(ListResource): + def __init__(self, version: Version): """ Initialize the RegulationList diff --git a/twilio/rest/numbers/v2/regulatory_compliance/supporting_document.py b/twilio/rest/numbers/v2/regulatory_compliance/supporting_document.py index 236139eee..f2cd4e13d 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/supporting_document.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/supporting_document.py @@ -23,6 +23,7 @@ class SupportingDocumentInstance(InstanceResource): + class Status(object): DRAFT = "draft" PENDING_REVIEW = "pending-review" @@ -171,6 +172,7 @@ def __repr__(self) -> str: class SupportingDocumentContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the SupportingDocumentContext @@ -321,6 +323,7 @@ def __repr__(self) -> str: class SupportingDocumentPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> SupportingDocumentInstance: """ Build an instance of SupportingDocumentInstance @@ -339,6 +342,7 @@ def __repr__(self) -> str: class SupportingDocumentList(ListResource): + def __init__(self, version: Version): """ Initialize the SupportingDocumentList @@ -365,6 +369,7 @@ def create( :returns: The created SupportingDocumentInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -396,6 +401,7 @@ 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 907cc1924..0c7dc7b30 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/supporting_document_type.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/supporting_document_type.py @@ -38,7 +38,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[object]] = payload.get("fields") + self.fields: Optional[List[Dict[str, object]]] = payload.get("fields") self.url: Optional[str] = payload.get("url") self._solution = { @@ -90,6 +90,7 @@ def __repr__(self) -> str: class SupportingDocumentTypeContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the SupportingDocumentTypeContext @@ -156,6 +157,7 @@ def __repr__(self) -> str: class SupportingDocumentTypePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> SupportingDocumentTypeInstance: """ Build an instance of SupportingDocumentTypeInstance @@ -174,6 +176,7 @@ def __repr__(self) -> str: class SupportingDocumentTypeList(ListResource): + def __init__(self, version: Version): """ Initialize the SupportingDocumentTypeList diff --git a/twilio/rest/oauth/OauthBase.py b/twilio/rest/oauth/OauthBase.py deleted file mode 100644 index 3df051d0f..000000000 --- a/twilio/rest/oauth/OauthBase.py +++ /dev/null @@ -1,43 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - NOTE: This class is auto generated by OpenAPI Generator. - https://openapi-generator.tech - Do not edit the class manually. -""" - -from typing import Optional - -from twilio.base.domain import Domain -from twilio.rest import Client -from twilio.rest.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 deleted file mode 100644 index 36aaa90ff..000000000 --- a/twilio/rest/oauth/v1/__init__.py +++ /dev/null @@ -1,74 +0,0 @@ -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 deleted file mode 100644 index a50af2cad..000000000 --- a/twilio/rest/oauth/v1/device_code.py +++ /dev/null @@ -1,135 +0,0 @@ -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 deleted file mode 100644 index 5a45ae9d9..000000000 --- a/twilio/rest/oauth/v1/oauth.py +++ /dev/null @@ -1,165 +0,0 @@ -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 deleted file mode 100644 index 242f3b6d7..000000000 --- a/twilio/rest/oauth/v1/openid_discovery.py +++ /dev/null @@ -1,197 +0,0 @@ -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 deleted file mode 100644 index d3fd5888a..000000000 --- a/twilio/rest/oauth/v1/token.py +++ /dev/null @@ -1,166 +0,0 @@ -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/preview/PreviewBase.py b/twilio/rest/preview/PreviewBase.py index 73d5aac4b..6608a69a2 100644 --- a/twilio/rest/preview/PreviewBase.py +++ b/twilio/rest/preview/PreviewBase.py @@ -17,11 +17,11 @@ 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 class PreviewBase(Domain): + def __init__(self, twilio: Client): """ Initialize the Preview Domain @@ -33,7 +33,6 @@ 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 @@ -72,15 +71,6 @@ 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/__init__.py b/twilio/rest/preview/deployed_devices/__init__.py index 30d628856..795ee9656 100644 --- a/twilio/rest/preview/deployed_devices/__init__.py +++ b/twilio/rest/preview/deployed_devices/__init__.py @@ -19,6 +19,7 @@ class DeployedDevices(Version): + def __init__(self, domain: Domain): """ Initialize the DeployedDevices version of Preview diff --git a/twilio/rest/preview/deployed_devices/fleet/__init__.py b/twilio/rest/preview/deployed_devices/fleet/__init__.py index 1b6687963..0f5c28446 100644 --- a/twilio/rest/preview/deployed_devices/fleet/__init__.py +++ b/twilio/rest/preview/deployed_devices/fleet/__init__.py @@ -191,6 +191,7 @@ def __repr__(self) -> str: class FleetContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the FleetContext @@ -388,6 +389,7 @@ def __repr__(self) -> str: class FleetPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> FleetInstance: """ Build an instance of FleetInstance @@ -406,6 +408,7 @@ def __repr__(self) -> str: class FleetList(ListResource): + def __init__(self, version: Version): """ Initialize the FleetList @@ -425,6 +428,7 @@ def create(self, friendly_name: Union[str, object] = values.unset) -> FleetInsta :returns: The created FleetInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -449,6 +453,7 @@ 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 8b3a678d7..1511a0613 100644 --- a/twilio/rest/preview/deployed_devices/fleet/certificate.py +++ b/twilio/rest/preview/deployed_devices/fleet/certificate.py @@ -163,6 +163,7 @@ def __repr__(self) -> str: class CertificateContext(InstanceContext): + def __init__(self, version: Version, fleet_sid: str, sid: str): """ Initialize the CertificateContext @@ -321,6 +322,7 @@ def __repr__(self) -> str: class CertificatePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> CertificateInstance: """ Build an instance of CertificateInstance @@ -341,6 +343,7 @@ def __repr__(self) -> str: class CertificateList(ListResource): + def __init__(self, version: Version, fleet_sid: str): """ Initialize the CertificateList @@ -372,6 +375,7 @@ def create( :returns: The created CertificateInstance """ + data = values.of( { "CertificateData": certificate_data, @@ -405,6 +409,7 @@ 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 744867883..5c0d109ea 100644 --- a/twilio/rest/preview/deployed_devices/fleet/deployment.py +++ b/twilio/rest/preview/deployed_devices/fleet/deployment.py @@ -161,6 +161,7 @@ def __repr__(self) -> str: class DeploymentContext(InstanceContext): + def __init__(self, version: Version, fleet_sid: str, sid: str): """ Initialize the DeploymentContext @@ -319,6 +320,7 @@ def __repr__(self) -> str: class DeploymentPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> DeploymentInstance: """ Build an instance of DeploymentInstance @@ -339,6 +341,7 @@ def __repr__(self) -> str: class DeploymentList(ListResource): + def __init__(self, version: Version, fleet_sid: str): """ Initialize the DeploymentList @@ -368,6 +371,7 @@ def create( :returns: The created DeploymentInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -398,6 +402,7 @@ 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 554e257ed..8f2007491 100644 --- a/twilio/rest/preview/deployed_devices/fleet/device.py +++ b/twilio/rest/preview/deployed_devices/fleet/device.py @@ -183,6 +183,7 @@ def __repr__(self) -> str: class DeviceContext(InstanceContext): + def __init__(self, version: Version, fleet_sid: str, sid: str): """ Initialize the DeviceContext @@ -353,6 +354,7 @@ def __repr__(self) -> str: class DevicePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> DeviceInstance: """ Build an instance of DeviceInstance @@ -373,6 +375,7 @@ def __repr__(self) -> str: class DeviceList(ListResource): + def __init__(self, version: Version, fleet_sid: str): """ Initialize the DeviceList @@ -408,6 +411,7 @@ def create( :returns: The created DeviceInstance """ + data = values.of( { "UniqueName": unique_name, @@ -447,6 +451,7 @@ 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 dd96745e9..eabfc456c 100644 --- a/twilio/rest/preview/deployed_devices/fleet/key.py +++ b/twilio/rest/preview/deployed_devices/fleet/key.py @@ -163,6 +163,7 @@ def __repr__(self) -> str: class KeyContext(InstanceContext): + def __init__(self, version: Version, fleet_sid: str, sid: str): """ Initialize the KeyContext @@ -321,6 +322,7 @@ def __repr__(self) -> str: class KeyPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> KeyInstance: """ Build an instance of KeyInstance @@ -341,6 +343,7 @@ def __repr__(self) -> str: class KeyList(ListResource): + def __init__(self, version: Version, fleet_sid: str): """ Initialize the KeyList @@ -370,6 +373,7 @@ def create( :returns: The created KeyInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -400,6 +404,7 @@ async def create_async( :returns: The created KeyInstance """ + data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/preview/hosted_numbers/__init__.py b/twilio/rest/preview/hosted_numbers/__init__.py index fd4616042..7b3a767ee 100644 --- a/twilio/rest/preview/hosted_numbers/__init__.py +++ b/twilio/rest/preview/hosted_numbers/__init__.py @@ -22,6 +22,7 @@ class HostedNumbers(Version): + def __init__(self, domain: Domain): """ Initialize the HostedNumbers version of Preview diff --git a/twilio/rest/preview/hosted_numbers/authorization_document/__init__.py b/twilio/rest/preview/hosted_numbers/authorization_document/__init__.py index 9eaf9674b..162d0b11a 100644 --- a/twilio/rest/preview/hosted_numbers/authorization_document/__init__.py +++ b/twilio/rest/preview/hosted_numbers/authorization_document/__init__.py @@ -26,6 +26,7 @@ class AuthorizationDocumentInstance(InstanceResource): + class Status(object): OPENED = "opened" SIGNING = "signing" @@ -190,6 +191,7 @@ def __repr__(self) -> str: class AuthorizationDocumentContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the AuthorizationDocumentContext @@ -366,6 +368,7 @@ def __repr__(self) -> str: class AuthorizationDocumentPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> AuthorizationDocumentInstance: """ Build an instance of AuthorizationDocumentInstance @@ -384,6 +387,7 @@ def __repr__(self) -> str: class AuthorizationDocumentList(ListResource): + def __init__(self, version: Version): """ Initialize the AuthorizationDocumentList @@ -416,6 +420,7 @@ def create( :returns: The created AuthorizationDocumentInstance """ + data = values.of( { "HostedNumberOrderSids": serialize.map( @@ -458,6 +463,7 @@ async def create_async( :returns: The created AuthorizationDocumentInstance """ + data = values.of( { "HostedNumberOrderSids": serialize.map( diff --git a/twilio/rest/preview/hosted_numbers/authorization_document/dependent_hosted_number_order.py b/twilio/rest/preview/hosted_numbers/authorization_document/dependent_hosted_number_order.py index cf9b97577..35b67d71c 100644 --- a/twilio/rest/preview/hosted_numbers/authorization_document/dependent_hosted_number_order.py +++ b/twilio/rest/preview/hosted_numbers/authorization_document/dependent_hosted_number_order.py @@ -23,6 +23,7 @@ class DependentHostedNumberOrderInstance(InstanceResource): + class Status(object): RECEIVED = "received" PENDING_VERIFICATION = "pending-verification" @@ -124,6 +125,7 @@ def __repr__(self) -> str: class DependentHostedNumberOrderPage(Page): + def get_instance( self, payload: Dict[str, Any] ) -> DependentHostedNumberOrderInstance: @@ -148,6 +150,7 @@ def __repr__(self) -> str: class DependentHostedNumberOrderList(ListResource): + def __init__(self, version: Version, signing_document_sid: str): """ Initialize the DependentHostedNumberOrderList diff --git a/twilio/rest/preview/hosted_numbers/hosted_number_order.py b/twilio/rest/preview/hosted_numbers/hosted_number_order.py index d3a32b684..70b9f309b 100644 --- a/twilio/rest/preview/hosted_numbers/hosted_number_order.py +++ b/twilio/rest/preview/hosted_numbers/hosted_number_order.py @@ -23,6 +23,7 @@ class HostedNumberOrderInstance(InstanceResource): + class Status(object): RECEIVED = "received" PENDING_VERIFICATION = "pending-verification" @@ -266,6 +267,7 @@ def __repr__(self) -> str: class HostedNumberOrderContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the HostedNumberOrderContext @@ -468,6 +470,7 @@ def __repr__(self) -> str: class HostedNumberOrderPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> HostedNumberOrderInstance: """ Build an instance of HostedNumberOrderInstance @@ -486,6 +489,7 @@ def __repr__(self) -> str: class HostedNumberOrderList(ListResource): + def __init__(self, version: Version): """ Initialize the HostedNumberOrderList @@ -542,6 +546,7 @@ def create( :returns: The created HostedNumberOrderInstance """ + data = values.of( { "PhoneNumber": phone_number, @@ -617,6 +622,7 @@ async def create_async( :returns: The created HostedNumberOrderInstance """ + data = values.of( { "PhoneNumber": phone_number, diff --git a/twilio/rest/preview/marketplace/__init__.py b/twilio/rest/preview/marketplace/__init__.py index d12d3ab0a..fcc99a411 100644 --- a/twilio/rest/preview/marketplace/__init__.py +++ b/twilio/rest/preview/marketplace/__init__.py @@ -20,6 +20,7 @@ class Marketplace(Version): + def __init__(self, domain: Domain): """ Initialize the Marketplace version of Preview diff --git a/twilio/rest/preview/marketplace/available_add_on/__init__.py b/twilio/rest/preview/marketplace/available_add_on/__init__.py index 520cb0fbd..7743d8a8c 100644 --- a/twilio/rest/preview/marketplace/available_add_on/__init__.py +++ b/twilio/rest/preview/marketplace/available_add_on/__init__.py @@ -106,6 +106,7 @@ def __repr__(self) -> str: class AvailableAddOnContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the AvailableAddOnContext @@ -184,6 +185,7 @@ def __repr__(self) -> str: class AvailableAddOnPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> AvailableAddOnInstance: """ Build an instance of AvailableAddOnInstance @@ -202,6 +204,7 @@ def __repr__(self) -> str: class AvailableAddOnList(ListResource): + def __init__(self, version: Version): """ Initialize the AvailableAddOnList diff --git a/twilio/rest/preview/marketplace/available_add_on/available_add_on_extension.py b/twilio/rest/preview/marketplace/available_add_on/available_add_on_extension.py index 96ed8497c..d27b74cbf 100644 --- a/twilio/rest/preview/marketplace/available_add_on/available_add_on_extension.py +++ b/twilio/rest/preview/marketplace/available_add_on/available_add_on_extension.py @@ -100,6 +100,7 @@ def __repr__(self) -> str: class AvailableAddOnExtensionContext(InstanceContext): + def __init__(self, version: Version, available_add_on_sid: str, sid: str): """ Initialize the AvailableAddOnExtensionContext @@ -172,6 +173,7 @@ def __repr__(self) -> str: class AvailableAddOnExtensionPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> AvailableAddOnExtensionInstance: """ Build an instance of AvailableAddOnExtensionInstance @@ -194,6 +196,7 @@ def __repr__(self) -> str: class AvailableAddOnExtensionList(ListResource): + def __init__(self, version: Version, available_add_on_sid: str): """ Initialize the AvailableAddOnExtensionList diff --git a/twilio/rest/preview/marketplace/installed_add_on/__init__.py b/twilio/rest/preview/marketplace/installed_add_on/__init__.py index 019092aac..5a0530aef 100644 --- a/twilio/rest/preview/marketplace/installed_add_on/__init__.py +++ b/twilio/rest/preview/marketplace/installed_add_on/__init__.py @@ -169,6 +169,7 @@ def __repr__(self) -> str: class InstalledAddOnContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the InstalledAddOnContext @@ -327,6 +328,7 @@ def __repr__(self) -> str: class InstalledAddOnPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> InstalledAddOnInstance: """ Build an instance of InstalledAddOnInstance @@ -345,6 +347,7 @@ def __repr__(self) -> str: class InstalledAddOnList(ListResource): + def __init__(self, version: Version): """ Initialize the InstalledAddOnList @@ -373,6 +376,7 @@ def create( :returns: The created InstalledAddOnInstance """ + data = values.of( { "AvailableAddOnSid": available_add_on_sid, @@ -407,6 +411,7 @@ async def create_async( :returns: The created InstalledAddOnInstance """ + data = values.of( { "AvailableAddOnSid": available_add_on_sid, diff --git a/twilio/rest/preview/marketplace/installed_add_on/installed_add_on_extension.py b/twilio/rest/preview/marketplace/installed_add_on/installed_add_on_extension.py index 592adf0bf..a6002fa0d 100644 --- a/twilio/rest/preview/marketplace/installed_add_on/installed_add_on_extension.py +++ b/twilio/rest/preview/marketplace/installed_add_on/installed_add_on_extension.py @@ -126,6 +126,7 @@ def __repr__(self) -> str: class InstalledAddOnExtensionContext(InstanceContext): + def __init__(self, version: Version, installed_add_on_sid: str, sid: str): """ Initialize the InstalledAddOnExtensionContext @@ -252,6 +253,7 @@ def __repr__(self) -> str: class InstalledAddOnExtensionPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> InstalledAddOnExtensionInstance: """ Build an instance of InstalledAddOnExtensionInstance @@ -274,6 +276,7 @@ def __repr__(self) -> str: class InstalledAddOnExtensionList(ListResource): + def __init__(self, version: Version, installed_add_on_sid: str): """ Initialize the InstalledAddOnExtensionList diff --git a/twilio/rest/preview/sync/__init__.py b/twilio/rest/preview/sync/__init__.py index fad9f85c4..d84c79039 100644 --- a/twilio/rest/preview/sync/__init__.py +++ b/twilio/rest/preview/sync/__init__.py @@ -19,6 +19,7 @@ class Sync(Version): + def __init__(self, domain: Domain): """ Initialize the Sync version of Preview diff --git a/twilio/rest/preview/sync/service/__init__.py b/twilio/rest/preview/sync/service/__init__.py index 9bf53d775..e270895fb 100644 --- a/twilio/rest/preview/sync/service/__init__.py +++ b/twilio/rest/preview/sync/service/__init__.py @@ -197,6 +197,7 @@ def __repr__(self) -> str: class ServiceContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the ServiceContext @@ -393,6 +394,7 @@ def __repr__(self) -> str: class ServicePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ServiceInstance: """ Build an instance of ServiceInstance @@ -411,6 +413,7 @@ def __repr__(self) -> str: class ServiceList(ListResource): + def __init__(self, version: Version): """ Initialize the ServiceList @@ -439,6 +442,7 @@ def create( :returns: The created ServiceInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -473,6 +477,7 @@ 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 74e89faad..e7ab4ae8b 100644 --- a/twilio/rest/preview/sync/service/document/__init__.py +++ b/twilio/rest/preview/sync/service/document/__init__.py @@ -173,6 +173,7 @@ def __repr__(self) -> str: class DocumentContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the DocumentContext @@ -346,6 +347,7 @@ def __repr__(self) -> str: class DocumentPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> DocumentInstance: """ Build an instance of DocumentInstance @@ -366,6 +368,7 @@ def __repr__(self) -> str: class DocumentList(ListResource): + def __init__(self, version: Version, service_sid: str): """ Initialize the DocumentList @@ -395,6 +398,7 @@ def create( :returns: The created DocumentInstance """ + data = values.of( { "UniqueName": unique_name, @@ -425,6 +429,7 @@ async def create_async( :returns: The created DocumentInstance """ + data = values.of( { "UniqueName": unique_name, diff --git a/twilio/rest/preview/sync/service/document/document_permission.py b/twilio/rest/preview/sync/service/document/document_permission.py index a32903c5f..7439d3434 100644 --- a/twilio/rest/preview/sync/service/document/document_permission.py +++ b/twilio/rest/preview/sync/service/document/document_permission.py @@ -159,6 +159,7 @@ def __repr__(self) -> str: class DocumentPermissionContext(InstanceContext): + def __init__( self, version: Version, service_sid: str, document_sid: str, identity: str ): @@ -327,6 +328,7 @@ def __repr__(self) -> str: class DocumentPermissionPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> DocumentPermissionInstance: """ Build an instance of DocumentPermissionInstance @@ -350,6 +352,7 @@ def __repr__(self) -> str: class DocumentPermissionList(ListResource): + def __init__(self, version: Version, service_sid: str, document_sid: str): """ Initialize the DocumentPermissionList diff --git a/twilio/rest/preview/sync/service/sync_list/__init__.py b/twilio/rest/preview/sync/service/sync_list/__init__.py index 091650c44..fcd2f28ff 100644 --- a/twilio/rest/preview/sync/service/sync_list/__init__.py +++ b/twilio/rest/preview/sync/service/sync_list/__init__.py @@ -147,6 +147,7 @@ def __repr__(self) -> str: class SyncListContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the SyncListContext @@ -268,6 +269,7 @@ def __repr__(self) -> str: class SyncListPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> SyncListInstance: """ Build an instance of SyncListInstance @@ -288,6 +290,7 @@ def __repr__(self) -> str: class SyncListList(ListResource): + def __init__(self, version: Version, service_sid: str): """ Initialize the SyncListList @@ -314,6 +317,7 @@ def create( :returns: The created SyncListInstance """ + data = values.of( { "UniqueName": unique_name, @@ -340,6 +344,7 @@ 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 6308a983e..0cefd6c66 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 @@ -23,6 +23,7 @@ class SyncListItemInstance(InstanceResource): + class QueryFromBoundType(object): INCLUSIVE = "inclusive" EXCLUSIVE = "exclusive" @@ -178,6 +179,7 @@ def __repr__(self) -> str: class SyncListItemContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, list_sid: str, index: int): """ Initialize the SyncListItemContext @@ -354,6 +356,7 @@ def __repr__(self) -> str: class SyncListItemPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> SyncListItemInstance: """ Build an instance of SyncListItemInstance @@ -377,6 +380,7 @@ def __repr__(self) -> str: class SyncListItemList(ListResource): + def __init__(self, version: Version, service_sid: str, list_sid: str): """ Initialize the SyncListItemList @@ -405,6 +409,7 @@ def create(self, data: object) -> SyncListItemInstance: :returns: The created SyncListItemInstance """ + data = values.of( { "Data": serialize.object(data), @@ -432,6 +437,7 @@ 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_list/sync_list_permission.py b/twilio/rest/preview/sync/service/sync_list/sync_list_permission.py index 1752a9537..0f4f9e4b2 100644 --- a/twilio/rest/preview/sync/service/sync_list/sync_list_permission.py +++ b/twilio/rest/preview/sync/service/sync_list/sync_list_permission.py @@ -159,6 +159,7 @@ def __repr__(self) -> str: class SyncListPermissionContext(InstanceContext): + def __init__( self, version: Version, service_sid: str, list_sid: str, identity: str ): @@ -329,6 +330,7 @@ def __repr__(self) -> str: class SyncListPermissionPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> SyncListPermissionInstance: """ Build an instance of SyncListPermissionInstance @@ -352,6 +354,7 @@ def __repr__(self) -> str: class SyncListPermissionList(ListResource): + def __init__(self, version: Version, service_sid: str, list_sid: str): """ Initialize the SyncListPermissionList diff --git a/twilio/rest/preview/sync/service/sync_map/__init__.py b/twilio/rest/preview/sync/service/sync_map/__init__.py index 93fe825c7..1d7993624 100644 --- a/twilio/rest/preview/sync/service/sync_map/__init__.py +++ b/twilio/rest/preview/sync/service/sync_map/__init__.py @@ -147,6 +147,7 @@ def __repr__(self) -> str: class SyncMapContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the SyncMapContext @@ -268,6 +269,7 @@ def __repr__(self) -> str: class SyncMapPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> SyncMapInstance: """ Build an instance of SyncMapInstance @@ -288,6 +290,7 @@ def __repr__(self) -> str: class SyncMapList(ListResource): + def __init__(self, version: Version, service_sid: str): """ Initialize the SyncMapList @@ -312,6 +315,7 @@ def create(self, unique_name: Union[str, object] = values.unset) -> SyncMapInsta :returns: The created SyncMapInstance """ + data = values.of( { "UniqueName": unique_name, @@ -338,6 +342,7 @@ 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 8409fafd1..322c8ed22 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 @@ -23,6 +23,7 @@ class SyncMapItemInstance(InstanceResource): + class QueryFromBoundType(object): INCLUSIVE = "inclusive" EXCLUSIVE = "exclusive" @@ -178,6 +179,7 @@ def __repr__(self) -> str: class SyncMapItemContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, map_sid: str, key: str): """ Initialize the SyncMapItemContext @@ -354,6 +356,7 @@ def __repr__(self) -> str: class SyncMapItemPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> SyncMapItemInstance: """ Build an instance of SyncMapItemInstance @@ -377,6 +380,7 @@ def __repr__(self) -> str: class SyncMapItemList(ListResource): + def __init__(self, version: Version, service_sid: str, map_sid: str): """ Initialize the SyncMapItemList @@ -406,6 +410,7 @@ def create(self, key: str, data: object) -> SyncMapItemInstance: :returns: The created SyncMapItemInstance """ + data = values.of( { "Key": key, @@ -435,6 +440,7 @@ 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/sync/service/sync_map/sync_map_permission.py b/twilio/rest/preview/sync/service/sync_map/sync_map_permission.py index 83d4c87d9..999713e0e 100644 --- a/twilio/rest/preview/sync/service/sync_map/sync_map_permission.py +++ b/twilio/rest/preview/sync/service/sync_map/sync_map_permission.py @@ -159,6 +159,7 @@ def __repr__(self) -> str: class SyncMapPermissionContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, map_sid: str, identity: str): """ Initialize the SyncMapPermissionContext @@ -327,6 +328,7 @@ def __repr__(self) -> str: class SyncMapPermissionPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> SyncMapPermissionInstance: """ Build an instance of SyncMapPermissionInstance @@ -350,6 +352,7 @@ def __repr__(self) -> str: class SyncMapPermissionList(ListResource): + def __init__(self, version: Version, service_sid: str, map_sid: str): """ Initialize the SyncMapPermissionList diff --git a/twilio/rest/preview/understand/__init__.py b/twilio/rest/preview/understand/__init__.py deleted file mode 100644 index da659fd3a..000000000 --- a/twilio/rest/preview/understand/__init__.py +++ /dev/null @@ -1,42 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Preview - This is the public Twilio REST API. - - NOTE: This class is auto generated by OpenAPI Generator. - https://openapi-generator.tech - Do not edit the class manually. -""" - -from typing import Optional -from twilio.base.version import Version -from twilio.base.domain import Domain -from twilio.rest.preview.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 deleted file mode 100644 index 52235aa20..000000000 --- a/twilio/rest/preview/understand/assistant/__init__.py +++ /dev/null @@ -1,885 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Preview - This is the public Twilio REST API. - - NOTE: This class is auto generated by OpenAPI Generator. - https://openapi-generator.tech - Do not edit the class manually. -""" - -from datetime import datetime -from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, serialize, values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.version import Version -from twilio.base.page import Page -from twilio.rest.preview.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 deleted file mode 100644 index ca696d735..000000000 --- a/twilio/rest/preview/understand/assistant/assistant_fallback_actions.py +++ /dev/null @@ -1,277 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Preview - This is the public Twilio REST API. - - NOTE: This class is auto generated by OpenAPI Generator. - https://openapi-generator.tech - Do not edit the class manually. -""" - -from typing import Any, Dict, 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 deleted file mode 100644 index 051925df2..000000000 --- a/twilio/rest/preview/understand/assistant/assistant_initiation_actions.py +++ /dev/null @@ -1,281 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Preview - This is the public Twilio REST API. - - NOTE: This class is auto generated by OpenAPI Generator. - https://openapi-generator.tech - Do not edit the class manually. -""" - -from typing import Any, Dict, 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 deleted file mode 100644 index a9cf86a45..000000000 --- a/twilio/rest/preview/understand/assistant/dialogue.py +++ /dev/null @@ -1,208 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Preview - This is the public Twilio REST API. - - NOTE: This class is auto generated by OpenAPI Generator. - https://openapi-generator.tech - Do not edit the class manually. -""" - -from typing import Any, Dict, 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 deleted file mode 100644 index 18cc0ff73..000000000 --- a/twilio/rest/preview/understand/assistant/field_type/__init__.py +++ /dev/null @@ -1,652 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Preview - This is the public Twilio REST API. - - NOTE: This class is auto generated by OpenAPI Generator. - https://openapi-generator.tech - Do not edit the class manually. -""" - -from datetime import datetime -from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.version import Version -from twilio.base.page import Page -from twilio.rest.preview.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 deleted file mode 100644 index 58e70c4a7..000000000 --- a/twilio/rest/preview/understand/assistant/field_type/field_value.py +++ /dev/null @@ -1,575 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Preview - This is the public Twilio REST API. - - NOTE: This class is auto generated by OpenAPI Generator. - https://openapi-generator.tech - Do not edit the class manually. -""" - -from datetime import datetime -from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.version import Version -from twilio.base.page import Page - - -class 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 deleted file mode 100644 index bddcf37ba..000000000 --- a/twilio/rest/preview/understand/assistant/model_build.py +++ /dev/null @@ -1,626 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Preview - This is the public Twilio REST API. - - NOTE: This class is auto generated by OpenAPI Generator. - https://openapi-generator.tech - Do not edit the class manually. -""" - -from datetime import datetime -from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.version import Version -from twilio.base.page import Page - - -class 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 deleted file mode 100644 index 3fb1b114a..000000000 --- a/twilio/rest/preview/understand/assistant/query.py +++ /dev/null @@ -1,713 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Preview - This is the public Twilio REST API. - - NOTE: This class is auto generated by OpenAPI Generator. - https://openapi-generator.tech - Do not edit the class manually. -""" - -from datetime import datetime -from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.version import Version -from twilio.base.page import Page - - -class 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 deleted file mode 100644 index 881a658a4..000000000 --- a/twilio/rest/preview/understand/assistant/style_sheet.py +++ /dev/null @@ -1,271 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Preview - This is the public Twilio REST API. - - NOTE: This class is auto generated by OpenAPI Generator. - https://openapi-generator.tech - Do not edit the class manually. -""" - -from typing import Any, Dict, 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 deleted file mode 100644 index 0447151a0..000000000 --- a/twilio/rest/preview/understand/assistant/task/__init__.py +++ /dev/null @@ -1,758 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Preview - This is the public Twilio REST API. - - NOTE: This class is auto generated by OpenAPI Generator. - https://openapi-generator.tech - Do not edit the class manually. -""" - -from datetime import datetime -from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, serialize, values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.version import Version -from twilio.base.page import Page -from twilio.rest.preview.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 deleted file mode 100644 index 2d3ccb83c..000000000 --- a/twilio/rest/preview/understand/assistant/task/field.py +++ /dev/null @@ -1,547 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Preview - This is the public Twilio REST API. - - NOTE: This class is auto generated by OpenAPI Generator. - https://openapi-generator.tech - Do not edit the class manually. -""" - -from datetime import datetime -from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.version import Version -from twilio.base.page import Page - - -class 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 deleted file mode 100644 index 3c863c453..000000000 --- a/twilio/rest/preview/understand/assistant/task/sample.py +++ /dev/null @@ -1,695 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Preview - This is the public Twilio REST API. - - NOTE: This class is auto generated by OpenAPI Generator. - https://openapi-generator.tech - Do not edit the class manually. -""" - -from datetime import datetime -from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator -from twilio.base import deserialize, values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.version import Version -from twilio.base.page import Page - - -class 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 deleted file mode 100644 index 66dd0df4c..000000000 --- a/twilio/rest/preview/understand/assistant/task/task_actions.py +++ /dev/null @@ -1,299 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Preview - This is the public Twilio REST API. - - NOTE: This class is auto generated by OpenAPI Generator. - https://openapi-generator.tech - Do not edit the class manually. -""" - -from typing import Any, Dict, 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 deleted file mode 100644 index 2461406eb..000000000 --- a/twilio/rest/preview/understand/assistant/task/task_statistics.py +++ /dev/null @@ -1,219 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Preview - This is the public Twilio REST API. - - NOTE: This class is auto generated by OpenAPI Generator. - https://openapi-generator.tech - Do not edit the class manually. -""" - -from typing import Any, Dict, 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/__init__.py b/twilio/rest/preview/wireless/__init__.py index 24f2ea0f0..85ed4fb54 100644 --- a/twilio/rest/preview/wireless/__init__.py +++ b/twilio/rest/preview/wireless/__init__.py @@ -21,6 +21,7 @@ class Wireless(Version): + def __init__(self, domain: Domain): """ Initialize the Wireless version of Preview diff --git a/twilio/rest/preview/wireless/command.py b/twilio/rest/preview/wireless/command.py index 371f38c69..755256bb6 100644 --- a/twilio/rest/preview/wireless/command.py +++ b/twilio/rest/preview/wireless/command.py @@ -107,6 +107,7 @@ def __repr__(self) -> str: class CommandContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the CommandContext @@ -171,6 +172,7 @@ def __repr__(self) -> str: class CommandPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> CommandInstance: """ Build an instance of CommandInstance @@ -189,6 +191,7 @@ def __repr__(self) -> str: class CommandList(ListResource): + def __init__(self, version: Version): """ Initialize the CommandList @@ -223,6 +226,7 @@ def create( :returns: The created CommandInstance """ + data = values.of( { "Command": command, @@ -266,6 +270,7 @@ 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 88b29460e..abd9cbecc 100644 --- a/twilio/rest/preview/wireless/rate_plan.py +++ b/twilio/rest/preview/wireless/rate_plan.py @@ -171,6 +171,7 @@ def __repr__(self) -> str: class RatePlanContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the RatePlanContext @@ -315,6 +316,7 @@ def __repr__(self) -> str: class RatePlanPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> RatePlanInstance: """ Build an instance of RatePlanInstance @@ -333,6 +335,7 @@ def __repr__(self) -> str: class RatePlanList(ListResource): + def __init__(self, version: Version): """ Initialize the RatePlanList @@ -373,6 +376,7 @@ def create( :returns: The created RatePlanInstance """ + data = values.of( { "UniqueName": unique_name, @@ -427,6 +431,7 @@ async def create_async( :returns: The created RatePlanInstance """ + data = values.of( { "UniqueName": unique_name, diff --git a/twilio/rest/preview/wireless/sim/__init__.py b/twilio/rest/preview/wireless/sim/__init__.py index 79b633cce..8620c03ba 100644 --- a/twilio/rest/preview/wireless/sim/__init__.py +++ b/twilio/rest/preview/wireless/sim/__init__.py @@ -259,6 +259,7 @@ def __repr__(self) -> str: class SimContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the SimContext @@ -477,6 +478,7 @@ def __repr__(self) -> str: class SimPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> SimInstance: """ Build an instance of SimInstance @@ -495,6 +497,7 @@ def __repr__(self) -> str: class SimList(ListResource): + def __init__(self, version: Version): """ Initialize the SimList diff --git a/twilio/rest/preview/wireless/sim/usage.py b/twilio/rest/preview/wireless/sim/usage.py index aa3dd0ac8..d90b5f9e8 100644 --- a/twilio/rest/preview/wireless/sim/usage.py +++ b/twilio/rest/preview/wireless/sim/usage.py @@ -113,6 +113,7 @@ def __repr__(self) -> str: class UsageContext(InstanceContext): + def __init__(self, version: Version, sim_sid: str): """ Initialize the UsageContext @@ -199,6 +200,7 @@ def __repr__(self) -> str: class UsageList(ListResource): + def __init__(self, version: Version, sim_sid: str): """ Initialize the UsageList diff --git a/twilio/rest/pricing/PricingBase.py b/twilio/rest/pricing/PricingBase.py index 35028ee35..cf624e186 100644 --- a/twilio/rest/pricing/PricingBase.py +++ b/twilio/rest/pricing/PricingBase.py @@ -18,6 +18,7 @@ class PricingBase(Domain): + def __init__(self, twilio: Client): """ Initialize the Pricing Domain diff --git a/twilio/rest/pricing/v1/__init__.py b/twilio/rest/pricing/v1/__init__.py index 2227d163d..ba8b65885 100644 --- a/twilio/rest/pricing/v1/__init__.py +++ b/twilio/rest/pricing/v1/__init__.py @@ -21,6 +21,7 @@ class V1(Version): + def __init__(self, domain: Domain): """ Initialize the V1 version of Pricing diff --git a/twilio/rest/pricing/v1/messaging/__init__.py b/twilio/rest/pricing/v1/messaging/__init__.py index 5b7807405..df5c148b8 100644 --- a/twilio/rest/pricing/v1/messaging/__init__.py +++ b/twilio/rest/pricing/v1/messaging/__init__.py @@ -22,6 +22,7 @@ class MessagingList(ListResource): + def __init__(self, version: Version): """ Initialize the MessagingList diff --git a/twilio/rest/pricing/v1/messaging/country.py b/twilio/rest/pricing/v1/messaging/country.py index 39c6bcfdb..47f5707ce 100644 --- a/twilio/rest/pricing/v1/messaging/country.py +++ b/twilio/rest/pricing/v1/messaging/country.py @@ -97,6 +97,7 @@ def __repr__(self) -> str: class CountryContext(InstanceContext): + def __init__(self, version: Version, iso_country: str): """ Initialize the CountryContext @@ -161,6 +162,7 @@ def __repr__(self) -> str: class CountryPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> CountryInstance: """ Build an instance of CountryInstance @@ -179,6 +181,7 @@ def __repr__(self) -> str: class CountryList(ListResource): + def __init__(self, version: Version): """ Initialize the CountryList diff --git a/twilio/rest/pricing/v1/phone_number/__init__.py b/twilio/rest/pricing/v1/phone_number/__init__.py index 34b5ea757..429ce9b14 100644 --- a/twilio/rest/pricing/v1/phone_number/__init__.py +++ b/twilio/rest/pricing/v1/phone_number/__init__.py @@ -22,6 +22,7 @@ class PhoneNumberList(ListResource): + def __init__(self, version: Version): """ Initialize the PhoneNumberList diff --git a/twilio/rest/pricing/v1/phone_number/country.py b/twilio/rest/pricing/v1/phone_number/country.py index ac550bfd9..b0822fff2 100644 --- a/twilio/rest/pricing/v1/phone_number/country.py +++ b/twilio/rest/pricing/v1/phone_number/country.py @@ -95,6 +95,7 @@ def __repr__(self) -> str: class CountryContext(InstanceContext): + def __init__(self, version: Version, iso_country: str): """ Initialize the CountryContext @@ -159,6 +160,7 @@ def __repr__(self) -> str: class CountryPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> CountryInstance: """ Build an instance of CountryInstance @@ -177,6 +179,7 @@ def __repr__(self) -> str: class CountryList(ListResource): + def __init__(self, version: Version): """ Initialize the CountryList diff --git a/twilio/rest/pricing/v1/voice/__init__.py b/twilio/rest/pricing/v1/voice/__init__.py index 62a7acaf2..a801a3008 100644 --- a/twilio/rest/pricing/v1/voice/__init__.py +++ b/twilio/rest/pricing/v1/voice/__init__.py @@ -23,6 +23,7 @@ class VoiceList(ListResource): + def __init__(self, version: Version): """ Initialize the VoiceList diff --git a/twilio/rest/pricing/v1/voice/country.py b/twilio/rest/pricing/v1/voice/country.py index 7f8e48cf9..e3b1496de 100644 --- a/twilio/rest/pricing/v1/voice/country.py +++ b/twilio/rest/pricing/v1/voice/country.py @@ -99,6 +99,7 @@ def __repr__(self) -> str: class CountryContext(InstanceContext): + def __init__(self, version: Version, iso_country: str): """ Initialize the CountryContext @@ -163,6 +164,7 @@ def __repr__(self) -> str: class CountryPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> CountryInstance: """ Build an instance of CountryInstance @@ -181,6 +183,7 @@ def __repr__(self) -> str: class CountryList(ListResource): + def __init__(self, version: Version): """ Initialize the CountryList diff --git a/twilio/rest/pricing/v1/voice/number.py b/twilio/rest/pricing/v1/voice/number.py index 3e47c4888..910919707 100644 --- a/twilio/rest/pricing/v1/voice/number.py +++ b/twilio/rest/pricing/v1/voice/number.py @@ -92,6 +92,7 @@ def __repr__(self) -> str: class NumberContext(InstanceContext): + def __init__(self, version: Version, number: str): """ Initialize the NumberContext @@ -156,6 +157,7 @@ def __repr__(self) -> str: class NumberList(ListResource): + def __init__(self, version: Version): """ Initialize the NumberList diff --git a/twilio/rest/pricing/v2/__init__.py b/twilio/rest/pricing/v2/__init__.py index f034595cb..d0fd67f73 100644 --- a/twilio/rest/pricing/v2/__init__.py +++ b/twilio/rest/pricing/v2/__init__.py @@ -21,6 +21,7 @@ class V2(Version): + def __init__(self, domain: Domain): """ Initialize the V2 version of Pricing diff --git a/twilio/rest/pricing/v2/country.py b/twilio/rest/pricing/v2/country.py index f94b6f1cb..a058c071b 100644 --- a/twilio/rest/pricing/v2/country.py +++ b/twilio/rest/pricing/v2/country.py @@ -99,6 +99,7 @@ def __repr__(self) -> str: class CountryContext(InstanceContext): + def __init__(self, version: Version, iso_country: str): """ Initialize the CountryContext @@ -163,6 +164,7 @@ def __repr__(self) -> str: class CountryPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> CountryInstance: """ Build an instance of CountryInstance @@ -181,6 +183,7 @@ def __repr__(self) -> str: class CountryList(ListResource): + def __init__(self, version: Version): """ Initialize the CountryList diff --git a/twilio/rest/pricing/v2/number.py b/twilio/rest/pricing/v2/number.py index 8165f8870..6c4cd9fe9 100644 --- a/twilio/rest/pricing/v2/number.py +++ b/twilio/rest/pricing/v2/number.py @@ -112,6 +112,7 @@ def __repr__(self) -> str: class NumberContext(InstanceContext): + def __init__(self, version: Version, destination_number: str): """ Initialize the NumberContext @@ -190,6 +191,7 @@ def __repr__(self) -> str: class NumberList(ListResource): + def __init__(self, version: Version): """ Initialize the NumberList diff --git a/twilio/rest/pricing/v2/voice/__init__.py b/twilio/rest/pricing/v2/voice/__init__.py index 62279bebe..1ebbcbb64 100644 --- a/twilio/rest/pricing/v2/voice/__init__.py +++ b/twilio/rest/pricing/v2/voice/__init__.py @@ -23,6 +23,7 @@ class VoiceList(ListResource): + def __init__(self, version: Version): """ Initialize the VoiceList diff --git a/twilio/rest/pricing/v2/voice/country.py b/twilio/rest/pricing/v2/voice/country.py index 9364c7df3..4a84bbd73 100644 --- a/twilio/rest/pricing/v2/voice/country.py +++ b/twilio/rest/pricing/v2/voice/country.py @@ -99,6 +99,7 @@ def __repr__(self) -> str: class CountryContext(InstanceContext): + def __init__(self, version: Version, iso_country: str): """ Initialize the CountryContext @@ -163,6 +164,7 @@ def __repr__(self) -> str: class CountryPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> CountryInstance: """ Build an instance of CountryInstance @@ -181,6 +183,7 @@ def __repr__(self) -> str: class CountryList(ListResource): + def __init__(self, version: Version): """ Initialize the CountryList diff --git a/twilio/rest/pricing/v2/voice/number.py b/twilio/rest/pricing/v2/voice/number.py index e0fea643f..6dd876482 100644 --- a/twilio/rest/pricing/v2/voice/number.py +++ b/twilio/rest/pricing/v2/voice/number.py @@ -110,6 +110,7 @@ def __repr__(self) -> str: class NumberContext(InstanceContext): + def __init__(self, version: Version, destination_number: str): """ Initialize the NumberContext @@ -188,6 +189,7 @@ def __repr__(self) -> str: class NumberList(ListResource): + def __init__(self, version: Version): """ Initialize the NumberList diff --git a/twilio/rest/proxy/ProxyBase.py b/twilio/rest/proxy/ProxyBase.py index b4d4d0e84..da1baec17 100644 --- a/twilio/rest/proxy/ProxyBase.py +++ b/twilio/rest/proxy/ProxyBase.py @@ -17,6 +17,7 @@ class ProxyBase(Domain): + def __init__(self, twilio: Client): """ Initialize the Proxy Domain diff --git a/twilio/rest/proxy/v1/__init__.py b/twilio/rest/proxy/v1/__init__.py index 87a58d3ff..83737dc0f 100644 --- a/twilio/rest/proxy/v1/__init__.py +++ b/twilio/rest/proxy/v1/__init__.py @@ -19,6 +19,7 @@ class V1(Version): + def __init__(self, domain: Domain): """ Initialize the V1 version of Proxy diff --git a/twilio/rest/proxy/v1/service/__init__.py b/twilio/rest/proxy/v1/service/__init__.py index 707416106..6be2def24 100644 --- a/twilio/rest/proxy/v1/service/__init__.py +++ b/twilio/rest/proxy/v1/service/__init__.py @@ -26,6 +26,7 @@ class ServiceInstance(InstanceResource): + class GeoMatchLevel(object): AREA_CODE = "area-code" OVERLAY = "overlay" @@ -251,6 +252,7 @@ def __repr__(self) -> str: class ServiceContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the ServiceContext @@ -475,6 +477,7 @@ def __repr__(self) -> str: class ServicePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ServiceInstance: """ Build an instance of ServiceInstance @@ -493,6 +496,7 @@ def __repr__(self) -> str: class ServiceList(ListResource): + def __init__(self, version: Version): """ Initialize the ServiceList @@ -531,6 +535,7 @@ def create( :returns: The created ServiceInstance """ + data = values.of( { "UniqueName": unique_name, @@ -579,6 +584,7 @@ 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 8158a72c5..c4252b398 100644 --- a/twilio/rest/proxy/v1/service/phone_number.py +++ b/twilio/rest/proxy/v1/service/phone_number.py @@ -161,6 +161,7 @@ def __repr__(self) -> str: class PhoneNumberContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the PhoneNumberContext @@ -313,6 +314,7 @@ def __repr__(self) -> str: class PhoneNumberPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> PhoneNumberInstance: """ Build an instance of PhoneNumberInstance @@ -333,6 +335,7 @@ def __repr__(self) -> str: class PhoneNumberList(ListResource): + def __init__(self, version: Version, service_sid: str): """ Initialize the PhoneNumberList @@ -364,6 +367,7 @@ def create( :returns: The created PhoneNumberInstance """ + data = values.of( { "Sid": sid, @@ -397,6 +401,7 @@ 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 7244fae89..26ff17788 100644 --- a/twilio/rest/proxy/v1/service/session/__init__.py +++ b/twilio/rest/proxy/v1/service/session/__init__.py @@ -25,6 +25,7 @@ class SessionInstance(InstanceResource): + class Mode(object): MESSAGE_ONLY = "message-only" VOICE_ONLY = "voice-only" @@ -219,6 +220,7 @@ def __repr__(self) -> str: class SessionContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the SessionContext @@ -412,6 +414,7 @@ def __repr__(self) -> str: class SessionPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> SessionInstance: """ Build an instance of SessionInstance @@ -432,6 +435,7 @@ def __repr__(self) -> str: class SessionList(ListResource): + def __init__(self, version: Version, service_sid: str): """ Initialize the SessionList @@ -469,6 +473,7 @@ def create( :returns: The created SessionInstance """ + data = values.of( { "UniqueName": unique_name, @@ -513,6 +518,7 @@ 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 9e681c176..6e4cac7c1 100644 --- a/twilio/rest/proxy/v1/service/session/interaction.py +++ b/twilio/rest/proxy/v1/service/session/interaction.py @@ -23,6 +23,7 @@ class InteractionInstance(InstanceResource): + class ResourceStatus(object): ACCEPTED = "accepted" ANSWERED = "answered" @@ -59,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. + :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_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 @@ -188,6 +189,7 @@ def __repr__(self) -> str: class InteractionContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, session_sid: str, sid: str): """ Initialize the InteractionContext @@ -288,6 +290,7 @@ def __repr__(self) -> str: class InteractionPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> InteractionInstance: """ Build an instance of InteractionInstance @@ -311,6 +314,7 @@ def __repr__(self) -> str: class InteractionList(ListResource): + def __init__(self, version: Version, service_sid: str, session_sid: str): """ Initialize the InteractionList diff --git a/twilio/rest/proxy/v1/service/session/participant/__init__.py b/twilio/rest/proxy/v1/service/session/participant/__init__.py index 35f2c622b..266396f08 100644 --- a/twilio/rest/proxy/v1/service/session/participant/__init__.py +++ b/twilio/rest/proxy/v1/service/session/participant/__init__.py @@ -150,6 +150,7 @@ def __repr__(self) -> str: class ParticipantContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, session_sid: str, sid: str): """ Initialize the ParticipantContext @@ -266,6 +267,7 @@ def __repr__(self) -> str: class ParticipantPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ParticipantInstance: """ Build an instance of ParticipantInstance @@ -289,6 +291,7 @@ def __repr__(self) -> str: class ParticipantList(ListResource): + def __init__(self, version: Version, service_sid: str, session_sid: str): """ Initialize the ParticipantList @@ -328,6 +331,7 @@ def create( :returns: The created ParticipantInstance """ + data = values.of( { "Identifier": identifier, @@ -367,6 +371,7 @@ 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 1f6ff2281..b260b4693 100644 --- a/twilio/rest/proxy/v1/service/session/participant/message_interaction.py +++ b/twilio/rest/proxy/v1/service/session/participant/message_interaction.py @@ -23,6 +23,7 @@ class MessageInteractionInstance(InstanceResource): + class ResourceStatus(object): ACCEPTED = "accepted" ANSWERED = "answered" @@ -175,6 +176,7 @@ def __repr__(self) -> str: class MessageInteractionContext(InstanceContext): + def __init__( self, version: Version, @@ -260,6 +262,7 @@ def __repr__(self) -> str: class MessageInteractionPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> MessageInteractionInstance: """ Build an instance of MessageInteractionInstance @@ -284,6 +287,7 @@ def __repr__(self) -> str: class MessageInteractionList(ListResource): + def __init__( self, version: Version, service_sid: str, session_sid: str, participant_sid: str ): @@ -321,6 +325,7 @@ def create( :returns: The created MessageInteractionInstance """ + data = values.of( { "Body": body, @@ -355,6 +360,7 @@ 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 83a0a6c1b..7fc108e67 100644 --- a/twilio/rest/proxy/v1/service/short_code.py +++ b/twilio/rest/proxy/v1/service/short_code.py @@ -157,6 +157,7 @@ def __repr__(self) -> str: class ShortCodeContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the ShortCodeContext @@ -307,6 +308,7 @@ def __repr__(self) -> str: class ShortCodePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ShortCodeInstance: """ Build an instance of ShortCodeInstance @@ -327,6 +329,7 @@ def __repr__(self) -> str: class ShortCodeList(ListResource): + def __init__(self, version: Version, service_sid: str): """ Initialize the ShortCodeList @@ -347,10 +350,11 @@ def create(self, sid: str) -> ShortCodeInstance: """ Create the ShortCodeInstance - :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. + :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. :returns: The created ShortCodeInstance """ + data = values.of( { "Sid": sid, @@ -371,10 +375,11 @@ async def create_async(self, sid: str) -> ShortCodeInstance: """ Asynchronously create the ShortCodeInstance - :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. + :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. :returns: The created ShortCodeInstance """ + data = values.of( { "Sid": sid, diff --git a/twilio/rest/routes/RoutesBase.py b/twilio/rest/routes/RoutesBase.py index 86a85dd3d..a47d67f09 100644 --- a/twilio/rest/routes/RoutesBase.py +++ b/twilio/rest/routes/RoutesBase.py @@ -17,6 +17,7 @@ class RoutesBase(Domain): + def __init__(self, twilio: Client): """ Initialize the Routes Domain diff --git a/twilio/rest/routes/v2/__init__.py b/twilio/rest/routes/v2/__init__.py index b3852c1a6..56a140efc 100644 --- a/twilio/rest/routes/v2/__init__.py +++ b/twilio/rest/routes/v2/__init__.py @@ -21,6 +21,7 @@ class V2(Version): + def __init__(self, domain: Domain): """ Initialize the V2 version of Routes diff --git a/twilio/rest/routes/v2/phone_number.py b/twilio/rest/routes/v2/phone_number.py index 4b9de1a97..4f452e361 100644 --- a/twilio/rest/routes/v2/phone_number.py +++ b/twilio/rest/routes/v2/phone_number.py @@ -139,6 +139,7 @@ def __repr__(self) -> str: class PhoneNumberContext(InstanceContext): + def __init__(self, version: Version, phone_number: str): """ Initialize the PhoneNumberContext @@ -263,6 +264,7 @@ def __repr__(self) -> str: class PhoneNumberList(ListResource): + def __init__(self, version: Version): """ Initialize the PhoneNumberList diff --git a/twilio/rest/routes/v2/sip_domain.py b/twilio/rest/routes/v2/sip_domain.py index eac3d643f..cad3a4922 100644 --- a/twilio/rest/routes/v2/sip_domain.py +++ b/twilio/rest/routes/v2/sip_domain.py @@ -139,6 +139,7 @@ def __repr__(self) -> str: class SipDomainContext(InstanceContext): + def __init__(self, version: Version, sip_domain: str): """ Initialize the SipDomainContext @@ -263,6 +264,7 @@ def __repr__(self) -> str: class SipDomainList(ListResource): + def __init__(self, version: Version): """ Initialize the SipDomainList diff --git a/twilio/rest/routes/v2/trunk.py b/twilio/rest/routes/v2/trunk.py index 0addd96fd..2baf2788a 100644 --- a/twilio/rest/routes/v2/trunk.py +++ b/twilio/rest/routes/v2/trunk.py @@ -139,6 +139,7 @@ def __repr__(self) -> str: class TrunkContext(InstanceContext): + def __init__(self, version: Version, sip_trunk_domain: str): """ Initialize the TrunkContext @@ -263,6 +264,7 @@ def __repr__(self) -> str: class TrunkList(ListResource): + def __init__(self, version: Version): """ Initialize the TrunkList diff --git a/twilio/rest/serverless/ServerlessBase.py b/twilio/rest/serverless/ServerlessBase.py index 803c63dec..d6e227c0b 100644 --- a/twilio/rest/serverless/ServerlessBase.py +++ b/twilio/rest/serverless/ServerlessBase.py @@ -17,6 +17,7 @@ class ServerlessBase(Domain): + def __init__(self, twilio: Client): """ Initialize the Serverless Domain diff --git a/twilio/rest/serverless/v1/__init__.py b/twilio/rest/serverless/v1/__init__.py index ea6b4e9db..e494615ca 100644 --- a/twilio/rest/serverless/v1/__init__.py +++ b/twilio/rest/serverless/v1/__init__.py @@ -19,6 +19,7 @@ class V1(Version): + def __init__(self, domain: Domain): """ Initialize the V1 version of Serverless diff --git a/twilio/rest/serverless/v1/service/__init__.py b/twilio/rest/serverless/v1/service/__init__.py index 271e399df..493b1a2e0 100644 --- a/twilio/rest/serverless/v1/service/__init__.py +++ b/twilio/rest/serverless/v1/service/__init__.py @@ -199,6 +199,7 @@ def __repr__(self) -> str: class ServiceContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the ServiceContext @@ -402,6 +403,7 @@ def __repr__(self) -> str: class ServicePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ServiceInstance: """ Build an instance of ServiceInstance @@ -420,6 +422,7 @@ def __repr__(self) -> str: class ServiceList(ListResource): + def __init__(self, version: Version): """ Initialize the ServiceList @@ -448,6 +451,7 @@ def create( :returns: The created ServiceInstance """ + data = values.of( { "UniqueName": unique_name, @@ -482,6 +486,7 @@ 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 17e5ecc38..2049c9d46 100644 --- a/twilio/rest/serverless/v1/service/asset/__init__.py +++ b/twilio/rest/serverless/v1/service/asset/__init__.py @@ -157,6 +157,7 @@ def __repr__(self) -> str: class AssetContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the AssetContext @@ -318,6 +319,7 @@ def __repr__(self) -> str: class AssetPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> AssetInstance: """ Build an instance of AssetInstance @@ -338,6 +340,7 @@ def __repr__(self) -> str: class AssetList(ListResource): + def __init__(self, version: Version, service_sid: str): """ Initialize the AssetList @@ -362,6 +365,7 @@ def create(self, friendly_name: str) -> AssetInstance: :returns: The created AssetInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -386,6 +390,7 @@ 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/asset/asset_version.py b/twilio/rest/serverless/v1/service/asset/asset_version.py index a8fa462d2..fbe7b3080 100644 --- a/twilio/rest/serverless/v1/service/asset/asset_version.py +++ b/twilio/rest/serverless/v1/service/asset/asset_version.py @@ -23,6 +23,7 @@ class AssetVersionInstance(InstanceResource): + class Visibility(object): PUBLIC = "public" PRIVATE = "private" @@ -115,6 +116,7 @@ def __repr__(self) -> str: class AssetVersionContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, asset_sid: str, sid: str): """ Initialize the AssetVersionContext @@ -189,6 +191,7 @@ def __repr__(self) -> str: class AssetVersionPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> AssetVersionInstance: """ Build an instance of AssetVersionInstance @@ -212,6 +215,7 @@ def __repr__(self) -> str: class AssetVersionList(ListResource): + def __init__(self, version: Version, service_sid: str, asset_sid: str): """ Initialize the AssetVersionList diff --git a/twilio/rest/serverless/v1/service/build/__init__.py b/twilio/rest/serverless/v1/service/build/__init__.py index 0fe3b8f92..25997bec2 100644 --- a/twilio/rest/serverless/v1/service/build/__init__.py +++ b/twilio/rest/serverless/v1/service/build/__init__.py @@ -32,6 +32,7 @@ class Runtime(object): NODE12 = "node12" NODE14 = "node14" NODE16 = "node16" + NODE18 = "node18" class Status(object): BUILDING = "building" @@ -61,9 +62,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[object]] = payload.get("asset_versions") - self.function_versions: Optional[List[object]] = payload.get("function_versions") - self.dependencies: Optional[List[object]] = payload.get("dependencies") + 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.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")) @@ -274,7 +275,7 @@ def __repr__(self) -> str: class BuildList(ListResource): - + def __init__(self, version: Version, service_sid: str): """ Initialize the BuildList @@ -305,6 +306,7 @@ 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), @@ -312,6 +314,7 @@ 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']) @@ -327,6 +330,7 @@ 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), @@ -334,6 +338,7 @@ 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 c127f89a4..2613ae3cb 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 a072d8ffa..46b7ddacf 100644 --- a/twilio/rest/serverless/v1/service/environment/__init__.py +++ b/twilio/rest/serverless/v1/service/environment/__init__.py @@ -155,6 +155,7 @@ def __repr__(self) -> str: class EnvironmentContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the EnvironmentContext @@ -292,6 +293,7 @@ def __repr__(self) -> str: class EnvironmentPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> EnvironmentInstance: """ Build an instance of EnvironmentInstance @@ -312,6 +314,7 @@ def __repr__(self) -> str: class EnvironmentList(ListResource): + def __init__(self, version: Version, service_sid: str): """ Initialize the EnvironmentList @@ -339,6 +342,7 @@ def create( :returns: The created EnvironmentInstance """ + data = values.of( { "UniqueName": unique_name, @@ -367,6 +371,7 @@ 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 2738d967c..1ff896f93 100644 --- a/twilio/rest/serverless/v1/service/environment/deployment.py +++ b/twilio/rest/serverless/v1/service/environment/deployment.py @@ -110,6 +110,7 @@ def __repr__(self) -> str: class DeploymentContext(InstanceContext): + def __init__( self, version: Version, service_sid: str, environment_sid: str, sid: str ): @@ -186,6 +187,7 @@ def __repr__(self) -> str: class DeploymentPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> DeploymentInstance: """ Build an instance of DeploymentInstance @@ -209,6 +211,7 @@ def __repr__(self) -> str: class DeploymentList(ListResource): + def __init__(self, version: Version, service_sid: str, environment_sid: str): """ Initialize the DeploymentList @@ -241,6 +244,7 @@ def create( :returns: The created DeploymentInstance """ + data = values.of( { "BuildSid": build_sid, @@ -270,6 +274,7 @@ async def create_async( :returns: The created DeploymentInstance """ + data = values.of( { "BuildSid": build_sid, diff --git a/twilio/rest/serverless/v1/service/environment/log.py b/twilio/rest/serverless/v1/service/environment/log.py index 0249ee4eb..e1aff5214 100644 --- a/twilio/rest/serverless/v1/service/environment/log.py +++ b/twilio/rest/serverless/v1/service/environment/log.py @@ -23,6 +23,7 @@ class LogInstance(InstanceResource): + class Level(object): INFO = "info" WARN = "warn" @@ -121,6 +122,7 @@ def __repr__(self) -> str: class LogContext(InstanceContext): + def __init__( self, version: Version, service_sid: str, environment_sid: str, sid: str ): @@ -199,6 +201,7 @@ def __repr__(self) -> str: class LogPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> LogInstance: """ Build an instance of LogInstance @@ -222,6 +225,7 @@ def __repr__(self) -> str: class LogList(ListResource): + def __init__(self, version: Version, service_sid: str, environment_sid: str): """ Initialize the LogList diff --git a/twilio/rest/serverless/v1/service/environment/variable.py b/twilio/rest/serverless/v1/service/environment/variable.py index 35447b75c..f69c129f8 100644 --- a/twilio/rest/serverless/v1/service/environment/variable.py +++ b/twilio/rest/serverless/v1/service/environment/variable.py @@ -166,6 +166,7 @@ def __repr__(self) -> str: class VariableContext(InstanceContext): + def __init__( self, version: Version, service_sid: str, environment_sid: str, sid: str ): @@ -334,6 +335,7 @@ def __repr__(self) -> str: class VariablePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> VariableInstance: """ Build an instance of VariableInstance @@ -357,6 +359,7 @@ def __repr__(self) -> str: class VariableList(ListResource): + def __init__(self, version: Version, service_sid: str, environment_sid: str): """ Initialize the VariableList @@ -388,6 +391,7 @@ def create(self, key: str, value: str) -> VariableInstance: :returns: The created VariableInstance """ + data = values.of( { "Key": key, @@ -417,6 +421,7 @@ 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 a18444d39..71bbad846 100644 --- a/twilio/rest/serverless/v1/service/function/__init__.py +++ b/twilio/rest/serverless/v1/service/function/__init__.py @@ -159,6 +159,7 @@ def __repr__(self) -> str: class FunctionContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the FunctionContext @@ -320,6 +321,7 @@ def __repr__(self) -> str: class FunctionPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> FunctionInstance: """ Build an instance of FunctionInstance @@ -340,6 +342,7 @@ def __repr__(self) -> str: class FunctionList(ListResource): + def __init__(self, version: Version, service_sid: str): """ Initialize the FunctionList @@ -364,6 +367,7 @@ def create(self, friendly_name: str) -> FunctionInstance: :returns: The created FunctionInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -388,6 +392,7 @@ async def create_async(self, friendly_name: str) -> FunctionInstance: :returns: The created FunctionInstance """ + data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/serverless/v1/service/function/function_version/__init__.py b/twilio/rest/serverless/v1/service/function/function_version/__init__.py index 0b551904e..e915894f1 100644 --- a/twilio/rest/serverless/v1/service/function/function_version/__init__.py +++ b/twilio/rest/serverless/v1/service/function/function_version/__init__.py @@ -26,6 +26,7 @@ class FunctionVersionInstance(InstanceResource): + class Visibility(object): PUBLIC = "public" PRIVATE = "private" @@ -127,6 +128,7 @@ def __repr__(self) -> str: class FunctionVersionContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, function_sid: str, sid: str): """ Initialize the FunctionVersionContext @@ -219,6 +221,7 @@ def __repr__(self) -> str: class FunctionVersionPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> FunctionVersionInstance: """ Build an instance of FunctionVersionInstance @@ -242,6 +245,7 @@ def __repr__(self) -> str: class FunctionVersionList(ListResource): + def __init__(self, version: Version, service_sid: str, function_sid: str): """ Initialize the FunctionVersionList diff --git a/twilio/rest/serverless/v1/service/function/function_version/function_version_content.py b/twilio/rest/serverless/v1/service/function/function_version/function_version_content.py index 0b99cf877..c58fa574e 100644 --- a/twilio/rest/serverless/v1/service/function/function_version/function_version_content.py +++ b/twilio/rest/serverless/v1/service/function/function_version/function_version_content.py @@ -101,6 +101,7 @@ def __repr__(self) -> str: class FunctionVersionContentContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, function_sid: str, sid: str): """ Initialize the FunctionVersionContentContext @@ -175,6 +176,7 @@ def __repr__(self) -> str: class FunctionVersionContentList(ListResource): + def __init__(self, version: Version, service_sid: str, function_sid: str, sid: str): """ Initialize the FunctionVersionContentList diff --git a/twilio/rest/studio/StudioBase.py b/twilio/rest/studio/StudioBase.py index e1b237422..3b218775c 100644 --- a/twilio/rest/studio/StudioBase.py +++ b/twilio/rest/studio/StudioBase.py @@ -18,6 +18,7 @@ class StudioBase(Domain): + def __init__(self, twilio: Client): """ Initialize the Studio Domain diff --git a/twilio/rest/studio/v1/__init__.py b/twilio/rest/studio/v1/__init__.py index d5ca90bb6..8ab7d71b6 100644 --- a/twilio/rest/studio/v1/__init__.py +++ b/twilio/rest/studio/v1/__init__.py @@ -19,6 +19,7 @@ class V1(Version): + def __init__(self, domain: Domain): """ Initialize the V1 version of Studio diff --git a/twilio/rest/studio/v1/flow/__init__.py b/twilio/rest/studio/v1/flow/__init__.py index a950be3cc..bb0f78658 100644 --- a/twilio/rest/studio/v1/flow/__init__.py +++ b/twilio/rest/studio/v1/flow/__init__.py @@ -25,6 +25,7 @@ class FlowInstance(InstanceResource): + class Status(object): DRAFT = "draft" PUBLISHED = "published" @@ -141,6 +142,7 @@ def __repr__(self) -> str: class FlowContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the FlowContext @@ -256,6 +258,7 @@ def __repr__(self) -> str: class FlowPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> FlowInstance: """ Build an instance of FlowInstance @@ -274,6 +277,7 @@ def __repr__(self) -> str: class FlowList(ListResource): + def __init__(self, version: Version): """ Initialize the FlowList diff --git a/twilio/rest/studio/v1/flow/engagement/__init__.py b/twilio/rest/studio/v1/flow/engagement/__init__.py index 7962f7ae0..f6d95abd5 100644 --- a/twilio/rest/studio/v1/flow/engagement/__init__.py +++ b/twilio/rest/studio/v1/flow/engagement/__init__.py @@ -27,6 +27,7 @@ class EngagementInstance(InstanceResource): + class Status(object): ACTIVE = "active" ENDED = "ended" @@ -155,6 +156,7 @@ def __repr__(self) -> str: class EngagementContext(InstanceContext): + def __init__(self, version: Version, flow_sid: str, sid: str): """ Initialize the EngagementContext @@ -276,6 +278,7 @@ def __repr__(self) -> str: class EngagementPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> EngagementInstance: """ Build an instance of EngagementInstance @@ -296,6 +299,7 @@ def __repr__(self) -> str: class EngagementList(ListResource): + def __init__(self, version: Version, flow_sid: str): """ Initialize the EngagementList @@ -324,6 +328,7 @@ def create( :returns: The created EngagementInstance """ + data = values.of( { "To": to, @@ -354,6 +359,7 @@ async def create_async( :returns: The created EngagementInstance """ + data = values.of( { "To": to, diff --git a/twilio/rest/studio/v1/flow/engagement/engagement_context.py b/twilio/rest/studio/v1/flow/engagement/engagement_context.py index 8dc0d1c51..f534db692 100644 --- a/twilio/rest/studio/v1/flow/engagement/engagement_context.py +++ b/twilio/rest/studio/v1/flow/engagement/engagement_context.py @@ -94,6 +94,7 @@ def __repr__(self) -> str: class EngagementContextContext(InstanceContext): + def __init__(self, version: Version, flow_sid: str, engagement_sid: str): """ Initialize the EngagementContextContext @@ -164,6 +165,7 @@ def __repr__(self) -> str: class EngagementContextList(ListResource): + def __init__(self, version: Version, flow_sid: str, engagement_sid: str): """ Initialize the EngagementContextList diff --git a/twilio/rest/studio/v1/flow/engagement/step/__init__.py b/twilio/rest/studio/v1/flow/engagement/step/__init__.py index 8e87942d0..1a2d8570c 100644 --- a/twilio/rest/studio/v1/flow/engagement/step/__init__.py +++ b/twilio/rest/studio/v1/flow/engagement/step/__init__.py @@ -126,6 +126,7 @@ def __repr__(self) -> str: class StepContext(InstanceContext): + def __init__(self, version: Version, flow_sid: str, engagement_sid: str, sid: str): """ Initialize the StepContext @@ -216,6 +217,7 @@ def __repr__(self) -> str: class StepPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> StepInstance: """ Build an instance of StepInstance @@ -239,6 +241,7 @@ def __repr__(self) -> str: class StepList(ListResource): + def __init__(self, version: Version, flow_sid: str, engagement_sid: str): """ Initialize the StepList diff --git a/twilio/rest/studio/v1/flow/engagement/step/step_context.py b/twilio/rest/studio/v1/flow/engagement/step/step_context.py index a32c82c6d..69c4c2246 100644 --- a/twilio/rest/studio/v1/flow/engagement/step/step_context.py +++ b/twilio/rest/studio/v1/flow/engagement/step/step_context.py @@ -99,6 +99,7 @@ def __repr__(self) -> str: class StepContextContext(InstanceContext): + def __init__( self, version: Version, flow_sid: str, engagement_sid: str, step_sid: str ): @@ -175,6 +176,7 @@ def __repr__(self) -> str: class StepContextList(ListResource): + def __init__( self, version: Version, flow_sid: str, engagement_sid: str, step_sid: str ): diff --git a/twilio/rest/studio/v1/flow/execution/__init__.py b/twilio/rest/studio/v1/flow/execution/__init__.py index 5cfa28cd2..57239e515 100644 --- a/twilio/rest/studio/v1/flow/execution/__init__.py +++ b/twilio/rest/studio/v1/flow/execution/__init__.py @@ -25,6 +25,7 @@ class ExecutionInstance(InstanceResource): + class Status(object): ACTIVE = "active" ENDED = "ended" @@ -179,6 +180,7 @@ def __repr__(self) -> str: class ExecutionContext(InstanceContext): + def __init__(self, version: Version, flow_sid: str, sid: str): """ Initialize the ExecutionContext @@ -356,6 +358,7 @@ def __repr__(self) -> str: class ExecutionPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ExecutionInstance: """ Build an instance of ExecutionInstance @@ -376,6 +379,7 @@ def __repr__(self) -> str: class ExecutionList(ListResource): + def __init__(self, version: Version, flow_sid: str): """ Initialize the ExecutionList @@ -404,6 +408,7 @@ def create( :returns: The created ExecutionInstance """ + data = values.of( { "To": to, @@ -434,6 +439,7 @@ async def create_async( :returns: The created ExecutionInstance """ + data = values.of( { "To": to, diff --git a/twilio/rest/studio/v1/flow/execution/execution_context.py b/twilio/rest/studio/v1/flow/execution/execution_context.py index e36b21e1e..a2765bbc9 100644 --- a/twilio/rest/studio/v1/flow/execution/execution_context.py +++ b/twilio/rest/studio/v1/flow/execution/execution_context.py @@ -94,6 +94,7 @@ def __repr__(self) -> str: class ExecutionContextContext(InstanceContext): + def __init__(self, version: Version, flow_sid: str, execution_sid: str): """ Initialize the ExecutionContextContext @@ -164,6 +165,7 @@ def __repr__(self) -> str: class ExecutionContextList(ListResource): + def __init__(self, version: Version, flow_sid: str, execution_sid: str): """ Initialize the ExecutionContextList diff --git a/twilio/rest/studio/v1/flow/execution/execution_step/__init__.py b/twilio/rest/studio/v1/flow/execution/execution_step/__init__.py index 0eb15e125..6e19ca445 100644 --- a/twilio/rest/studio/v1/flow/execution/execution_step/__init__.py +++ b/twilio/rest/studio/v1/flow/execution/execution_step/__init__.py @@ -128,6 +128,7 @@ def __repr__(self) -> str: class ExecutionStepContext(InstanceContext): + def __init__(self, version: Version, flow_sid: str, execution_sid: str, sid: str): """ Initialize the ExecutionStepContext @@ -218,6 +219,7 @@ def __repr__(self) -> str: class ExecutionStepPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ExecutionStepInstance: """ Build an instance of ExecutionStepInstance @@ -241,6 +243,7 @@ def __repr__(self) -> str: class ExecutionStepList(ListResource): + def __init__(self, version: Version, flow_sid: str, execution_sid: str): """ Initialize the ExecutionStepList diff --git a/twilio/rest/studio/v1/flow/execution/execution_step/execution_step_context.py b/twilio/rest/studio/v1/flow/execution/execution_step/execution_step_context.py index b33c0c635..224f92d0f 100644 --- a/twilio/rest/studio/v1/flow/execution/execution_step/execution_step_context.py +++ b/twilio/rest/studio/v1/flow/execution/execution_step/execution_step_context.py @@ -99,6 +99,7 @@ def __repr__(self) -> str: class ExecutionStepContextContext(InstanceContext): + def __init__( self, version: Version, flow_sid: str, execution_sid: str, step_sid: str ): @@ -175,6 +176,7 @@ def __repr__(self) -> str: class ExecutionStepContextList(ListResource): + def __init__( self, version: Version, flow_sid: str, execution_sid: str, step_sid: str ): diff --git a/twilio/rest/studio/v2/__init__.py b/twilio/rest/studio/v2/__init__.py index 2ad61768a..83ccc8e0a 100644 --- a/twilio/rest/studio/v2/__init__.py +++ b/twilio/rest/studio/v2/__init__.py @@ -20,6 +20,7 @@ class V2(Version): + def __init__(self, domain: Domain): """ Initialize the V2 version of Studio diff --git a/twilio/rest/studio/v2/flow/__init__.py b/twilio/rest/studio/v2/flow/__init__.py index f4e24626b..21138d29c 100644 --- a/twilio/rest/studio/v2/flow/__init__.py +++ b/twilio/rest/studio/v2/flow/__init__.py @@ -26,6 +26,7 @@ class FlowInstance(InstanceResource): + class Status(object): DRAFT = "draft" PUBLISHED = "published" @@ -61,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[object]] = payload.get("errors") - self.warnings: Optional[List[object]] = payload.get("warnings") + self.errors: Optional[List[Dict[str, object]]] = payload.get("errors") + self.warnings: Optional[List[Dict[str, object]]] = payload.get("warnings") self.date_created: Optional[datetime] = deserialize.iso8601_datetime( payload.get("date_created") ) @@ -209,6 +210,7 @@ def __repr__(self) -> str: class FlowContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the FlowContext @@ -405,6 +407,7 @@ def __repr__(self) -> str: class FlowPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> FlowInstance: """ Build an instance of FlowInstance @@ -423,6 +426,7 @@ def __repr__(self) -> str: class FlowList(ListResource): + def __init__(self, version: Version): """ Initialize the FlowList @@ -451,6 +455,7 @@ def create( :returns: The created FlowInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -485,6 +490,7 @@ 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 4056a5d3d..38d3b2b53 100644 --- a/twilio/rest/studio/v2/flow/execution/__init__.py +++ b/twilio/rest/studio/v2/flow/execution/__init__.py @@ -25,6 +25,7 @@ class ExecutionInstance(InstanceResource): + class Status(object): ACTIVE = "active" ENDED = "ended" @@ -177,6 +178,7 @@ def __repr__(self) -> str: class ExecutionContext(InstanceContext): + def __init__(self, version: Version, flow_sid: str, sid: str): """ Initialize the ExecutionContext @@ -354,6 +356,7 @@ def __repr__(self) -> str: class ExecutionPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ExecutionInstance: """ Build an instance of ExecutionInstance @@ -374,6 +377,7 @@ def __repr__(self) -> str: class ExecutionList(ListResource): + def __init__(self, version: Version, flow_sid: str): """ Initialize the ExecutionList @@ -402,6 +406,7 @@ def create( :returns: The created ExecutionInstance """ + data = values.of( { "To": to, @@ -432,6 +437,7 @@ async def create_async( :returns: The created ExecutionInstance """ + data = values.of( { "To": to, diff --git a/twilio/rest/studio/v2/flow/execution/execution_context.py b/twilio/rest/studio/v2/flow/execution/execution_context.py index eb432cafb..facb52eed 100644 --- a/twilio/rest/studio/v2/flow/execution/execution_context.py +++ b/twilio/rest/studio/v2/flow/execution/execution_context.py @@ -94,6 +94,7 @@ def __repr__(self) -> str: class ExecutionContextContext(InstanceContext): + def __init__(self, version: Version, flow_sid: str, execution_sid: str): """ Initialize the ExecutionContextContext @@ -164,6 +165,7 @@ def __repr__(self) -> str: class ExecutionContextList(ListResource): + def __init__(self, version: Version, flow_sid: str, execution_sid: str): """ Initialize the ExecutionContextList diff --git a/twilio/rest/studio/v2/flow/execution/execution_step/__init__.py b/twilio/rest/studio/v2/flow/execution/execution_step/__init__.py index 83682a53e..257e16b1d 100644 --- a/twilio/rest/studio/v2/flow/execution/execution_step/__init__.py +++ b/twilio/rest/studio/v2/flow/execution/execution_step/__init__.py @@ -128,6 +128,7 @@ def __repr__(self) -> str: class ExecutionStepContext(InstanceContext): + def __init__(self, version: Version, flow_sid: str, execution_sid: str, sid: str): """ Initialize the ExecutionStepContext @@ -218,6 +219,7 @@ def __repr__(self) -> str: class ExecutionStepPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ExecutionStepInstance: """ Build an instance of ExecutionStepInstance @@ -241,6 +243,7 @@ def __repr__(self) -> str: class ExecutionStepList(ListResource): + def __init__(self, version: Version, flow_sid: str, execution_sid: str): """ Initialize the ExecutionStepList diff --git a/twilio/rest/studio/v2/flow/execution/execution_step/execution_step_context.py b/twilio/rest/studio/v2/flow/execution/execution_step/execution_step_context.py index c89d9f1ed..41661238b 100644 --- a/twilio/rest/studio/v2/flow/execution/execution_step/execution_step_context.py +++ b/twilio/rest/studio/v2/flow/execution/execution_step/execution_step_context.py @@ -99,6 +99,7 @@ def __repr__(self) -> str: class ExecutionStepContextContext(InstanceContext): + def __init__( self, version: Version, flow_sid: str, execution_sid: str, step_sid: str ): @@ -175,6 +176,7 @@ def __repr__(self) -> str: class ExecutionStepContextList(ListResource): + def __init__( self, version: Version, flow_sid: str, execution_sid: str, step_sid: str ): diff --git a/twilio/rest/studio/v2/flow/flow_revision.py b/twilio/rest/studio/v2/flow/flow_revision.py index bf9efc6d5..0de91513e 100644 --- a/twilio/rest/studio/v2/flow/flow_revision.py +++ b/twilio/rest/studio/v2/flow/flow_revision.py @@ -23,6 +23,7 @@ class FlowRevisionInstance(InstanceResource): + class Status(object): DRAFT = "draft" PUBLISHED = "published" @@ -59,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[object]] = payload.get("errors") + self.errors: Optional[List[Dict[str, object]]] = payload.get("errors") self.date_created: Optional[datetime] = deserialize.iso8601_datetime( payload.get("date_created") ) @@ -119,6 +120,7 @@ def __repr__(self) -> str: class FlowRevisionContext(InstanceContext): + def __init__(self, version: Version, sid: str, revision: str): """ Initialize the FlowRevisionContext @@ -187,6 +189,7 @@ def __repr__(self) -> str: class FlowRevisionPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> FlowRevisionInstance: """ Build an instance of FlowRevisionInstance @@ -205,6 +208,7 @@ def __repr__(self) -> str: class FlowRevisionList(ListResource): + def __init__(self, version: Version, sid: str): """ Initialize the FlowRevisionList diff --git a/twilio/rest/studio/v2/flow/flow_test_user.py b/twilio/rest/studio/v2/flow/flow_test_user.py index 81bee7ed9..346563235 100644 --- a/twilio/rest/studio/v2/flow/flow_test_user.py +++ b/twilio/rest/studio/v2/flow/flow_test_user.py @@ -107,6 +107,7 @@ def __repr__(self) -> str: class FlowTestUserContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the FlowTestUserContext @@ -215,6 +216,7 @@ def __repr__(self) -> str: class FlowTestUserList(ListResource): + def __init__(self, version: Version, sid: str): """ Initialize the FlowTestUserList diff --git a/twilio/rest/studio/v2/flow_validate.py b/twilio/rest/studio/v2/flow_validate.py index 63ebb7623..6994e6af1 100644 --- a/twilio/rest/studio/v2/flow_validate.py +++ b/twilio/rest/studio/v2/flow_validate.py @@ -21,6 +21,7 @@ class FlowValidateInstance(InstanceResource): + class Status(object): DRAFT = "draft" PUBLISHED = "published" @@ -45,6 +46,7 @@ def __repr__(self) -> str: class FlowValidateList(ListResource): + def __init__(self, version: Version): """ Initialize the FlowValidateList diff --git a/twilio/rest/supersim/SupersimBase.py b/twilio/rest/supersim/SupersimBase.py index d85c38264..dd73d1222 100644 --- a/twilio/rest/supersim/SupersimBase.py +++ b/twilio/rest/supersim/SupersimBase.py @@ -17,6 +17,7 @@ class SupersimBase(Domain): + def __init__(self, twilio: Client): """ Initialize the Supersim Domain diff --git a/twilio/rest/supersim/v1/__init__.py b/twilio/rest/supersim/v1/__init__.py index 480787bca..2336da261 100644 --- a/twilio/rest/supersim/v1/__init__.py +++ b/twilio/rest/supersim/v1/__init__.py @@ -27,6 +27,7 @@ class V1(Version): + def __init__(self, domain: Domain): """ Initialize the V1 version of Supersim diff --git a/twilio/rest/supersim/v1/esim_profile.py b/twilio/rest/supersim/v1/esim_profile.py index 4477dda2f..c8ecb02ae 100644 --- a/twilio/rest/supersim/v1/esim_profile.py +++ b/twilio/rest/supersim/v1/esim_profile.py @@ -23,6 +23,7 @@ class EsimProfileInstance(InstanceResource): + class Status(object): NEW = "new" RESERVING = "reserving" @@ -35,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/wireless/api/sim-resource) resource that this eSIM Profile controls. + :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 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`. @@ -121,6 +122,7 @@ def __repr__(self) -> str: class EsimProfileContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the EsimProfileContext @@ -185,6 +187,7 @@ def __repr__(self) -> str: class EsimProfilePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> EsimProfileInstance: """ Build an instance of EsimProfileInstance @@ -203,6 +206,7 @@ def __repr__(self) -> str: class EsimProfileList(ListResource): + def __init__(self, version: Version): """ Initialize the EsimProfileList @@ -231,6 +235,7 @@ def create( :returns: The created EsimProfileInstance """ + data = values.of( { "CallbackUrl": callback_url, @@ -265,6 +270,7 @@ async def create_async( :returns: The created EsimProfileInstance """ + data = values.of( { "CallbackUrl": callback_url, @@ -297,7 +303,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/wireless/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/supersim/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 @@ -330,7 +336,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/wireless/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/supersim/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 @@ -362,7 +368,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/wireless/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/supersim/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 @@ -397,7 +403,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/wireless/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/supersim/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 @@ -433,7 +439,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/wireless/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/supersim/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 @@ -469,7 +475,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/wireless/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/supersim/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 05058744c..2447057a7 100644 --- a/twilio/rest/supersim/v1/fleet.py +++ b/twilio/rest/supersim/v1/fleet.py @@ -23,6 +23,7 @@ class FleetInstance(InstanceResource): + class DataMetering(object): PAYG = "payg" @@ -188,6 +189,7 @@ def __repr__(self) -> str: class FleetContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the FleetContext @@ -338,6 +340,7 @@ def __repr__(self) -> str: class FleetPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> FleetInstance: """ Build an instance of FleetInstance @@ -356,6 +359,7 @@ def __repr__(self) -> str: class FleetList(ListResource): + def __init__(self, version: Version): """ Initialize the FleetList @@ -394,6 +398,7 @@ def create( :returns: The created FleetInstance """ + data = values.of( { "NetworkAccessProfile": network_access_profile, @@ -443,6 +448,7 @@ 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 aab4470af..b7610efec 100644 --- a/twilio/rest/supersim/v1/ip_command.py +++ b/twilio/rest/supersim/v1/ip_command.py @@ -23,6 +23,7 @@ class IpCommandInstance(InstanceResource): + class Direction(object): TO_SIM = "to_sim" FROM_SIM = "from_sim" @@ -131,6 +132,7 @@ def __repr__(self) -> str: class IpCommandContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the IpCommandContext @@ -195,6 +197,7 @@ def __repr__(self) -> str: class IpCommandPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> IpCommandInstance: """ Build an instance of IpCommandInstance @@ -213,6 +216,7 @@ def __repr__(self) -> str: class IpCommandList(ListResource): + def __init__(self, version: Version): """ Initialize the IpCommandList @@ -245,6 +249,7 @@ def create( :returns: The created IpCommandInstance """ + data = values.of( { "Sim": sim, @@ -285,6 +290,7 @@ 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 5ea9a8e4a..0d4f6a94f 100644 --- a/twilio/rest/supersim/v1/network.py +++ b/twilio/rest/supersim/v1/network.py @@ -39,7 +39,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[object]] = payload.get("identifiers") + self.identifiers: Optional[List[Dict[str, object]]] = payload.get("identifiers") self._solution = { "sid": sid or self.sid, @@ -90,6 +90,7 @@ def __repr__(self) -> str: class NetworkContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the NetworkContext @@ -154,6 +155,7 @@ def __repr__(self) -> str: class NetworkPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> NetworkInstance: """ Build an instance of NetworkInstance @@ -172,6 +174,7 @@ def __repr__(self) -> str: class NetworkList(ListResource): + def __init__(self, version: Version): """ Initialize the NetworkList diff --git a/twilio/rest/supersim/v1/network_access_profile/__init__.py b/twilio/rest/supersim/v1/network_access_profile/__init__.py index a355b746b..d0b537469 100644 --- a/twilio/rest/supersim/v1/network_access_profile/__init__.py +++ b/twilio/rest/supersim/v1/network_access_profile/__init__.py @@ -137,6 +137,7 @@ def __repr__(self) -> str: class NetworkAccessProfileContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the NetworkAccessProfileContext @@ -267,6 +268,7 @@ def __repr__(self) -> str: class NetworkAccessProfilePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> NetworkAccessProfileInstance: """ Build an instance of NetworkAccessProfileInstance @@ -285,6 +287,7 @@ def __repr__(self) -> str: class NetworkAccessProfileList(ListResource): + def __init__(self, version: Version): """ Initialize the NetworkAccessProfileList @@ -309,6 +312,7 @@ def create( :returns: The created NetworkAccessProfileInstance """ + data = values.of( { "UniqueName": unique_name, @@ -337,6 +341,7 @@ 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 eeacec1e7..50a259550 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 @@ -46,7 +46,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[object]] = payload.get("identifiers") + self.identifiers: Optional[List[Dict[str, object]]] = payload.get("identifiers") self.url: Optional[str] = payload.get("url") self._solution = { @@ -120,6 +120,7 @@ def __repr__(self) -> str: class NetworkAccessProfileNetworkContext(InstanceContext): + def __init__(self, version: Version, network_access_profile_sid: str, sid: str): """ Initialize the NetworkAccessProfileNetworkContext @@ -218,6 +219,7 @@ def __repr__(self) -> str: class NetworkAccessProfileNetworkPage(Page): + def get_instance( self, payload: Dict[str, Any] ) -> NetworkAccessProfileNetworkInstance: @@ -242,6 +244,7 @@ def __repr__(self) -> str: class NetworkAccessProfileNetworkList(ListResource): + def __init__(self, version: Version, network_access_profile_sid: str): """ Initialize the NetworkAccessProfileNetworkList @@ -270,6 +273,7 @@ def create(self, network: str) -> NetworkAccessProfileNetworkInstance: :returns: The created NetworkAccessProfileNetworkInstance """ + data = values.of( { "Network": network, @@ -296,6 +300,7 @@ 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 ea13986d0..f94615028 100644 --- a/twilio/rest/supersim/v1/settings_update.py +++ b/twilio/rest/supersim/v1/settings_update.py @@ -23,6 +23,7 @@ class SettingsUpdateInstance(InstanceResource): + class Status(object): SCHEDULED = "scheduled" IN_PROGRESS = "in-progress" @@ -47,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[object]] = payload.get("packages") + self.packages: Optional[List[Dict[str, object]]] = payload.get("packages") self.date_completed: Optional[datetime] = deserialize.iso8601_datetime( payload.get("date_completed") ) @@ -69,6 +70,7 @@ def __repr__(self) -> str: class SettingsUpdatePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> SettingsUpdateInstance: """ Build an instance of SettingsUpdateInstance @@ -87,6 +89,7 @@ def __repr__(self) -> str: class SettingsUpdateList(ListResource): + def __init__(self, version: Version): """ Initialize the SettingsUpdateList diff --git a/twilio/rest/supersim/v1/sim/__init__.py b/twilio/rest/supersim/v1/sim/__init__.py index 735e8fadc..b1ba64733 100644 --- a/twilio/rest/supersim/v1/sim/__init__.py +++ b/twilio/rest/supersim/v1/sim/__init__.py @@ -25,6 +25,7 @@ class SimInstance(InstanceResource): + class Status(object): NEW = "new" READY = "ready" @@ -193,6 +194,7 @@ def __repr__(self) -> str: class SimContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the SimContext @@ -364,6 +366,7 @@ def __repr__(self) -> str: class SimPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> SimInstance: """ Build an instance of SimInstance @@ -382,6 +385,7 @@ def __repr__(self) -> str: class SimList(ListResource): + def __init__(self, version: Version): """ Initialize the SimList @@ -402,6 +406,7 @@ def create(self, iccid: str, registration_code: str) -> SimInstance: :returns: The created SimInstance """ + data = values.of( { "Iccid": iccid, @@ -426,6 +431,7 @@ 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/sim/billing_period.py b/twilio/rest/supersim/v1/sim/billing_period.py index 082622ece..e6fb96183 100644 --- a/twilio/rest/supersim/v1/sim/billing_period.py +++ b/twilio/rest/supersim/v1/sim/billing_period.py @@ -23,6 +23,7 @@ class BillingPeriodInstance(InstanceResource): + class BpType(object): READY = "ready" ACTIVE = "active" @@ -75,6 +76,7 @@ def __repr__(self) -> str: class BillingPeriodPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> BillingPeriodInstance: """ Build an instance of BillingPeriodInstance @@ -95,6 +97,7 @@ def __repr__(self) -> str: class BillingPeriodList(ListResource): + def __init__(self, version: Version, sim_sid: str): """ Initialize the BillingPeriodList diff --git a/twilio/rest/supersim/v1/sim/sim_ip_address.py b/twilio/rest/supersim/v1/sim/sim_ip_address.py index e0b5a5756..7c2b70e50 100644 --- a/twilio/rest/supersim/v1/sim/sim_ip_address.py +++ b/twilio/rest/supersim/v1/sim/sim_ip_address.py @@ -22,6 +22,7 @@ class SimIpAddressInstance(InstanceResource): + class IpAddressVersion(object): IPV4 = "IPv4" IPV6 = "IPv6" @@ -54,6 +55,7 @@ def __repr__(self) -> str: class SimIpAddressPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> SimIpAddressInstance: """ Build an instance of SimIpAddressInstance @@ -74,6 +76,7 @@ def __repr__(self) -> str: class SimIpAddressList(ListResource): + def __init__(self, version: Version, sim_sid: str): """ Initialize the SimIpAddressList diff --git a/twilio/rest/supersim/v1/sms_command.py b/twilio/rest/supersim/v1/sms_command.py index 18e496c71..0eb209410 100644 --- a/twilio/rest/supersim/v1/sms_command.py +++ b/twilio/rest/supersim/v1/sms_command.py @@ -23,6 +23,7 @@ class SmsCommandInstance(InstanceResource): + class Direction(object): TO_SIM = "to_sim" FROM_SIM = "from_sim" @@ -116,6 +117,7 @@ def __repr__(self) -> str: class SmsCommandContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the SmsCommandContext @@ -180,6 +182,7 @@ def __repr__(self) -> str: class SmsCommandPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> SmsCommandInstance: """ Build an instance of SmsCommandInstance @@ -198,6 +201,7 @@ def __repr__(self) -> str: class SmsCommandList(ListResource): + def __init__(self, version: Version): """ Initialize the SmsCommandList @@ -226,6 +230,7 @@ def create( :returns: The created SmsCommandInstance """ + data = values.of( { "Sim": sim, @@ -260,6 +265,7 @@ async def create_async( :returns: The created SmsCommandInstance """ + data = values.of( { "Sim": sim, diff --git a/twilio/rest/supersim/v1/usage_record.py b/twilio/rest/supersim/v1/usage_record.py index 19ba4989d..86a335d0d 100644 --- a/twilio/rest/supersim/v1/usage_record.py +++ b/twilio/rest/supersim/v1/usage_record.py @@ -23,6 +23,7 @@ class UsageRecordInstance(InstanceResource): + class Granularity(object): HOUR = "hour" DAY = "day" @@ -76,6 +77,7 @@ def __repr__(self) -> str: class UsageRecordPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> UsageRecordInstance: """ Build an instance of UsageRecordInstance @@ -94,6 +96,7 @@ def __repr__(self) -> str: class UsageRecordList(ListResource): + def __init__(self, version: Version): """ Initialize the UsageRecordList diff --git a/twilio/rest/sync/SyncBase.py b/twilio/rest/sync/SyncBase.py index 35c4fa984..113cac039 100644 --- a/twilio/rest/sync/SyncBase.py +++ b/twilio/rest/sync/SyncBase.py @@ -17,6 +17,7 @@ class SyncBase(Domain): + def __init__(self, twilio: Client): """ Initialize the Sync Domain diff --git a/twilio/rest/sync/v1/__init__.py b/twilio/rest/sync/v1/__init__.py index db6c47899..e98201bd4 100644 --- a/twilio/rest/sync/v1/__init__.py +++ b/twilio/rest/sync/v1/__init__.py @@ -19,6 +19,7 @@ class V1(Version): + def __init__(self, domain: Domain): """ Initialize the V1 version of Sync diff --git a/twilio/rest/sync/v1/service/__init__.py b/twilio/rest/sync/v1/service/__init__.py index 08434aec3..9fd7c22e3 100644 --- a/twilio/rest/sync/v1/service/__init__.py +++ b/twilio/rest/sync/v1/service/__init__.py @@ -237,6 +237,7 @@ def __repr__(self) -> str: class ServiceContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the ServiceContext @@ -464,6 +465,7 @@ def __repr__(self) -> str: class ServicePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ServiceInstance: """ Build an instance of ServiceInstance @@ -482,6 +484,7 @@ def __repr__(self) -> str: class ServiceList(ListResource): + def __init__(self, version: Version): """ Initialize the ServiceList @@ -516,6 +519,7 @@ def create( :returns: The created ServiceInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -559,6 +563,7 @@ 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 0cd5c918d..f3b89cfe6 100644 --- a/twilio/rest/sync/v1/service/document/__init__.py +++ b/twilio/rest/sync/v1/service/document/__init__.py @@ -187,6 +187,7 @@ def __repr__(self) -> str: class DocumentContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the DocumentContext @@ -370,6 +371,7 @@ def __repr__(self) -> str: class DocumentPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> DocumentInstance: """ Build an instance of DocumentInstance @@ -390,6 +392,7 @@ def __repr__(self) -> str: class DocumentList(ListResource): + def __init__(self, version: Version, service_sid: str): """ Initialize the DocumentList @@ -421,6 +424,7 @@ def create( :returns: The created DocumentInstance """ + data = values.of( { "UniqueName": unique_name, @@ -454,6 +458,7 @@ async def create_async( :returns: The created DocumentInstance """ + data = values.of( { "UniqueName": unique_name, diff --git a/twilio/rest/sync/v1/service/document/document_permission.py b/twilio/rest/sync/v1/service/document/document_permission.py index 0e9a3e29e..d8f157fb4 100644 --- a/twilio/rest/sync/v1/service/document/document_permission.py +++ b/twilio/rest/sync/v1/service/document/document_permission.py @@ -159,6 +159,7 @@ def __repr__(self) -> str: class DocumentPermissionContext(InstanceContext): + def __init__( self, version: Version, service_sid: str, document_sid: str, identity: str ): @@ -327,6 +328,7 @@ def __repr__(self) -> str: class DocumentPermissionPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> DocumentPermissionInstance: """ Build an instance of DocumentPermissionInstance @@ -350,6 +352,7 @@ def __repr__(self) -> str: class DocumentPermissionList(ListResource): + def __init__(self, version: Version, service_sid: str, document_sid: str): """ Initialize the DocumentPermissionList diff --git a/twilio/rest/sync/v1/service/sync_list/__init__.py b/twilio/rest/sync/v1/service/sync_list/__init__.py index da694eb36..7e9ca672c 100644 --- a/twilio/rest/sync/v1/service/sync_list/__init__.py +++ b/twilio/rest/sync/v1/service/sync_list/__init__.py @@ -187,6 +187,7 @@ def __repr__(self) -> str: class SyncListContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the SyncListContext @@ -374,6 +375,7 @@ def __repr__(self) -> str: class SyncListPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> SyncListInstance: """ Build an instance of SyncListInstance @@ -394,6 +396,7 @@ def __repr__(self) -> str: class SyncListList(ListResource): + def __init__(self, version: Version, service_sid: str): """ Initialize the SyncListList @@ -425,6 +428,7 @@ def create( :returns: The created SyncListInstance """ + data = values.of( { "UniqueName": unique_name, @@ -458,6 +462,7 @@ 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 859739591..02dafcd49 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 @@ -23,6 +23,7 @@ class SyncListItemInstance(InstanceResource): + class QueryFromBoundType(object): INCLUSIVE = "inclusive" EXCLUSIVE = "exclusive" @@ -204,6 +205,7 @@ def __repr__(self) -> str: class SyncListItemContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, list_sid: str, index: int): """ Initialize the SyncListItemContext @@ -402,6 +404,7 @@ def __repr__(self) -> str: class SyncListItemPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> SyncListItemInstance: """ Build an instance of SyncListItemInstance @@ -425,6 +428,7 @@ def __repr__(self) -> str: class SyncListItemList(ListResource): + def __init__(self, version: Version, service_sid: str, list_sid: str): """ Initialize the SyncListItemList @@ -462,6 +466,7 @@ def create( :returns: The created SyncListItemInstance """ + data = values.of( { "Data": serialize.object(data), @@ -501,6 +506,7 @@ async def create_async( :returns: The created SyncListItemInstance """ + data = values.of( { "Data": serialize.object(data), diff --git a/twilio/rest/sync/v1/service/sync_list/sync_list_permission.py b/twilio/rest/sync/v1/service/sync_list/sync_list_permission.py index 9b94b7fb5..228ab0d19 100644 --- a/twilio/rest/sync/v1/service/sync_list/sync_list_permission.py +++ b/twilio/rest/sync/v1/service/sync_list/sync_list_permission.py @@ -159,6 +159,7 @@ def __repr__(self) -> str: class SyncListPermissionContext(InstanceContext): + def __init__( self, version: Version, service_sid: str, list_sid: str, identity: str ): @@ -329,6 +330,7 @@ def __repr__(self) -> str: class SyncListPermissionPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> SyncListPermissionInstance: """ Build an instance of SyncListPermissionInstance @@ -352,6 +354,7 @@ def __repr__(self) -> str: class SyncListPermissionList(ListResource): + def __init__(self, version: Version, service_sid: str, list_sid: str): """ Initialize the SyncListPermissionList diff --git a/twilio/rest/sync/v1/service/sync_map/__init__.py b/twilio/rest/sync/v1/service/sync_map/__init__.py index 3147e502d..1a68e8ef4 100644 --- a/twilio/rest/sync/v1/service/sync_map/__init__.py +++ b/twilio/rest/sync/v1/service/sync_map/__init__.py @@ -187,6 +187,7 @@ def __repr__(self) -> str: class SyncMapContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the SyncMapContext @@ -374,6 +375,7 @@ def __repr__(self) -> str: class SyncMapPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> SyncMapInstance: """ Build an instance of SyncMapInstance @@ -394,6 +396,7 @@ def __repr__(self) -> str: class SyncMapList(ListResource): + def __init__(self, version: Version, service_sid: str): """ Initialize the SyncMapList @@ -425,6 +428,7 @@ def create( :returns: The created SyncMapInstance """ + data = values.of( { "UniqueName": unique_name, @@ -458,6 +462,7 @@ 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 0f7681600..7c621f8ad 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 @@ -23,6 +23,7 @@ class SyncMapItemInstance(InstanceResource): + class QueryFromBoundType(object): INCLUSIVE = "inclusive" EXCLUSIVE = "exclusive" @@ -204,6 +205,7 @@ def __repr__(self) -> str: class SyncMapItemContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, map_sid: str, key: str): """ Initialize the SyncMapItemContext @@ -402,6 +404,7 @@ def __repr__(self) -> str: class SyncMapItemPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> SyncMapItemInstance: """ Build an instance of SyncMapItemInstance @@ -425,6 +428,7 @@ def __repr__(self) -> str: class SyncMapItemList(ListResource): + def __init__(self, version: Version, service_sid: str, map_sid: str): """ Initialize the SyncMapItemList @@ -464,6 +468,7 @@ def create( :returns: The created SyncMapItemInstance """ + data = values.of( { "Key": key, @@ -506,6 +511,7 @@ async def create_async( :returns: The created SyncMapItemInstance """ + data = values.of( { "Key": key, diff --git a/twilio/rest/sync/v1/service/sync_map/sync_map_permission.py b/twilio/rest/sync/v1/service/sync_map/sync_map_permission.py index b983a77bb..3f204d65b 100644 --- a/twilio/rest/sync/v1/service/sync_map/sync_map_permission.py +++ b/twilio/rest/sync/v1/service/sync_map/sync_map_permission.py @@ -159,6 +159,7 @@ def __repr__(self) -> str: class SyncMapPermissionContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, map_sid: str, identity: str): """ Initialize the SyncMapPermissionContext @@ -327,6 +328,7 @@ def __repr__(self) -> str: class SyncMapPermissionPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> SyncMapPermissionInstance: """ Build an instance of SyncMapPermissionInstance @@ -350,6 +352,7 @@ def __repr__(self) -> str: class SyncMapPermissionList(ListResource): + def __init__(self, version: Version, service_sid: str, map_sid: str): """ Initialize the SyncMapPermissionList diff --git a/twilio/rest/sync/v1/service/sync_stream/__init__.py b/twilio/rest/sync/v1/service/sync_stream/__init__.py index f1146e9a8..aa10d164a 100644 --- a/twilio/rest/sync/v1/service/sync_stream/__init__.py +++ b/twilio/rest/sync/v1/service/sync_stream/__init__.py @@ -165,6 +165,7 @@ def __repr__(self) -> str: class SyncStreamContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the SyncStreamContext @@ -328,6 +329,7 @@ def __repr__(self) -> str: class SyncStreamPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> SyncStreamInstance: """ Build an instance of SyncStreamInstance @@ -348,6 +350,7 @@ def __repr__(self) -> str: class SyncStreamList(ListResource): + def __init__(self, version: Version, service_sid: str): """ Initialize the SyncStreamList @@ -377,6 +380,7 @@ def create( :returns: The created SyncStreamInstance """ + data = values.of( { "UniqueName": unique_name, @@ -407,6 +411,7 @@ 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 d525b8e2c..88a7604a7 100644 --- a/twilio/rest/sync/v1/service/sync_stream/stream_message.py +++ b/twilio/rest/sync/v1/service/sync_stream/stream_message.py @@ -54,6 +54,7 @@ def __repr__(self) -> str: class StreamMessageList(ListResource): + def __init__(self, version: Version, service_sid: str, stream_sid: str): """ Initialize the StreamMessageList @@ -82,6 +83,7 @@ def create(self, data: object) -> StreamMessageInstance: :returns: The created StreamMessageInstance """ + data = values.of( { "Data": serialize.object(data), @@ -109,6 +111,7 @@ 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/TaskrouterBase.py b/twilio/rest/taskrouter/TaskrouterBase.py index ee7fbfd7e..4bbbdb602 100644 --- a/twilio/rest/taskrouter/TaskrouterBase.py +++ b/twilio/rest/taskrouter/TaskrouterBase.py @@ -17,6 +17,7 @@ class TaskrouterBase(Domain): + def __init__(self, twilio: Client): """ Initialize the Taskrouter Domain diff --git a/twilio/rest/taskrouter/v1/__init__.py b/twilio/rest/taskrouter/v1/__init__.py index a331fb349..a17eeccc2 100644 --- a/twilio/rest/taskrouter/v1/__init__.py +++ b/twilio/rest/taskrouter/v1/__init__.py @@ -19,6 +19,7 @@ class V1(Version): + def __init__(self, domain: Domain): """ Initialize the V1 version of Taskrouter diff --git a/twilio/rest/taskrouter/v1/workspace/__init__.py b/twilio/rest/taskrouter/v1/workspace/__init__.py index fcdea4c37..0b0136fed 100644 --- a/twilio/rest/taskrouter/v1/workspace/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/__init__.py @@ -39,6 +39,7 @@ class WorkspaceInstance(InstanceResource): + class QueueOrder(object): FIFO = "FIFO" LIFO = "LIFO" @@ -295,6 +296,7 @@ def __repr__(self) -> str: class WorkspaceContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the WorkspaceContext @@ -604,6 +606,7 @@ def __repr__(self) -> str: class WorkspacePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> WorkspaceInstance: """ Build an instance of WorkspaceInstance @@ -622,6 +625,7 @@ def __repr__(self) -> str: class WorkspaceList(ListResource): + def __init__(self, version: Version): """ Initialize the WorkspaceList @@ -656,6 +660,7 @@ def create( :returns: The created WorkspaceInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -698,6 +703,7 @@ 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 79b4504fd..3ab15acf8 100644 --- a/twilio/rest/taskrouter/v1/workspace/activity.py +++ b/twilio/rest/taskrouter/v1/workspace/activity.py @@ -155,6 +155,7 @@ def __repr__(self) -> str: class ActivityContext(InstanceContext): + def __init__(self, version: Version, workspace_sid: str, sid: str): """ Initialize the ActivityContext @@ -307,6 +308,7 @@ def __repr__(self) -> str: class ActivityPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ActivityInstance: """ Build an instance of ActivityInstance @@ -327,6 +329,7 @@ def __repr__(self) -> str: class ActivityList(ListResource): + def __init__(self, version: Version, workspace_sid: str): """ Initialize the ActivityList @@ -354,6 +357,7 @@ def create( :returns: The created ActivityInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -382,6 +386,7 @@ async def create_async( :returns: The created ActivityInstance """ + data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/taskrouter/v1/workspace/event.py b/twilio/rest/taskrouter/v1/workspace/event.py index 1e55f2e9a..534d9cd12 100644 --- a/twilio/rest/taskrouter/v1/workspace/event.py +++ b/twilio/rest/taskrouter/v1/workspace/event.py @@ -123,6 +123,7 @@ def __repr__(self) -> str: class EventContext(InstanceContext): + def __init__(self, version: Version, workspace_sid: str, sid: str): """ Initialize the EventContext @@ -191,6 +192,7 @@ def __repr__(self) -> str: class EventPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> EventInstance: """ Build an instance of EventInstance @@ -211,6 +213,7 @@ def __repr__(self) -> str: class EventList(ListResource): + def __init__(self, version: Version, workspace_sid: str): """ Initialize the EventList diff --git a/twilio/rest/taskrouter/v1/workspace/task/__init__.py b/twilio/rest/taskrouter/v1/workspace/task/__init__.py index 49b3af73e..708db2510 100644 --- a/twilio/rest/taskrouter/v1/workspace/task/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/task/__init__.py @@ -24,6 +24,7 @@ class TaskInstance(InstanceResource): + class Status(object): PENDING = "pending" RESERVED = "reserved" @@ -37,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 [addon](https://www.twilio.com/docs/taskrouter/marketplace) data for all installed addons. + :ivar addons: An object that contains the [Add-on](https://www.twilio.com/docs/add-ons) data for all installed Add-ons. :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. @@ -253,6 +254,7 @@ def __repr__(self) -> str: class TaskContext(InstanceContext): + def __init__(self, version: Version, workspace_sid: str, sid: str): """ Initialize the TaskContext @@ -470,6 +472,7 @@ def __repr__(self) -> str: class TaskPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> TaskInstance: """ Build an instance of TaskInstance @@ -490,6 +493,7 @@ def __repr__(self) -> str: class TaskList(ListResource): + def __init__(self, version: Version, workspace_sid: str): """ Initialize the TaskList @@ -527,6 +531,7 @@ def create( :returns: The created TaskInstance """ + data = values.of( { "Timeout": timeout, @@ -569,6 +574,7 @@ async def create_async( :returns: The created TaskInstance """ + data = values.of( { "Timeout": timeout, @@ -618,7 +624,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 addons. If `true`, returns only Tasks with addons. If `false`, returns only Tasks without addons. + :param bool has_addons: Whether to read Tasks with Add-ons. If `true`, returns only Tasks with Add-ons. If `false`, returns only Tasks without Add-ons. :param limit: Upper limit for the number of records to return. stream() 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 @@ -672,7 +678,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 addons. If `true`, returns only Tasks with addons. If `false`, returns only Tasks without addons. + :param bool has_addons: Whether to read Tasks with Add-ons. If `true`, returns only Tasks with Add-ons. If `false`, returns only Tasks without Add-ons. :param limit: Upper limit for the number of records to return. stream() 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 @@ -725,7 +731,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 addons. If `true`, returns only Tasks with addons. If `false`, returns only Tasks without addons. + :param bool has_addons: Whether to read Tasks with Add-ons. If `true`, returns only Tasks with Add-ons. If `false`, returns only Tasks without Add-ons. :param limit: Upper limit for the number of records to return. list() guarantees 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 @@ -778,7 +784,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 addons. If `true`, returns only Tasks with addons. If `false`, returns only Tasks without addons. + :param bool has_addons: Whether to read Tasks with Add-ons. If `true`, returns only Tasks with Add-ons. If `false`, returns only Tasks without Add-ons. :param limit: Upper limit for the number of records to return. list() guarantees 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 @@ -832,7 +838,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 addons. If `true`, returns only Tasks with addons. If `false`, returns only Tasks without addons. + :param has_addons: Whether to read Tasks with Add-ons. If `true`, returns only Tasks with Add-ons. If `false`, returns only Tasks without Add-ons. :param page_token: PageToken provided by the API :param page_number: Page Number, this value is simply for client state :param page_size: Number of records to return, defaults to 50 @@ -886,7 +892,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 addons. If `true`, returns only Tasks with addons. If `false`, returns only Tasks without addons. + :param has_addons: Whether to read Tasks with Add-ons. If `true`, returns only Tasks with Add-ons. If `false`, returns only Tasks without Add-ons. :param page_token: PageToken provided by the API :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 e053ec801..7ac7807c0 100644 --- a/twilio/rest/taskrouter/v1/workspace/task/reservation.py +++ b/twilio/rest/taskrouter/v1/workspace/task/reservation.py @@ -23,6 +23,7 @@ class ReservationInstance(InstanceResource): + class CallStatus(object): INITIATED = "initiated" RINGING = "ringing" @@ -199,6 +200,7 @@ 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 @@ -257,6 +259,7 @@ 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 """ @@ -315,6 +318,7 @@ 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( @@ -379,6 +383,7 @@ 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 @@ -437,6 +442,7 @@ 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 """ @@ -495,6 +501,7 @@ 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: @@ -508,6 +515,7 @@ def __repr__(self) -> str: class ReservationContext(InstanceContext): + def __init__(self, version: Version, workspace_sid: str, task_sid: str, sid: str): """ Initialize the ReservationContext @@ -635,6 +643,7 @@ 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 @@ -693,6 +702,7 @@ 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 """ @@ -757,6 +767,7 @@ def update( "Supervisor": supervisor, "EndConferenceOnCustomerExit": end_conference_on_customer_exit, "BeepOnCustomerEntrance": beep_on_customer_entrance, + "JitterBufferSize": jitter_buffer_size, } ) headers = values.of( @@ -839,6 +850,7 @@ 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 @@ -897,6 +909,7 @@ 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 """ @@ -961,6 +974,7 @@ async def update_async( "Supervisor": supervisor, "EndConferenceOnCustomerExit": end_conference_on_customer_exit, "BeepOnCustomerEntrance": beep_on_customer_entrance, + "JitterBufferSize": jitter_buffer_size, } ) headers = values.of( @@ -992,6 +1006,7 @@ def __repr__(self) -> str: class ReservationPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ReservationInstance: """ Build an instance of ReservationInstance @@ -1015,6 +1030,7 @@ def __repr__(self) -> str: class ReservationList(ListResource): + def __init__(self, version: Version, workspace_sid: str, task_sid: str): """ Initialize the ReservationList diff --git a/twilio/rest/taskrouter/v1/workspace/task_channel.py b/twilio/rest/taskrouter/v1/workspace/task_channel.py index 6fd6f24f4..780c4ef9f 100644 --- a/twilio/rest/taskrouter/v1/workspace/task_channel.py +++ b/twilio/rest/taskrouter/v1/workspace/task_channel.py @@ -167,6 +167,7 @@ def __repr__(self) -> str: class TaskChannelContext(InstanceContext): + def __init__(self, version: Version, workspace_sid: str, sid: str): """ Initialize the TaskChannelContext @@ -327,6 +328,7 @@ def __repr__(self) -> str: class TaskChannelPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> TaskChannelInstance: """ Build an instance of TaskChannelInstance @@ -347,6 +349,7 @@ def __repr__(self) -> str: class TaskChannelList(ListResource): + def __init__(self, version: Version, workspace_sid: str): """ Initialize the TaskChannelList @@ -378,6 +381,7 @@ def create( :returns: The created TaskChannelInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -411,6 +415,7 @@ 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 d4ab32eb5..5c750d94c 100644 --- a/twilio/rest/taskrouter/v1/workspace/task_queue/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/task_queue/__init__.py @@ -35,6 +35,7 @@ class TaskQueueInstance(InstanceResource): + class TaskOrder(object): FIFO = "FIFO" LIFO = "LIFO" @@ -248,6 +249,7 @@ def __repr__(self) -> str: class TaskQueueContext(InstanceContext): + def __init__(self, version: Version, workspace_sid: str, sid: str): """ Initialize the TaskQueueContext @@ -475,6 +477,7 @@ def __repr__(self) -> str: class TaskQueuePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> TaskQueueInstance: """ Build an instance of TaskQueueInstance @@ -495,6 +498,7 @@ def __repr__(self) -> str: class TaskQueueList(ListResource): + def __init__(self, version: Version, workspace_sid: str): """ Initialize the TaskQueueList @@ -534,6 +538,7 @@ def create( :returns: The created TaskQueueInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -576,6 +581,7 @@ 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_cumulative_statistics.py b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.py index f910aa432..acb8b79a2 100644 --- a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.py @@ -204,6 +204,7 @@ def __repr__(self) -> str: class TaskQueueCumulativeStatisticsContext(InstanceContext): + def __init__(self, version: Version, workspace_sid: str, task_queue_sid: str): """ Initialize the TaskQueueCumulativeStatisticsContext @@ -316,6 +317,7 @@ def __repr__(self) -> str: class TaskQueueCumulativeStatisticsList(ListResource): + def __init__(self, version: Version, workspace_sid: str, task_queue_sid: str): """ Initialize the TaskQueueCumulativeStatisticsList 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 f8786d42b..faca80470 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 @@ -48,7 +48,7 @@ def __init__( super().__init__(version) self.account_sid: Optional[str] = payload.get("account_sid") - self.activity_statistics: Optional[List[object]] = payload.get( + self.activity_statistics: Optional[List[Dict[str, object]]] = payload.get( "activity_statistics" ) self.longest_task_waiting_age: Optional[int] = deserialize.integer( @@ -145,6 +145,7 @@ def __repr__(self) -> str: class TaskQueueRealTimeStatisticsContext(InstanceContext): + def __init__(self, version: Version, workspace_sid: str, task_queue_sid: str): """ Initialize the TaskQueueRealTimeStatisticsContext @@ -231,6 +232,7 @@ def __repr__(self) -> str: class TaskQueueRealTimeStatisticsList(ListResource): + def __init__(self, version: Version, workspace_sid: str, task_queue_sid: str): """ Initialize the TaskQueueRealTimeStatisticsList diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_statistics.py b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_statistics.py index 53543ec1d..2a09f62a6 100644 --- a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_statistics.py @@ -134,6 +134,7 @@ def __repr__(self) -> str: class TaskQueueStatisticsContext(InstanceContext): + def __init__(self, version: Version, workspace_sid: str, task_queue_sid: str): """ Initialize the TaskQueueStatisticsContext @@ -246,6 +247,7 @@ def __repr__(self) -> str: class TaskQueueStatisticsList(ListResource): + def __init__(self, version: Version, workspace_sid: str, task_queue_sid: str): """ Initialize the TaskQueueStatisticsList diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queues_statistics.py b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queues_statistics.py index 74768da3f..bec2d81b4 100644 --- a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queues_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queues_statistics.py @@ -55,6 +55,7 @@ def __repr__(self) -> str: class TaskQueuesStatisticsPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> TaskQueuesStatisticsInstance: """ Build an instance of TaskQueuesStatisticsInstance @@ -75,6 +76,7 @@ def __repr__(self) -> str: class TaskQueuesStatisticsList(ListResource): + def __init__(self, version: Version, workspace_sid: str): """ Initialize the TaskQueuesStatisticsList diff --git a/twilio/rest/taskrouter/v1/workspace/worker/__init__.py b/twilio/rest/taskrouter/v1/workspace/worker/__init__.py index 851b30346..a3ce2db7d 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/__init__.py @@ -232,6 +232,7 @@ def __repr__(self) -> str: class WorkerContext(InstanceContext): + def __init__(self, version: Version, workspace_sid: str, sid: str): """ Initialize the WorkerContext @@ -465,6 +466,7 @@ def __repr__(self) -> str: class WorkerPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> WorkerInstance: """ Build an instance of WorkerInstance @@ -485,6 +487,7 @@ def __repr__(self) -> str: class WorkerList(ListResource): + def __init__(self, version: Version, workspace_sid: str): """ Initialize the WorkerList @@ -520,6 +523,7 @@ def create( :returns: The created WorkerInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -553,6 +557,7 @@ 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 f95c2ad14..2f62c433e 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/reservation.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/reservation.py @@ -23,6 +23,7 @@ class ReservationInstance(InstanceResource): + class CallStatus(object): INITIATED = "initiated" RINGING = "ringing" @@ -190,6 +191,7 @@ 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 @@ -246,6 +248,7 @@ 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 """ @@ -302,6 +305,7 @@ 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( @@ -362,6 +366,7 @@ 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 @@ -418,6 +423,7 @@ 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 """ @@ -474,6 +480,7 @@ 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: @@ -487,6 +494,7 @@ def __repr__(self) -> str: class ReservationContext(InstanceContext): + def __init__(self, version: Version, workspace_sid: str, worker_sid: str, sid: str): """ Initialize the ReservationContext @@ -608,6 +616,7 @@ 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 @@ -664,6 +673,7 @@ 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 """ @@ -726,6 +736,7 @@ 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( @@ -804,6 +815,7 @@ 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 @@ -860,6 +872,7 @@ 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 """ @@ -922,6 +935,7 @@ 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( @@ -953,6 +967,7 @@ def __repr__(self) -> str: class ReservationPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ReservationInstance: """ Build an instance of ReservationInstance @@ -976,6 +991,7 @@ def __repr__(self) -> str: class ReservationList(ListResource): + def __init__(self, version: Version, workspace_sid: str, worker_sid: str): """ Initialize the ReservationList diff --git a/twilio/rest/taskrouter/v1/workspace/worker/worker_channel.py b/twilio/rest/taskrouter/v1/workspace/worker/worker_channel.py index d75955d5a..64f0c3afe 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/worker_channel.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/worker_channel.py @@ -164,6 +164,7 @@ def __repr__(self) -> str: class WorkerChannelContext(InstanceContext): + def __init__(self, version: Version, workspace_sid: str, worker_sid: str, sid: str): """ Initialize the WorkerChannelContext @@ -308,6 +309,7 @@ def __repr__(self) -> str: class WorkerChannelPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> WorkerChannelInstance: """ Build an instance of WorkerChannelInstance @@ -331,6 +333,7 @@ def __repr__(self) -> str: class WorkerChannelList(ListResource): + def __init__(self, version: Version, workspace_sid: str, worker_sid: str): """ Initialize the WorkerChannelList diff --git a/twilio/rest/taskrouter/v1/workspace/worker/worker_statistics.py b/twilio/rest/taskrouter/v1/workspace/worker/worker_statistics.py index 591d72fb7..61618d296 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/worker_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/worker_statistics.py @@ -126,6 +126,7 @@ def __repr__(self) -> str: class WorkerStatisticsContext(InstanceContext): + def __init__(self, version: Version, workspace_sid: str, worker_sid: str): """ Initialize the WorkerStatisticsContext @@ -232,6 +233,7 @@ def __repr__(self) -> str: class WorkerStatisticsList(ListResource): + def __init__(self, version: Version, workspace_sid: str, worker_sid: str): """ Initialize the WorkerStatisticsList 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 ecb5fe9a0..b18e7f123 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.py @@ -47,7 +47,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[object]] = payload.get( + self.activity_durations: Optional[List[Dict[str, object]]] = payload.get( "activity_durations" ) self.reservations_created: Optional[int] = deserialize.integer( @@ -152,6 +152,7 @@ def __repr__(self) -> str: class WorkersCumulativeStatisticsContext(InstanceContext): + def __init__(self, version: Version, workspace_sid: str): """ Initialize the WorkersCumulativeStatisticsContext @@ -254,6 +255,7 @@ def __repr__(self) -> str: class WorkersCumulativeStatisticsList(ListResource): + def __init__(self, version: Version, workspace_sid: str): """ Initialize the WorkersCumulativeStatisticsList 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 5fb8ce12c..277889ae7 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 @@ -33,7 +33,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[object]] = payload.get( + self.activity_statistics: Optional[List[Dict[str, object]]] = payload.get( "activity_statistics" ) self.total_workers: Optional[int] = deserialize.integer( @@ -103,6 +103,7 @@ def __repr__(self) -> str: class WorkersRealTimeStatisticsContext(InstanceContext): + def __init__(self, version: Version, workspace_sid: str): """ Initialize the WorkersRealTimeStatisticsContext @@ -185,6 +186,7 @@ def __repr__(self) -> str: class WorkersRealTimeStatisticsList(ListResource): + def __init__(self, version: Version, workspace_sid: str): """ Initialize the WorkersRealTimeStatisticsList diff --git a/twilio/rest/taskrouter/v1/workspace/worker/workers_statistics.py b/twilio/rest/taskrouter/v1/workspace/worker/workers_statistics.py index 78feeda3f..0cd09ec12 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/workers_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/workers_statistics.py @@ -136,6 +136,7 @@ def __repr__(self) -> str: class WorkersStatisticsContext(InstanceContext): + def __init__(self, version: Version, workspace_sid: str): """ Initialize the WorkersStatisticsContext @@ -254,6 +255,7 @@ def __repr__(self) -> str: class WorkersStatisticsList(ListResource): + def __init__(self, version: Version, workspace_sid: str): """ Initialize the WorkersStatisticsList diff --git a/twilio/rest/taskrouter/v1/workspace/workflow/__init__.py b/twilio/rest/taskrouter/v1/workspace/workflow/__init__.py index e12a42748..f01e76d37 100644 --- a/twilio/rest/taskrouter/v1/workspace/workflow/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/workflow/__init__.py @@ -231,6 +231,7 @@ def __repr__(self) -> str: class WorkflowContext(InstanceContext): + def __init__(self, version: Version, workspace_sid: str, sid: str): """ Initialize the WorkflowContext @@ -458,6 +459,7 @@ def __repr__(self) -> str: class WorkflowPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> WorkflowInstance: """ Build an instance of WorkflowInstance @@ -478,6 +480,7 @@ def __repr__(self) -> str: class WorkflowList(ListResource): + def __init__(self, version: Version, workspace_sid: str): """ Initialize the WorkflowList @@ -513,6 +516,7 @@ def create( :returns: The created WorkflowInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -552,6 +556,7 @@ async def create_async( :returns: The created WorkflowInstance """ + data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.py b/twilio/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.py index 3fa89fdf0..e06cab011 100644 --- a/twilio/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.py @@ -204,6 +204,7 @@ def __repr__(self) -> str: class WorkflowCumulativeStatisticsContext(InstanceContext): + def __init__(self, version: Version, workspace_sid: str, workflow_sid: str): """ Initialize the WorkflowCumulativeStatisticsContext @@ -316,6 +317,7 @@ def __repr__(self) -> str: class WorkflowCumulativeStatisticsList(ListResource): + def __init__(self, version: Version, workspace_sid: str, workflow_sid: str): """ Initialize the WorkflowCumulativeStatisticsList diff --git a/twilio/rest/taskrouter/v1/workspace/workflow/workflow_real_time_statistics.py b/twilio/rest/taskrouter/v1/workspace/workflow/workflow_real_time_statistics.py index 9c21c0e47..415d4223e 100644 --- a/twilio/rest/taskrouter/v1/workspace/workflow/workflow_real_time_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/workflow/workflow_real_time_statistics.py @@ -125,6 +125,7 @@ def __repr__(self) -> str: class WorkflowRealTimeStatisticsContext(InstanceContext): + def __init__(self, version: Version, workspace_sid: str, workflow_sid: str): """ Initialize the WorkflowRealTimeStatisticsContext @@ -211,6 +212,7 @@ def __repr__(self) -> str: class WorkflowRealTimeStatisticsList(ListResource): + def __init__(self, version: Version, workspace_sid: str, workflow_sid: str): """ Initialize the WorkflowRealTimeStatisticsList diff --git a/twilio/rest/taskrouter/v1/workspace/workflow/workflow_statistics.py b/twilio/rest/taskrouter/v1/workspace/workflow/workflow_statistics.py index 087ed816e..f86590e40 100644 --- a/twilio/rest/taskrouter/v1/workspace/workflow/workflow_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/workflow/workflow_statistics.py @@ -134,6 +134,7 @@ def __repr__(self) -> str: class WorkflowStatisticsContext(InstanceContext): + def __init__(self, version: Version, workspace_sid: str, workflow_sid: str): """ Initialize the WorkflowStatisticsContext @@ -246,6 +247,7 @@ def __repr__(self) -> str: class WorkflowStatisticsList(ListResource): + def __init__(self, version: Version, workspace_sid: str, workflow_sid: str): """ Initialize the WorkflowStatisticsList diff --git a/twilio/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.py b/twilio/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.py index b13c11d00..2b223641a 100644 --- a/twilio/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.py @@ -194,6 +194,7 @@ def __repr__(self) -> str: class WorkspaceCumulativeStatisticsContext(InstanceContext): + def __init__(self, version: Version, workspace_sid: str): """ Initialize the WorkspaceCumulativeStatisticsContext @@ -302,6 +303,7 @@ def __repr__(self) -> str: class WorkspaceCumulativeStatisticsList(ListResource): + def __init__(self, version: Version, workspace_sid: str): """ Initialize the WorkspaceCumulativeStatisticsList 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 92e2b5075..35b50c0b2 100644 --- a/twilio/rest/taskrouter/v1/workspace/workspace_real_time_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/workspace_real_time_statistics.py @@ -38,7 +38,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[object]] = payload.get( + self.activity_statistics: Optional[List[Dict[str, object]]] = payload.get( "activity_statistics" ) self.longest_task_waiting_age: Optional[int] = deserialize.integer( @@ -123,6 +123,7 @@ def __repr__(self) -> str: class WorkspaceRealTimeStatisticsContext(InstanceContext): + def __init__(self, version: Version, workspace_sid: str): """ Initialize the WorkspaceRealTimeStatisticsContext @@ -205,6 +206,7 @@ def __repr__(self) -> str: class WorkspaceRealTimeStatisticsList(ListResource): + def __init__(self, version: Version, workspace_sid: str): """ Initialize the WorkspaceRealTimeStatisticsList diff --git a/twilio/rest/taskrouter/v1/workspace/workspace_statistics.py b/twilio/rest/taskrouter/v1/workspace/workspace_statistics.py index 5dd18d928..19eb88567 100644 --- a/twilio/rest/taskrouter/v1/workspace/workspace_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/workspace_statistics.py @@ -124,6 +124,7 @@ def __repr__(self) -> str: class WorkspaceStatisticsContext(InstanceContext): + def __init__(self, version: Version, workspace_sid: str): """ Initialize the WorkspaceStatisticsContext @@ -228,6 +229,7 @@ def __repr__(self) -> str: class WorkspaceStatisticsList(ListResource): + def __init__(self, version: Version, workspace_sid: str): """ Initialize the WorkspaceStatisticsList diff --git a/twilio/rest/trunking/TrunkingBase.py b/twilio/rest/trunking/TrunkingBase.py index 627790454..bed8f9a2a 100644 --- a/twilio/rest/trunking/TrunkingBase.py +++ b/twilio/rest/trunking/TrunkingBase.py @@ -17,6 +17,7 @@ class TrunkingBase(Domain): + def __init__(self, twilio: Client): """ Initialize the Trunking Domain diff --git a/twilio/rest/trunking/v1/__init__.py b/twilio/rest/trunking/v1/__init__.py index 89dc5c108..af530b97c 100644 --- a/twilio/rest/trunking/v1/__init__.py +++ b/twilio/rest/trunking/v1/__init__.py @@ -19,6 +19,7 @@ class V1(Version): + def __init__(self, domain: Domain): """ Initialize the V1 version of Trunking diff --git a/twilio/rest/trunking/v1/trunk/__init__.py b/twilio/rest/trunking/v1/trunk/__init__.py index 954290932..935ce2718 100644 --- a/twilio/rest/trunking/v1/trunk/__init__.py +++ b/twilio/rest/trunking/v1/trunk/__init__.py @@ -28,6 +28,7 @@ class TrunkInstance(InstanceResource): + class TransferCallerId(object): FROM_TRANSFEREE = "from-transferee" FROM_TRANSFEROR = "from-transferor" @@ -268,6 +269,7 @@ def __repr__(self) -> str: class TrunkContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the TrunkContext @@ -518,6 +520,7 @@ def __repr__(self) -> str: class TrunkPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> TrunkInstance: """ Build an instance of TrunkInstance @@ -536,6 +539,7 @@ def __repr__(self) -> str: class TrunkList(ListResource): + def __init__(self, version: Version): """ Initialize the TrunkList @@ -574,6 +578,7 @@ def create( :returns: The created TrunkInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -622,6 +627,7 @@ 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 cdfb5de7b..7dc043d28 100644 --- a/twilio/rest/trunking/v1/trunk/credential_list.py +++ b/twilio/rest/trunking/v1/trunk/credential_list.py @@ -123,6 +123,7 @@ def __repr__(self) -> str: class CredentialListContext(InstanceContext): + def __init__(self, version: Version, trunk_sid: str, sid: str): """ Initialize the CredentialListContext @@ -215,6 +216,7 @@ def __repr__(self) -> str: class CredentialListPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> CredentialListInstance: """ Build an instance of CredentialListInstance @@ -235,6 +237,7 @@ def __repr__(self) -> str: class CredentialListList(ListResource): + def __init__(self, version: Version, trunk_sid: str): """ Initialize the CredentialListList @@ -259,6 +262,7 @@ def create(self, credential_list_sid: str) -> CredentialListInstance: :returns: The created CredentialListInstance """ + data = values.of( { "CredentialListSid": credential_list_sid, @@ -283,6 +287,7 @@ 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 7f9b51a7a..b361e7fe9 100644 --- a/twilio/rest/trunking/v1/trunk/ip_access_control_list.py +++ b/twilio/rest/trunking/v1/trunk/ip_access_control_list.py @@ -123,6 +123,7 @@ def __repr__(self) -> str: class IpAccessControlListContext(InstanceContext): + def __init__(self, version: Version, trunk_sid: str, sid: str): """ Initialize the IpAccessControlListContext @@ -217,6 +218,7 @@ def __repr__(self) -> str: class IpAccessControlListPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> IpAccessControlListInstance: """ Build an instance of IpAccessControlListInstance @@ -237,6 +239,7 @@ def __repr__(self) -> str: class IpAccessControlListList(ListResource): + def __init__(self, version: Version, trunk_sid: str): """ Initialize the IpAccessControlListList @@ -261,6 +264,7 @@ def create(self, ip_access_control_list_sid: str) -> IpAccessControlListInstance :returns: The created IpAccessControlListInstance """ + data = values.of( { "IpAccessControlListSid": ip_access_control_list_sid, @@ -287,6 +291,7 @@ 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 27f451d2d..426938995 100644 --- a/twilio/rest/trunking/v1/trunk/origination_url.py +++ b/twilio/rest/trunking/v1/trunk/origination_url.py @@ -185,6 +185,7 @@ def __repr__(self) -> str: class OriginationUrlContext(InstanceContext): + def __init__(self, version: Version, trunk_sid: str, sid: str): """ Initialize the OriginationUrlContext @@ -361,6 +362,7 @@ def __repr__(self) -> str: class OriginationUrlPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> OriginationUrlInstance: """ Build an instance of OriginationUrlInstance @@ -381,6 +383,7 @@ def __repr__(self) -> str: class OriginationUrlList(ListResource): + def __init__(self, version: Version, trunk_sid: str): """ Initialize the OriginationUrlList @@ -416,6 +419,7 @@ def create( :returns: The created OriginationUrlInstance """ + data = values.of( { "Weight": weight, @@ -455,6 +459,7 @@ 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 06f9ded10..7f0adbeef 100644 --- a/twilio/rest/trunking/v1/trunk/phone_number.py +++ b/twilio/rest/trunking/v1/trunk/phone_number.py @@ -23,6 +23,7 @@ class PhoneNumberInstance(InstanceResource): + class AddressRequirement(object): NONE = "none" ANY = "any" @@ -173,6 +174,7 @@ def __repr__(self) -> str: class PhoneNumberContext(InstanceContext): + def __init__(self, version: Version, trunk_sid: str, sid: str): """ Initialize the PhoneNumberContext @@ -265,6 +267,7 @@ def __repr__(self) -> str: class PhoneNumberPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> PhoneNumberInstance: """ Build an instance of PhoneNumberInstance @@ -285,6 +288,7 @@ def __repr__(self) -> str: class PhoneNumberList(ListResource): + def __init__(self, version: Version, trunk_sid: str): """ Initialize the PhoneNumberList @@ -309,6 +313,7 @@ def create(self, phone_number_sid: str) -> PhoneNumberInstance: :returns: The created PhoneNumberInstance """ + data = values.of( { "PhoneNumberSid": phone_number_sid, @@ -333,6 +338,7 @@ 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/trunking/v1/trunk/recording.py b/twilio/rest/trunking/v1/trunk/recording.py index 7d03f6cda..1a431b496 100644 --- a/twilio/rest/trunking/v1/trunk/recording.py +++ b/twilio/rest/trunking/v1/trunk/recording.py @@ -21,6 +21,7 @@ class RecordingInstance(InstanceResource): + class RecordingMode(object): DO_NOT_RECORD = "do-not-record" RECORD_FROM_RINGING = "record-from-ringing" @@ -128,6 +129,7 @@ def __repr__(self) -> str: class RecordingContext(InstanceContext): + def __init__(self, version: Version, trunk_sid: str): """ Initialize the RecordingContext @@ -252,6 +254,7 @@ def __repr__(self) -> str: class RecordingList(ListResource): + def __init__(self, version: Version, trunk_sid: str): """ Initialize the RecordingList diff --git a/twilio/rest/trusthub/TrusthubBase.py b/twilio/rest/trusthub/TrusthubBase.py index f58cc7cfe..97fd32f9b 100644 --- a/twilio/rest/trusthub/TrusthubBase.py +++ b/twilio/rest/trusthub/TrusthubBase.py @@ -17,6 +17,7 @@ class TrusthubBase(Domain): + def __init__(self, twilio: Client): """ Initialize the Trusthub Domain diff --git a/twilio/rest/trusthub/v1/__init__.py b/twilio/rest/trusthub/v1/__init__.py index 10c3fd825..596c5ea75 100644 --- a/twilio/rest/trusthub/v1/__init__.py +++ b/twilio/rest/trusthub/v1/__init__.py @@ -16,6 +16,12 @@ 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_registration_inquiries import ( + ComplianceRegistrationInquiriesList, +) +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 @@ -26,6 +32,7 @@ class V1(Version): + def __init__(self, domain: Domain): """ Initialize the V1 version of Trusthub @@ -34,6 +41,12 @@ def __init__(self, domain: Domain): """ super().__init__(domain, "v1") self._compliance_inquiries: Optional[ComplianceInquiriesList] = None + self._compliance_registration_inquiries: Optional[ + ComplianceRegistrationInquiriesList + ] = 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 @@ -48,6 +61,20 @@ def compliance_inquiries(self) -> ComplianceInquiriesList: self._compliance_inquiries = ComplianceInquiriesList(self) return self._compliance_inquiries + @property + def compliance_registration_inquiries(self) -> ComplianceRegistrationInquiriesList: + if self._compliance_registration_inquiries is None: + self._compliance_registration_inquiries = ( + ComplianceRegistrationInquiriesList(self) + ) + return self._compliance_registration_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 41d061bdb..b1b52a4f7 100644 --- a/twilio/rest/trusthub/v1/compliance_inquiries.py +++ b/twilio/rest/trusthub/v1/compliance_inquiries.py @@ -12,7 +12,7 @@ Do not edit the class manually. """ -from typing import Any, Dict, Optional +from typing import Any, Dict, Optional, Union from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -98,6 +98,7 @@ def __repr__(self) -> str: class ComplianceInquiriesContext(InstanceContext): + def __init__(self, version: Version, customer_id: str): """ Initialize the ComplianceInquiriesContext @@ -176,6 +177,7 @@ def __repr__(self) -> str: class ComplianceInquiriesList(ListResource): + def __init__(self, version: Version): """ Initialize the ComplianceInquiriesList @@ -187,17 +189,24 @@ def __init__(self, version: Version): self._uri = "/ComplianceInquiries/Customers/Initialize" - def create(self, primary_profile_sid: str) -> ComplianceInquiriesInstance: + def create( + self, + primary_profile_sid: str, + notification_email: Union[str, object] = values.unset, + ) -> ComplianceInquiriesInstance: """ Create the ComplianceInquiriesInstance :param primary_profile_sid: The unique SID identifier of the Primary Customer Profile that should be used as a parent. Only necessary when creating a secondary Customer Profile. + :param notification_email: The email address that approval status updates will be sent to. If not specified, the email address associated with your primary customer profile will be used. :returns: The created ComplianceInquiriesInstance """ + data = values.of( { "PrimaryProfileSid": primary_profile_sid, + "NotificationEmail": notification_email, } ) @@ -210,18 +219,23 @@ def create(self, primary_profile_sid: str) -> ComplianceInquiriesInstance: return ComplianceInquiriesInstance(self._version, payload) async def create_async( - self, primary_profile_sid: str + self, + primary_profile_sid: str, + notification_email: Union[str, object] = values.unset, ) -> ComplianceInquiriesInstance: """ Asynchronously create the ComplianceInquiriesInstance :param primary_profile_sid: The unique SID identifier of the Primary Customer Profile that should be used as a parent. Only necessary when creating a secondary Customer Profile. + :param notification_email: The email address that approval status updates will be sent to. If not specified, the email address associated with your primary customer profile will be used. :returns: The created ComplianceInquiriesInstance """ + data = values.of( { "PrimaryProfileSid": primary_profile_sid, + "NotificationEmail": notification_email, } ) diff --git a/twilio/rest/trusthub/v1/compliance_registration_inquiries.py b/twilio/rest/trusthub/v1/compliance_registration_inquiries.py new file mode 100644 index 000000000..264dd4ae3 --- /dev/null +++ b/twilio/rest/trusthub/v1/compliance_registration_inquiries.py @@ -0,0 +1,316 @@ +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, Optional, Union +from twilio.base import values + +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class ComplianceRegistrationInquiriesInstance(InstanceResource): + + class BusinessIdentityType(object): + DIRECT_CUSTOMER = "direct_customer" + ISV_RESELLER_OR_PARTNER = "isv_reseller_or_partner" + UNKNOWN = "unknown" + + class EndUserType(object): + INDIVIDUAL = "Individual" + BUSINESS = "Business" + + class PhoneNumberType(object): + LOCAL = "local" + NATIONAL = "national" + MOBILE = "mobile" + TOLL_FREE = "toll-free" + + """ + :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 RegistrationId matching the Registration 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 ComplianceRegistrationInquiriesList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the ComplianceRegistrationInquiriesList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = ( + "/ComplianceInquiries/Registration/RegulatoryCompliance/GB/Initialize" + ) + + def create( + self, + end_user_type: "ComplianceRegistrationInquiriesInstance.EndUserType", + phone_number_type: "ComplianceRegistrationInquiriesInstance.PhoneNumberType", + business_identity_type: Union[ + "ComplianceRegistrationInquiriesInstance.BusinessIdentityType", object + ] = values.unset, + business_registration_authority: Union[str, object] = values.unset, + business_legal_name: Union[str, object] = values.unset, + notification_email: Union[str, object] = values.unset, + accepted_notification_receipt: Union[bool, object] = values.unset, + business_registration_number: Union[str, object] = values.unset, + business_website_url: Union[str, object] = values.unset, + friendly_name: Union[str, object] = values.unset, + authorized_representative1_first_name: Union[str, object] = values.unset, + authorized_representative1_last_name: Union[str, object] = values.unset, + authorized_representative1_phone: Union[str, object] = values.unset, + authorized_representative1_email: Union[str, object] = values.unset, + authorized_representative1_date_of_birth: Union[str, object] = values.unset, + address_street: Union[str, object] = values.unset, + address_street_secondary: Union[str, object] = values.unset, + address_city: Union[str, object] = values.unset, + address_subdivision: Union[str, object] = values.unset, + address_postal_code: Union[str, object] = values.unset, + address_country_code: Union[str, object] = values.unset, + emergency_address_street: Union[str, object] = values.unset, + emergency_address_street_secondary: Union[str, object] = values.unset, + emergency_address_city: Union[str, object] = values.unset, + emergency_address_subdivision: Union[str, object] = values.unset, + emergency_address_postal_code: Union[str, object] = values.unset, + emergency_address_country_code: Union[str, object] = values.unset, + use_address_as_emergency_address: Union[bool, object] = values.unset, + file_name: Union[str, object] = values.unset, + file: Union[str, object] = values.unset, + ) -> ComplianceRegistrationInquiriesInstance: + """ + Create the ComplianceRegistrationInquiriesInstance + + :param end_user_type: + :param phone_number_type: + :param business_identity_type: + :param business_registration_authority: The authority that registered the business + :param business_legal_name: he name of the business or organization using the Tollfree number. + :param notification_email: he email address to receive the notification about the verification result. + :param accepted_notification_receipt: The email address to receive the notification about the verification result. + :param business_registration_number: Business registration number of the business + :param business_website_url: The URL of the business website + :param friendly_name: Friendly name for your business information + :param authorized_representative1_first_name: First name of the authorized representative + :param authorized_representative1_last_name: Last name of the authorized representative + :param authorized_representative1_phone: Phone number of the authorized representative + :param authorized_representative1_email: Email address of the authorized representative + :param authorized_representative1_date_of_birth: Birthdate of the authorized representative + :param address_street: Street address of the business + :param address_street_secondary: Street address of the business + :param address_city: City of the business + :param address_subdivision: State or province of the business + :param address_postal_code: Postal code of the business + :param address_country_code: Country code of the business + :param emergency_address_street: Street address of the business + :param emergency_address_street_secondary: Street address of the business + :param emergency_address_city: City of the business + :param emergency_address_subdivision: State or province of the business + :param emergency_address_postal_code: Postal code of the business + :param emergency_address_country_code: Country code of the business + :param use_address_as_emergency_address: Use the business address as the emergency address + :param file_name: The name of the verification document to upload + :param file: The verification document to upload + + :returns: The created ComplianceRegistrationInquiriesInstance + """ + + data = values.of( + { + "EndUserType": end_user_type, + "PhoneNumberType": phone_number_type, + "BusinessIdentityType": business_identity_type, + "BusinessRegistrationAuthority": business_registration_authority, + "BusinessLegalName": business_legal_name, + "NotificationEmail": notification_email, + "AcceptedNotificationReceipt": accepted_notification_receipt, + "BusinessRegistrationNumber": business_registration_number, + "BusinessWebsiteUrl": business_website_url, + "FriendlyName": friendly_name, + "AuthorizedRepresentative1FirstName": authorized_representative1_first_name, + "AuthorizedRepresentative1LastName": authorized_representative1_last_name, + "AuthorizedRepresentative1Phone": authorized_representative1_phone, + "AuthorizedRepresentative1Email": authorized_representative1_email, + "AuthorizedRepresentative1DateOfBirth": authorized_representative1_date_of_birth, + "AddressStreet": address_street, + "AddressStreetSecondary": address_street_secondary, + "AddressCity": address_city, + "AddressSubdivision": address_subdivision, + "AddressPostalCode": address_postal_code, + "AddressCountryCode": address_country_code, + "EmergencyAddressStreet": emergency_address_street, + "EmergencyAddressStreetSecondary": emergency_address_street_secondary, + "EmergencyAddressCity": emergency_address_city, + "EmergencyAddressSubdivision": emergency_address_subdivision, + "EmergencyAddressPostalCode": emergency_address_postal_code, + "EmergencyAddressCountryCode": emergency_address_country_code, + "UseAddressAsEmergencyAddress": use_address_as_emergency_address, + "FileName": file_name, + "File": file, + } + ) + + payload = self._version.create( + method="POST", + uri=self._uri, + data=data, + ) + + return ComplianceRegistrationInquiriesInstance(self._version, payload) + + async def create_async( + self, + end_user_type: "ComplianceRegistrationInquiriesInstance.EndUserType", + phone_number_type: "ComplianceRegistrationInquiriesInstance.PhoneNumberType", + business_identity_type: Union[ + "ComplianceRegistrationInquiriesInstance.BusinessIdentityType", object + ] = values.unset, + business_registration_authority: Union[str, object] = values.unset, + business_legal_name: Union[str, object] = values.unset, + notification_email: Union[str, object] = values.unset, + accepted_notification_receipt: Union[bool, object] = values.unset, + business_registration_number: Union[str, object] = values.unset, + business_website_url: Union[str, object] = values.unset, + friendly_name: Union[str, object] = values.unset, + authorized_representative1_first_name: Union[str, object] = values.unset, + authorized_representative1_last_name: Union[str, object] = values.unset, + authorized_representative1_phone: Union[str, object] = values.unset, + authorized_representative1_email: Union[str, object] = values.unset, + authorized_representative1_date_of_birth: Union[str, object] = values.unset, + address_street: Union[str, object] = values.unset, + address_street_secondary: Union[str, object] = values.unset, + address_city: Union[str, object] = values.unset, + address_subdivision: Union[str, object] = values.unset, + address_postal_code: Union[str, object] = values.unset, + address_country_code: Union[str, object] = values.unset, + emergency_address_street: Union[str, object] = values.unset, + emergency_address_street_secondary: Union[str, object] = values.unset, + emergency_address_city: Union[str, object] = values.unset, + emergency_address_subdivision: Union[str, object] = values.unset, + emergency_address_postal_code: Union[str, object] = values.unset, + emergency_address_country_code: Union[str, object] = values.unset, + use_address_as_emergency_address: Union[bool, object] = values.unset, + file_name: Union[str, object] = values.unset, + file: Union[str, object] = values.unset, + ) -> ComplianceRegistrationInquiriesInstance: + """ + Asynchronously create the ComplianceRegistrationInquiriesInstance + + :param end_user_type: + :param phone_number_type: + :param business_identity_type: + :param business_registration_authority: The authority that registered the business + :param business_legal_name: he name of the business or organization using the Tollfree number. + :param notification_email: he email address to receive the notification about the verification result. + :param accepted_notification_receipt: The email address to receive the notification about the verification result. + :param business_registration_number: Business registration number of the business + :param business_website_url: The URL of the business website + :param friendly_name: Friendly name for your business information + :param authorized_representative1_first_name: First name of the authorized representative + :param authorized_representative1_last_name: Last name of the authorized representative + :param authorized_representative1_phone: Phone number of the authorized representative + :param authorized_representative1_email: Email address of the authorized representative + :param authorized_representative1_date_of_birth: Birthdate of the authorized representative + :param address_street: Street address of the business + :param address_street_secondary: Street address of the business + :param address_city: City of the business + :param address_subdivision: State or province of the business + :param address_postal_code: Postal code of the business + :param address_country_code: Country code of the business + :param emergency_address_street: Street address of the business + :param emergency_address_street_secondary: Street address of the business + :param emergency_address_city: City of the business + :param emergency_address_subdivision: State or province of the business + :param emergency_address_postal_code: Postal code of the business + :param emergency_address_country_code: Country code of the business + :param use_address_as_emergency_address: Use the business address as the emergency address + :param file_name: The name of the verification document to upload + :param file: The verification document to upload + + :returns: The created ComplianceRegistrationInquiriesInstance + """ + + data = values.of( + { + "EndUserType": end_user_type, + "PhoneNumberType": phone_number_type, + "BusinessIdentityType": business_identity_type, + "BusinessRegistrationAuthority": business_registration_authority, + "BusinessLegalName": business_legal_name, + "NotificationEmail": notification_email, + "AcceptedNotificationReceipt": accepted_notification_receipt, + "BusinessRegistrationNumber": business_registration_number, + "BusinessWebsiteUrl": business_website_url, + "FriendlyName": friendly_name, + "AuthorizedRepresentative1FirstName": authorized_representative1_first_name, + "AuthorizedRepresentative1LastName": authorized_representative1_last_name, + "AuthorizedRepresentative1Phone": authorized_representative1_phone, + "AuthorizedRepresentative1Email": authorized_representative1_email, + "AuthorizedRepresentative1DateOfBirth": authorized_representative1_date_of_birth, + "AddressStreet": address_street, + "AddressStreetSecondary": address_street_secondary, + "AddressCity": address_city, + "AddressSubdivision": address_subdivision, + "AddressPostalCode": address_postal_code, + "AddressCountryCode": address_country_code, + "EmergencyAddressStreet": emergency_address_street, + "EmergencyAddressStreetSecondary": emergency_address_street_secondary, + "EmergencyAddressCity": emergency_address_city, + "EmergencyAddressSubdivision": emergency_address_subdivision, + "EmergencyAddressPostalCode": emergency_address_postal_code, + "EmergencyAddressCountryCode": emergency_address_country_code, + "UseAddressAsEmergencyAddress": use_address_as_emergency_address, + "FileName": file_name, + "File": file, + } + ) + + payload = await self._version.create_async( + method="POST", + uri=self._uri, + data=data, + ) + + return ComplianceRegistrationInquiriesInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/trusthub/v1/compliance_tollfree_inquiries.py b/twilio/rest/trusthub/v1/compliance_tollfree_inquiries.py new file mode 100644 index 000000000..6c9d5b3d9 --- /dev/null +++ b/twilio/rest/trusthub/v1/compliance_tollfree_inquiries.py @@ -0,0 +1,252 @@ +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 515820678..a16ae0e73 100644 --- a/twilio/rest/trusthub/v1/customer_profiles/__init__.py +++ b/twilio/rest/trusthub/v1/customer_profiles/__init__.py @@ -32,6 +32,7 @@ class CustomerProfilesInstance(InstanceResource): + class Status(object): DRAFT = "draft" PENDING_REVIEW = "pending-review" @@ -218,6 +219,7 @@ def __repr__(self) -> str: class CustomerProfilesContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the CustomerProfilesContext @@ -432,6 +434,7 @@ def __repr__(self) -> str: class CustomerProfilesPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> CustomerProfilesInstance: """ Build an instance of CustomerProfilesInstance @@ -450,6 +453,7 @@ def __repr__(self) -> str: class CustomerProfilesList(ListResource): + def __init__(self, version: Version): """ Initialize the CustomerProfilesList @@ -478,6 +482,7 @@ def create( :returns: The created CustomerProfilesInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -512,6 +517,7 @@ 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 36005dc32..4cb14c5cc 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 @@ -123,6 +123,7 @@ def __repr__(self) -> str: class CustomerProfilesChannelEndpointAssignmentContext(InstanceContext): + def __init__(self, version: Version, customer_profile_sid: str, sid: str): """ Initialize the CustomerProfilesChannelEndpointAssignmentContext @@ -219,6 +220,7 @@ def __repr__(self) -> str: class CustomerProfilesChannelEndpointAssignmentPage(Page): + def get_instance( self, payload: Dict[str, Any] ) -> CustomerProfilesChannelEndpointAssignmentInstance: @@ -243,6 +245,7 @@ def __repr__(self) -> str: class CustomerProfilesChannelEndpointAssignmentList(ListResource): + def __init__(self, version: Version, customer_profile_sid: str): """ Initialize the CustomerProfilesChannelEndpointAssignmentList @@ -272,6 +275,7 @@ def create( :returns: The created CustomerProfilesChannelEndpointAssignmentInstance """ + data = values.of( { "ChannelEndpointType": channel_endpoint_type, @@ -302,6 +306,7 @@ 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 18579c047..40f0d6a07 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 @@ -123,6 +123,7 @@ def __repr__(self) -> str: class CustomerProfilesEntityAssignmentsContext(InstanceContext): + def __init__(self, version: Version, customer_profile_sid: str, sid: str): """ Initialize the CustomerProfilesEntityAssignmentsContext @@ -223,6 +224,7 @@ def __repr__(self) -> str: class CustomerProfilesEntityAssignmentsPage(Page): + def get_instance( self, payload: Dict[str, Any] ) -> CustomerProfilesEntityAssignmentsInstance: @@ -247,6 +249,7 @@ def __repr__(self) -> str: class CustomerProfilesEntityAssignmentsList(ListResource): + def __init__(self, version: Version, customer_profile_sid: str): """ Initialize the CustomerProfilesEntityAssignmentsList @@ -273,6 +276,7 @@ def create(self, object_sid: str) -> CustomerProfilesEntityAssignmentsInstance: :returns: The created CustomerProfilesEntityAssignmentsInstance """ + data = values.of( { "ObjectSid": object_sid, @@ -301,6 +305,7 @@ 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 5c158ee0c..60538ee22 100644 --- a/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_evaluations.py +++ b/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_evaluations.py @@ -23,6 +23,7 @@ class CustomerProfilesEvaluationsInstance(InstanceResource): + class Status(object): COMPLIANT = "compliant" NONCOMPLIANT = "noncompliant" @@ -54,7 +55,7 @@ def __init__( self.status: Optional["CustomerProfilesEvaluationsInstance.Status"] = ( payload.get("status") ) - self.results: Optional[List[object]] = payload.get("results") + self.results: Optional[List[Dict[str, object]]] = payload.get("results") self.date_created: Optional[datetime] = deserialize.iso8601_datetime( payload.get("date_created") ) @@ -113,6 +114,7 @@ def __repr__(self) -> str: class CustomerProfilesEvaluationsContext(InstanceContext): + def __init__(self, version: Version, customer_profile_sid: str, sid: str): """ Initialize the CustomerProfilesEvaluationsContext @@ -185,6 +187,7 @@ def __repr__(self) -> str: class CustomerProfilesEvaluationsPage(Page): + def get_instance( self, payload: Dict[str, Any] ) -> CustomerProfilesEvaluationsInstance: @@ -209,6 +212,7 @@ def __repr__(self) -> str: class CustomerProfilesEvaluationsList(ListResource): + def __init__(self, version: Version, customer_profile_sid: str): """ Initialize the CustomerProfilesEvaluationsList @@ -235,6 +239,7 @@ def create(self, policy_sid: str) -> CustomerProfilesEvaluationsInstance: :returns: The created CustomerProfilesEvaluationsInstance """ + data = values.of( { "PolicySid": policy_sid, @@ -263,6 +268,7 @@ 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 09c84f292..b8b08d65c 100644 --- a/twilio/rest/trusthub/v1/end_user.py +++ b/twilio/rest/trusthub/v1/end_user.py @@ -155,6 +155,7 @@ def __repr__(self) -> str: class EndUserContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the EndUserContext @@ -299,6 +300,7 @@ def __repr__(self) -> str: class EndUserPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> EndUserInstance: """ Build an instance of EndUserInstance @@ -317,6 +319,7 @@ def __repr__(self) -> str: class EndUserList(ListResource): + def __init__(self, version: Version): """ Initialize the EndUserList @@ -343,6 +346,7 @@ def create( :returns: The created EndUserInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -374,6 +378,7 @@ 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 997408b33..d336385b2 100644 --- a/twilio/rest/trusthub/v1/end_user_type.py +++ b/twilio/rest/trusthub/v1/end_user_type.py @@ -38,7 +38,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[object]] = payload.get("fields") + self.fields: Optional[List[Dict[str, object]]] = payload.get("fields") self.url: Optional[str] = payload.get("url") self._solution = { @@ -90,6 +90,7 @@ def __repr__(self) -> str: class EndUserTypeContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the EndUserTypeContext @@ -154,6 +155,7 @@ def __repr__(self) -> str: class EndUserTypePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> EndUserTypeInstance: """ Build an instance of EndUserTypeInstance @@ -172,6 +174,7 @@ def __repr__(self) -> str: class EndUserTypeList(ListResource): + def __init__(self, version: Version): """ Initialize the EndUserTypeList diff --git a/twilio/rest/trusthub/v1/policies.py b/twilio/rest/trusthub/v1/policies.py index 82a501554..a39b1e0e6 100644 --- a/twilio/rest/trusthub/v1/policies.py +++ b/twilio/rest/trusthub/v1/policies.py @@ -88,6 +88,7 @@ def __repr__(self) -> str: class PoliciesContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the PoliciesContext @@ -152,6 +153,7 @@ def __repr__(self) -> str: class PoliciesPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> PoliciesInstance: """ Build an instance of PoliciesInstance @@ -170,6 +172,7 @@ def __repr__(self) -> str: class PoliciesList(ListResource): + def __init__(self, version: Version): """ Initialize the PoliciesList diff --git a/twilio/rest/trusthub/v1/supporting_document.py b/twilio/rest/trusthub/v1/supporting_document.py index b8bf6805f..a18293fd8 100644 --- a/twilio/rest/trusthub/v1/supporting_document.py +++ b/twilio/rest/trusthub/v1/supporting_document.py @@ -23,6 +23,7 @@ class SupportingDocumentInstance(InstanceResource): + class Status(object): DRAFT = "draft" PENDING_REVIEW = "pending-review" @@ -169,6 +170,7 @@ def __repr__(self) -> str: class SupportingDocumentContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the SupportingDocumentContext @@ -317,6 +319,7 @@ def __repr__(self) -> str: class SupportingDocumentPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> SupportingDocumentInstance: """ Build an instance of SupportingDocumentInstance @@ -335,6 +338,7 @@ def __repr__(self) -> str: class SupportingDocumentList(ListResource): + def __init__(self, version: Version): """ Initialize the SupportingDocumentList @@ -361,6 +365,7 @@ def create( :returns: The created SupportingDocumentInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -392,6 +397,7 @@ 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 b6a91e24a..f1a93c59b 100644 --- a/twilio/rest/trusthub/v1/supporting_document_type.py +++ b/twilio/rest/trusthub/v1/supporting_document_type.py @@ -38,7 +38,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[object]] = payload.get("fields") + self.fields: Optional[List[Dict[str, object]]] = payload.get("fields") self.url: Optional[str] = payload.get("url") self._solution = { @@ -90,6 +90,7 @@ def __repr__(self) -> str: class SupportingDocumentTypeContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the SupportingDocumentTypeContext @@ -154,6 +155,7 @@ def __repr__(self) -> str: class SupportingDocumentTypePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> SupportingDocumentTypeInstance: """ Build an instance of SupportingDocumentTypeInstance @@ -172,6 +174,7 @@ def __repr__(self) -> str: class SupportingDocumentTypeList(ListResource): + def __init__(self, version: Version): """ Initialize the SupportingDocumentTypeList diff --git a/twilio/rest/trusthub/v1/trust_products/__init__.py b/twilio/rest/trusthub/v1/trust_products/__init__.py index 6c2520787..a638f680f 100644 --- a/twilio/rest/trusthub/v1/trust_products/__init__.py +++ b/twilio/rest/trusthub/v1/trust_products/__init__.py @@ -32,6 +32,7 @@ class TrustProductsInstance(InstanceResource): + class Status(object): DRAFT = "draft" PENDING_REVIEW = "pending-review" @@ -216,6 +217,7 @@ def __repr__(self) -> str: class TrustProductsContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the TrustProductsContext @@ -422,6 +424,7 @@ def __repr__(self) -> str: class TrustProductsPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> TrustProductsInstance: """ Build an instance of TrustProductsInstance @@ -440,6 +443,7 @@ def __repr__(self) -> str: class TrustProductsList(ListResource): + def __init__(self, version: Version): """ Initialize the TrustProductsList @@ -468,6 +472,7 @@ def create( :returns: The created TrustProductsInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -502,6 +507,7 @@ 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 21c52f5a5..ef2b589ff 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 @@ -123,6 +123,7 @@ def __repr__(self) -> str: class TrustProductsChannelEndpointAssignmentContext(InstanceContext): + def __init__(self, version: Version, trust_product_sid: str, sid: str): """ Initialize the TrustProductsChannelEndpointAssignmentContext @@ -219,6 +220,7 @@ def __repr__(self) -> str: class TrustProductsChannelEndpointAssignmentPage(Page): + def get_instance( self, payload: Dict[str, Any] ) -> TrustProductsChannelEndpointAssignmentInstance: @@ -243,6 +245,7 @@ def __repr__(self) -> str: class TrustProductsChannelEndpointAssignmentList(ListResource): + def __init__(self, version: Version, trust_product_sid: str): """ Initialize the TrustProductsChannelEndpointAssignmentList @@ -274,6 +277,7 @@ def create( :returns: The created TrustProductsChannelEndpointAssignmentInstance """ + data = values.of( { "ChannelEndpointType": channel_endpoint_type, @@ -304,6 +308,7 @@ 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 4de853f05..68854b9c5 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 @@ -121,6 +121,7 @@ def __repr__(self) -> str: class TrustProductsEntityAssignmentsContext(InstanceContext): + def __init__(self, version: Version, trust_product_sid: str, sid: str): """ Initialize the TrustProductsEntityAssignmentsContext @@ -217,6 +218,7 @@ def __repr__(self) -> str: class TrustProductsEntityAssignmentsPage(Page): + def get_instance( self, payload: Dict[str, Any] ) -> TrustProductsEntityAssignmentsInstance: @@ -241,6 +243,7 @@ def __repr__(self) -> str: class TrustProductsEntityAssignmentsList(ListResource): + def __init__(self, version: Version, trust_product_sid: str): """ Initialize the TrustProductsEntityAssignmentsList @@ -267,6 +270,7 @@ def create(self, object_sid: str) -> TrustProductsEntityAssignmentsInstance: :returns: The created TrustProductsEntityAssignmentsInstance """ + data = values.of( { "ObjectSid": object_sid, @@ -295,6 +299,7 @@ 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 1263d7296..dfb929bac 100644 --- a/twilio/rest/trusthub/v1/trust_products/trust_products_evaluations.py +++ b/twilio/rest/trusthub/v1/trust_products/trust_products_evaluations.py @@ -23,6 +23,7 @@ class TrustProductsEvaluationsInstance(InstanceResource): + class Status(object): COMPLIANT = "compliant" NONCOMPLIANT = "noncompliant" @@ -54,7 +55,7 @@ def __init__( self.status: Optional["TrustProductsEvaluationsInstance.Status"] = payload.get( "status" ) - self.results: Optional[List[object]] = payload.get("results") + self.results: Optional[List[Dict[str, object]]] = payload.get("results") self.date_created: Optional[datetime] = deserialize.iso8601_datetime( payload.get("date_created") ) @@ -113,6 +114,7 @@ def __repr__(self) -> str: class TrustProductsEvaluationsContext(InstanceContext): + def __init__(self, version: Version, trust_product_sid: str, sid: str): """ Initialize the TrustProductsEvaluationsContext @@ -183,6 +185,7 @@ def __repr__(self) -> str: class TrustProductsEvaluationsPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> TrustProductsEvaluationsInstance: """ Build an instance of TrustProductsEvaluationsInstance @@ -205,6 +208,7 @@ def __repr__(self) -> str: class TrustProductsEvaluationsList(ListResource): + def __init__(self, version: Version, trust_product_sid: str): """ Initialize the TrustProductsEvaluationsList @@ -231,6 +235,7 @@ def create(self, policy_sid: str) -> TrustProductsEvaluationsInstance: :returns: The created TrustProductsEvaluationsInstance """ + data = values.of( { "PolicySid": policy_sid, @@ -257,6 +262,7 @@ 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/VerifyBase.py b/twilio/rest/verify/VerifyBase.py index 8977a5043..076f06314 100644 --- a/twilio/rest/verify/VerifyBase.py +++ b/twilio/rest/verify/VerifyBase.py @@ -17,6 +17,7 @@ class VerifyBase(Domain): + def __init__(self, twilio: Client): """ Initialize the Verify Domain diff --git a/twilio/rest/verify/v2/__init__.py b/twilio/rest/verify/v2/__init__.py index c4f94aea3..01bee13b0 100644 --- a/twilio/rest/verify/v2/__init__.py +++ b/twilio/rest/verify/v2/__init__.py @@ -26,6 +26,7 @@ class V2(Version): + def __init__(self, domain: Domain): """ Initialize the V2 version of Verify diff --git a/twilio/rest/verify/v2/form.py b/twilio/rest/verify/v2/form.py index 915eab3bd..6e3231fcd 100644 --- a/twilio/rest/verify/v2/form.py +++ b/twilio/rest/verify/v2/form.py @@ -20,6 +20,7 @@ class FormInstance(InstanceResource): + class FormTypes(object): FORM_PUSH = "form-push" @@ -92,6 +93,7 @@ def __repr__(self) -> str: class FormContext(InstanceContext): + def __init__(self, version: Version, form_type: "FormInstance.FormTypes"): """ Initialize the FormContext @@ -156,6 +158,7 @@ def __repr__(self) -> str: class FormList(ListResource): + def __init__(self, version: Version): """ Initialize the FormList diff --git a/twilio/rest/verify/v2/safelist.py b/twilio/rest/verify/v2/safelist.py index 1bd1d8c0b..fb71369fb 100644 --- a/twilio/rest/verify/v2/safelist.py +++ b/twilio/rest/verify/v2/safelist.py @@ -106,6 +106,7 @@ def __repr__(self) -> str: class SafelistContext(InstanceContext): + def __init__(self, version: Version, phone_number: str): """ Initialize the SafelistContext @@ -194,6 +195,7 @@ def __repr__(self) -> str: class SafelistList(ListResource): + def __init__(self, version: Version): """ Initialize the SafelistList @@ -213,6 +215,7 @@ def create(self, phone_number: str) -> SafelistInstance: :returns: The created SafelistInstance """ + data = values.of( { "PhoneNumber": phone_number, @@ -235,6 +238,7 @@ 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 7429a3528..374ecb3ef 100644 --- a/twilio/rest/verify/v2/service/__init__.py +++ b/twilio/rest/verify/v2/service/__init__.py @@ -47,6 +47,7 @@ class ServiceInstance(InstanceResource): :ivar push: Configurations for the Push factors (channel) created under this Service. :ivar totp: Configurations for the TOTP factors (channel) created under this Service. :ivar default_template_sid: + :ivar 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. @@ -78,6 +79,9 @@ 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") ) @@ -162,6 +166,7 @@ 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 @@ -183,6 +188,7 @@ 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 """ @@ -204,6 +210,7 @@ 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( @@ -225,6 +232,7 @@ 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 @@ -246,6 +254,7 @@ 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 """ @@ -267,6 +276,7 @@ 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 @@ -329,6 +339,7 @@ def __repr__(self) -> str: class ServiceContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the ServiceContext @@ -433,6 +444,7 @@ 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 @@ -454,6 +466,7 @@ 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 """ @@ -476,6 +489,7 @@ def update( "Totp.CodeLength": totp_code_length, "Totp.Skew": totp_skew, "DefaultTemplateSid": default_template_sid, + "VerifyEventSubscriptionEnabled": verify_event_subscription_enabled, } ) @@ -506,6 +520,7 @@ 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 @@ -527,6 +542,7 @@ 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 """ @@ -549,6 +565,7 @@ async def update_async( "Totp.CodeLength": totp_code_length, "Totp.Skew": totp_skew, "DefaultTemplateSid": default_template_sid, + "VerifyEventSubscriptionEnabled": verify_event_subscription_enabled, } ) @@ -655,6 +672,7 @@ def __repr__(self) -> str: class ServicePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ServiceInstance: """ Build an instance of ServiceInstance @@ -673,6 +691,7 @@ def __repr__(self) -> str: class ServiceList(ListResource): + def __init__(self, version: Version): """ Initialize the ServiceList @@ -703,6 +722,7 @@ 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 @@ -724,9 +744,11 @@ 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, @@ -746,6 +768,7 @@ def create( "Totp.CodeLength": totp_code_length, "Totp.Skew": totp_skew, "DefaultTemplateSid": default_template_sid, + "VerifyEventSubscriptionEnabled": verify_event_subscription_enabled, } ) @@ -776,6 +799,7 @@ 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 @@ -797,9 +821,11 @@ 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, @@ -819,6 +845,7 @@ 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 8ea618a3a..0bb888a08 100644 --- a/twilio/rest/verify/v2/service/access_token.py +++ b/twilio/rest/verify/v2/service/access_token.py @@ -22,6 +22,7 @@ class AccessTokenInstance(InstanceResource): + class FactorTypes(object): PUSH = "push" @@ -113,6 +114,7 @@ def __repr__(self) -> str: class AccessTokenContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the AccessTokenContext @@ -183,6 +185,7 @@ def __repr__(self) -> str: class AccessTokenList(ListResource): + def __init__(self, version: Version, service_sid: str): """ Initialize the AccessTokenList @@ -216,6 +219,7 @@ def create( :returns: The created AccessTokenInstance """ + data = values.of( { "Identity": identity, @@ -252,6 +256,7 @@ 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 e2250d501..41541a4ca 100644 --- a/twilio/rest/verify/v2/service/entity/__init__.py +++ b/twilio/rest/verify/v2/service/entity/__init__.py @@ -149,6 +149,7 @@ def __repr__(self) -> str: class EntityContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, identity: str): """ Initialize the EntityContext @@ -286,6 +287,7 @@ def __repr__(self) -> str: class EntityPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> EntityInstance: """ Build an instance of EntityInstance @@ -306,6 +308,7 @@ def __repr__(self) -> str: class EntityList(ListResource): + def __init__(self, version: Version, service_sid: str): """ Initialize the EntityList @@ -330,6 +333,7 @@ def create(self, identity: str) -> EntityInstance: :returns: The created EntityInstance """ + data = values.of( { "Identity": identity, @@ -354,6 +358,7 @@ 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 791128fd6..ab8c7f8d1 100644 --- a/twilio/rest/verify/v2/service/entity/challenge/__init__.py +++ b/twilio/rest/verify/v2/service/entity/challenge/__init__.py @@ -24,6 +24,7 @@ class ChallengeInstance(InstanceResource): + class ChallengeReasons(object): NONE = "none" NOT_NEEDED = "not_needed" @@ -203,6 +204,7 @@ def __repr__(self) -> str: class ChallengeContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, identity: str, sid: str): """ Initialize the ChallengeContext @@ -363,6 +365,7 @@ def __repr__(self) -> str: class ChallengePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ChallengeInstance: """ Build an instance of ChallengeInstance @@ -386,6 +389,7 @@ def __repr__(self) -> str: class ChallengeList(ListResource): + def __init__(self, version: Version, service_sid: str, identity: str): """ Initialize the ChallengeList @@ -427,6 +431,7 @@ def create( :returns: The created ChallengeInstance """ + data = values.of( { "FactorSid": factor_sid, @@ -474,6 +479,7 @@ 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 b4ac882ba..0cfae0a60 100644 --- a/twilio/rest/verify/v2/service/entity/challenge/notification.py +++ b/twilio/rest/verify/v2/service/entity/challenge/notification.py @@ -73,6 +73,7 @@ def __repr__(self) -> str: class NotificationList(ListResource): + def __init__( self, version: Version, service_sid: str, identity: str, challenge_sid: str ): @@ -105,6 +106,7 @@ def create(self, ttl: Union[int, object] = values.unset) -> NotificationInstance :returns: The created NotificationInstance """ + data = values.of( { "Ttl": ttl, @@ -135,6 +137,7 @@ async def create_async( :returns: The created NotificationInstance """ + data = values.of( { "Ttl": ttl, diff --git a/twilio/rest/verify/v2/service/entity/factor.py b/twilio/rest/verify/v2/service/entity/factor.py index cf06f184c..8900fcbfc 100644 --- a/twilio/rest/verify/v2/service/entity/factor.py +++ b/twilio/rest/verify/v2/service/entity/factor.py @@ -23,6 +23,7 @@ class FactorInstance(InstanceResource): + class FactorStatuses(object): UNVERIFIED = "unverified" VERIFIED = "verified" @@ -231,6 +232,7 @@ def __repr__(self) -> str: class FactorContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, identity: str, sid: str): """ Initialize the FactorContext @@ -439,6 +441,7 @@ def __repr__(self) -> str: class FactorPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> FactorInstance: """ Build an instance of FactorInstance @@ -462,6 +465,7 @@ def __repr__(self) -> str: class FactorList(ListResource): + def __init__(self, version: Version, service_sid: str, identity: str): """ Initialize the FactorList diff --git a/twilio/rest/verify/v2/service/entity/new_factor.py b/twilio/rest/verify/v2/service/entity/new_factor.py index 33cb1eb76..7b260a4a3 100644 --- a/twilio/rest/verify/v2/service/entity/new_factor.py +++ b/twilio/rest/verify/v2/service/entity/new_factor.py @@ -22,6 +22,7 @@ class NewFactorInstance(InstanceResource): + class FactorStatuses(object): UNVERIFIED = "unverified" VERIFIED = "verified" @@ -101,6 +102,7 @@ def __repr__(self) -> str: class NewFactorList(ListResource): + def __init__(self, version: Version, service_sid: str, identity: str): """ Initialize the NewFactorList @@ -160,6 +162,7 @@ def create( :returns: The created NewFactorInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -231,6 +234,7 @@ 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 49ae96a11..f412aba1e 100644 --- a/twilio/rest/verify/v2/service/messaging_configuration.py +++ b/twilio/rest/verify/v2/service/messaging_configuration.py @@ -149,6 +149,7 @@ def __repr__(self) -> str: class MessagingConfigurationContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, country: str): """ Initialize the MessagingConfigurationContext @@ -299,6 +300,7 @@ def __repr__(self) -> str: class MessagingConfigurationPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> MessagingConfigurationInstance: """ Build an instance of MessagingConfigurationInstance @@ -319,6 +321,7 @@ def __repr__(self) -> str: class MessagingConfigurationList(ListResource): + def __init__(self, version: Version, service_sid: str): """ Initialize the MessagingConfigurationList @@ -348,6 +351,7 @@ def create( :returns: The created MessagingConfigurationInstance """ + data = values.of( { "Country": country, @@ -376,6 +380,7 @@ 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 b301b8ef4..2d4a18bf0 100644 --- a/twilio/rest/verify/v2/service/rate_limit/__init__.py +++ b/twilio/rest/verify/v2/service/rate_limit/__init__.py @@ -163,6 +163,7 @@ def __repr__(self) -> str: class RateLimitContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the RateLimitContext @@ -328,6 +329,7 @@ def __repr__(self) -> str: class RateLimitPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> RateLimitInstance: """ Build an instance of RateLimitInstance @@ -348,6 +350,7 @@ def __repr__(self) -> str: class RateLimitList(ListResource): + def __init__(self, version: Version, service_sid: str): """ Initialize the RateLimitList @@ -375,6 +378,7 @@ def create( :returns: The created RateLimitInstance """ + data = values.of( { "UniqueName": unique_name, @@ -403,6 +407,7 @@ 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 55dd7576a..ca4ffaf77 100644 --- a/twilio/rest/verify/v2/service/rate_limit/bucket.py +++ b/twilio/rest/verify/v2/service/rate_limit/bucket.py @@ -166,6 +166,7 @@ def __repr__(self) -> str: class BucketContext(InstanceContext): + def __init__( self, version: Version, service_sid: str, rate_limit_sid: str, sid: str ): @@ -336,6 +337,7 @@ def __repr__(self) -> str: class BucketPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> BucketInstance: """ Build an instance of BucketInstance @@ -359,6 +361,7 @@ def __repr__(self) -> str: class BucketList(ListResource): + def __init__(self, version: Version, service_sid: str, rate_limit_sid: str): """ Initialize the BucketList @@ -390,6 +393,7 @@ def create(self, max: int, interval: int) -> BucketInstance: :returns: The created BucketInstance """ + data = values.of( { "Max": max, @@ -419,6 +423,7 @@ 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 c4b504506..1c42043a3 100644 --- a/twilio/rest/verify/v2/service/verification.py +++ b/twilio/rest/verify/v2/service/verification.py @@ -22,6 +22,7 @@ class VerificationInstance(InstanceResource): + class Channel(object): SMS = "sms" CALL = "call" @@ -74,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[object]] = payload.get( + self.send_code_attempts: Optional[List[Dict[str, object]]] = payload.get( "send_code_attempts" ) self.date_created: Optional[datetime] = deserialize.iso8601_datetime( @@ -163,6 +164,7 @@ def __repr__(self) -> str: class VerificationContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the VerificationContext @@ -289,6 +291,7 @@ def __repr__(self) -> str: class VerificationList(ListResource): + def __init__(self, version: Version, service_sid: str): """ Initialize the VerificationList @@ -323,6 +326,7 @@ 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 @@ -343,9 +347,11 @@ 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, @@ -364,6 +370,7 @@ def create( "TemplateCustomSubstitutions": template_custom_substitutions, "DeviceIp": device_ip, "RiskCheck": risk_check, + "Tags": tags, } ) @@ -395,6 +402,7 @@ 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 @@ -415,9 +423,11 @@ 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, @@ -436,6 +446,7 @@ 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 a8c44f51e..9cd92487e 100644 --- a/twilio/rest/verify/v2/service/verification_check.py +++ b/twilio/rest/verify/v2/service/verification_check.py @@ -22,6 +22,7 @@ class VerificationCheckInstance(InstanceResource): + class Channel(object): SMS = "sms" CALL = "call" @@ -64,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[object]] = payload.get( + self.sna_attempts_error_codes: Optional[List[Dict[str, object]]] = payload.get( "sna_attempts_error_codes" ) @@ -83,6 +84,7 @@ def __repr__(self) -> str: class VerificationCheckList(ListResource): + def __init__(self, version: Version, service_sid: str): """ Initialize the VerificationCheckList @@ -118,6 +120,7 @@ def create( :returns: The created VerificationCheckInstance """ + data = values.of( { "Code": code, @@ -157,6 +160,7 @@ 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 85e9d2e40..4f8772574 100644 --- a/twilio/rest/verify/v2/service/webhook.py +++ b/twilio/rest/verify/v2/service/webhook.py @@ -23,6 +23,7 @@ class WebhookInstance(InstanceResource): + class Methods(object): GET = "GET" POST = "POST" @@ -201,6 +202,7 @@ def __repr__(self) -> str: class WebhookContext(InstanceContext): + def __init__(self, version: Version, service_sid: str, sid: str): """ Initialize the WebhookContext @@ -377,6 +379,7 @@ def __repr__(self) -> str: class WebhookPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> WebhookInstance: """ Build an instance of WebhookInstance @@ -397,6 +400,7 @@ def __repr__(self) -> str: class WebhookList(ListResource): + def __init__(self, version: Version, service_sid: str): """ Initialize the WebhookList @@ -432,6 +436,7 @@ def create( :returns: The created WebhookInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -471,6 +476,7 @@ async def create_async( :returns: The created WebhookInstance """ + data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/verify/v2/template.py b/twilio/rest/verify/v2/template.py index 4f3791bd9..b9968eec8 100644 --- a/twilio/rest/verify/v2/template.py +++ b/twilio/rest/verify/v2/template.py @@ -50,6 +50,7 @@ def __repr__(self) -> str: class TemplatePage(Page): + def get_instance(self, payload: Dict[str, Any]) -> TemplateInstance: """ Build an instance of TemplateInstance @@ -68,6 +69,7 @@ def __repr__(self) -> str: class TemplateList(ListResource): + def __init__(self, version: Version): """ Initialize the TemplateList diff --git a/twilio/rest/verify/v2/verification_attempt.py b/twilio/rest/verify/v2/verification_attempt.py index a0c18a2ce..2c1f914d3 100644 --- a/twilio/rest/verify/v2/verification_attempt.py +++ b/twilio/rest/verify/v2/verification_attempt.py @@ -23,6 +23,7 @@ class VerificationAttemptInstance(InstanceResource): + class Channels(object): SMS = "sms" CALL = "call" @@ -42,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/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/en-us/verify/pricing). :ivar channel_data: An object containing the channel specific information for an attempt. :ivar url: """ @@ -121,6 +122,7 @@ def __repr__(self) -> str: class VerificationAttemptContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the VerificationAttemptContext @@ -185,6 +187,7 @@ def __repr__(self) -> str: class VerificationAttemptPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> VerificationAttemptInstance: """ Build an instance of VerificationAttemptInstance @@ -203,6 +206,7 @@ def __repr__(self) -> str: class VerificationAttemptList(ListResource): + def __init__(self, version: Version): """ Initialize the VerificationAttemptList diff --git a/twilio/rest/verify/v2/verification_attempts_summary.py b/twilio/rest/verify/v2/verification_attempts_summary.py index a2a1c0a97..1f2d3d395 100644 --- a/twilio/rest/verify/v2/verification_attempts_summary.py +++ b/twilio/rest/verify/v2/verification_attempts_summary.py @@ -22,6 +22,7 @@ class VerificationAttemptsSummaryInstance(InstanceResource): + class Channels(object): SMS = "sms" CALL = "call" @@ -144,6 +145,7 @@ def __repr__(self) -> str: class VerificationAttemptsSummaryContext(InstanceContext): + def __init__(self, version: Version): """ Initialize the VerificationAttemptsSummaryContext @@ -251,6 +253,7 @@ def __repr__(self) -> str: class VerificationAttemptsSummaryList(ListResource): + def __init__(self, version: Version): """ Initialize the VerificationAttemptsSummaryList diff --git a/twilio/rest/video/VideoBase.py b/twilio/rest/video/VideoBase.py index 2a2534566..0d2cf7e36 100644 --- a/twilio/rest/video/VideoBase.py +++ b/twilio/rest/video/VideoBase.py @@ -17,6 +17,7 @@ class VideoBase(Domain): + def __init__(self, twilio: Client): """ Initialize the Video Domain diff --git a/twilio/rest/video/v1/__init__.py b/twilio/rest/video/v1/__init__.py index 9cd9fcf35..0667596a3 100644 --- a/twilio/rest/video/v1/__init__.py +++ b/twilio/rest/video/v1/__init__.py @@ -24,6 +24,7 @@ class V1(Version): + def __init__(self, domain: Domain): """ Initialize the V1 version of Video diff --git a/twilio/rest/video/v1/composition.py b/twilio/rest/video/v1/composition.py index ae6a52c9a..64ee0b2ce 100644 --- a/twilio/rest/video/v1/composition.py +++ b/twilio/rest/video/v1/composition.py @@ -23,6 +23,7 @@ class CompositionInstance(InstanceResource): + class Format(object): MP4 = "mp4" WEBM = "webm" @@ -164,6 +165,7 @@ def __repr__(self) -> str: class CompositionContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the CompositionContext @@ -252,6 +254,7 @@ def __repr__(self) -> str: class CompositionPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> CompositionInstance: """ Build an instance of CompositionInstance @@ -270,6 +273,7 @@ def __repr__(self) -> str: class CompositionList(ListResource): + def __init__(self, version: Version): """ Initialize the CompositionList @@ -308,6 +312,7 @@ def create( :returns: The created CompositionInstance """ + data = values.of( { "RoomSid": room_sid, @@ -359,6 +364,7 @@ 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 58f91fec4..f6156e82f 100644 --- a/twilio/rest/video/v1/composition_hook.py +++ b/twilio/rest/video/v1/composition_hook.py @@ -23,6 +23,7 @@ class CompositionHookInstance(InstanceResource): + class Format(object): MP4 = "mp4" WEBM = "webm" @@ -225,6 +226,7 @@ def __repr__(self) -> str: class CompositionHookContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the CompositionHookContext @@ -425,6 +427,7 @@ def __repr__(self) -> str: class CompositionHookPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> CompositionHookInstance: """ Build an instance of CompositionHookInstance @@ -443,6 +446,7 @@ def __repr__(self) -> str: class CompositionHookList(ListResource): + def __init__(self, version: Version): """ Initialize the CompositionHookList @@ -483,6 +487,7 @@ def create( :returns: The created CompositionHookInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -537,6 +542,7 @@ async def create_async( :returns: The created CompositionHookInstance """ + data = values.of( { "FriendlyName": friendly_name, diff --git a/twilio/rest/video/v1/composition_settings.py b/twilio/rest/video/v1/composition_settings.py index 12da95a9d..7082866b3 100644 --- a/twilio/rest/video/v1/composition_settings.py +++ b/twilio/rest/video/v1/composition_settings.py @@ -25,7 +25,7 @@ class CompositionSettingsInstance(InstanceResource): :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the CompositionSettings resource. :ivar friendly_name: The string that you assigned to describe the resource and that will be shown in the console :ivar aws_credentials_sid: The SID of the stored Credential resource. - :ivar aws_s3_url: The URL of the AWS S3 bucket where the compositions are stored. We only support DNS-compliant URLs like `https://documentation-example-twilio-bucket/compositions`, where `compositions` is the path in which you want the compositions to be stored. This URL accepts only URI-valid characters, as described in the RFC 3986. + :ivar aws_s3_url: The URL of the AWS S3 bucket where the compositions are stored. We only support DNS-compliant URLs like `https://documentation-example-twilio-bucket/compositions`, where `compositions` is the path in which you want the compositions to be stored. This URL accepts only URI-valid characters, as described in the [RFC 3986](https://tools.ietf.org/html/rfc3986#section-2). :ivar aws_storage_enabled: Whether all compositions are written to the `aws_s3_url`. When `false`, all compositions are stored in our cloud. :ivar encryption_key_sid: The SID of the Public Key resource used for encryption. :ivar encryption_enabled: Whether all compositions are stored in an encrypted form. The default is `false`. @@ -75,7 +75,7 @@ def create( :param friendly_name: A descriptive string that you create to describe the resource and show to the user in the console :param aws_credentials_sid: The SID of the stored Credential resource. :param encryption_key_sid: The SID of the Public Key resource to use for encryption. - :param aws_s3_url: The URL of the AWS S3 bucket where the compositions should be stored. We only support DNS-compliant URLs like `https://documentation-example-twilio-bucket/compositions`, where `compositions` is the path in which you want the compositions to be stored. This URL accepts only URI-valid characters, as described in the RFC 3986. + :param aws_s3_url: The URL of the AWS S3 bucket where the compositions should be stored. We only support DNS-compliant URLs like `https://documentation-example-twilio-bucket/compositions`, where `compositions` is the path in which you want the compositions to be stored. This URL accepts only URI-valid characters, as described in the [RFC 3986](https://tools.ietf.org/html/rfc3986#section-2). :param aws_storage_enabled: Whether all compositions should be written to the `aws_s3_url`. When `false`, all compositions are stored in our cloud. :param encryption_enabled: Whether all compositions should be stored in an encrypted form. The default is `false`. @@ -105,7 +105,7 @@ async def create_async( :param friendly_name: A descriptive string that you create to describe the resource and show to the user in the console :param aws_credentials_sid: The SID of the stored Credential resource. :param encryption_key_sid: The SID of the Public Key resource to use for encryption. - :param aws_s3_url: The URL of the AWS S3 bucket where the compositions should be stored. We only support DNS-compliant URLs like `https://documentation-example-twilio-bucket/compositions`, where `compositions` is the path in which you want the compositions to be stored. This URL accepts only URI-valid characters, as described in the RFC 3986. + :param aws_s3_url: The URL of the AWS S3 bucket where the compositions should be stored. We only support DNS-compliant URLs like `https://documentation-example-twilio-bucket/compositions`, where `compositions` is the path in which you want the compositions to be stored. This URL accepts only URI-valid characters, as described in the [RFC 3986](https://tools.ietf.org/html/rfc3986#section-2). :param aws_storage_enabled: Whether all compositions should be written to the `aws_s3_url`. When `false`, all compositions are stored in our cloud. :param encryption_enabled: Whether all compositions should be stored in an encrypted form. The default is `false`. @@ -149,6 +149,7 @@ def __repr__(self) -> str: class CompositionSettingsContext(InstanceContext): + def __init__(self, version: Version): """ Initialize the CompositionSettingsContext @@ -174,7 +175,7 @@ def create( :param friendly_name: A descriptive string that you create to describe the resource and show to the user in the console :param aws_credentials_sid: The SID of the stored Credential resource. :param encryption_key_sid: The SID of the Public Key resource to use for encryption. - :param aws_s3_url: The URL of the AWS S3 bucket where the compositions should be stored. We only support DNS-compliant URLs like `https://documentation-example-twilio-bucket/compositions`, where `compositions` is the path in which you want the compositions to be stored. This URL accepts only URI-valid characters, as described in the RFC 3986. + :param aws_s3_url: The URL of the AWS S3 bucket where the compositions should be stored. We only support DNS-compliant URLs like `https://documentation-example-twilio-bucket/compositions`, where `compositions` is the path in which you want the compositions to be stored. This URL accepts only URI-valid characters, as described in the [RFC 3986](https://tools.ietf.org/html/rfc3986#section-2). :param aws_storage_enabled: Whether all compositions should be written to the `aws_s3_url`. When `false`, all compositions are stored in our cloud. :param encryption_enabled: Whether all compositions should be stored in an encrypted form. The default is `false`. @@ -210,7 +211,7 @@ async def create_async( :param friendly_name: A descriptive string that you create to describe the resource and show to the user in the console :param aws_credentials_sid: The SID of the stored Credential resource. :param encryption_key_sid: The SID of the Public Key resource to use for encryption. - :param aws_s3_url: The URL of the AWS S3 bucket where the compositions should be stored. We only support DNS-compliant URLs like `https://documentation-example-twilio-bucket/compositions`, where `compositions` is the path in which you want the compositions to be stored. This URL accepts only URI-valid characters, as described in the RFC 3986. + :param aws_s3_url: The URL of the AWS S3 bucket where the compositions should be stored. We only support DNS-compliant URLs like `https://documentation-example-twilio-bucket/compositions`, where `compositions` is the path in which you want the compositions to be stored. This URL accepts only URI-valid characters, as described in the [RFC 3986](https://tools.ietf.org/html/rfc3986#section-2). :param aws_storage_enabled: Whether all compositions should be written to the `aws_s3_url`. When `false`, all compositions are stored in our cloud. :param encryption_enabled: Whether all compositions should be stored in an encrypted form. The default is `false`. @@ -280,6 +281,7 @@ def __repr__(self) -> str: class CompositionSettingsList(ListResource): + def __init__(self, version: Version): """ Initialize the CompositionSettingsList diff --git a/twilio/rest/video/v1/recording.py b/twilio/rest/video/v1/recording.py index c72ce8528..20c836d2b 100644 --- a/twilio/rest/video/v1/recording.py +++ b/twilio/rest/video/v1/recording.py @@ -23,6 +23,7 @@ class RecordingInstance(InstanceResource): + class Codec(object): VP8 = "VP8" H264 = "H264" @@ -164,6 +165,7 @@ def __repr__(self) -> str: class RecordingContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the RecordingContext @@ -252,6 +254,7 @@ def __repr__(self) -> str: class RecordingPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> RecordingInstance: """ Build an instance of RecordingInstance @@ -270,6 +273,7 @@ def __repr__(self) -> str: class RecordingList(ListResource): + def __init__(self, version: Version): """ Initialize the RecordingList diff --git a/twilio/rest/video/v1/recording_settings.py b/twilio/rest/video/v1/recording_settings.py index 372b070ae..d0d6e5ebb 100644 --- a/twilio/rest/video/v1/recording_settings.py +++ b/twilio/rest/video/v1/recording_settings.py @@ -25,7 +25,7 @@ class RecordingSettingsInstance(InstanceResource): :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the RecordingSettings resource. :ivar friendly_name: The string that you assigned to describe the resource and show the user in the console :ivar aws_credentials_sid: The SID of the stored Credential resource. - :ivar aws_s3_url: The URL of the AWS S3 bucket where the recordings are stored. We only support DNS-compliant URLs like `https://documentation-example-twilio-bucket/recordings`, where `recordings` is the path in which you want the recordings to be stored. This URL accepts only URI-valid characters, as described in the RFC 3986. + :ivar aws_s3_url: The URL of the AWS S3 bucket where the recordings are stored. We only support DNS-compliant URLs like `https://documentation-example-twilio-bucket/recordings`, where `recordings` is the path in which you want the recordings to be stored. This URL accepts only URI-valid characters, as described in the [RFC 3986](https://tools.ietf.org/html/rfc3986#section-2). :ivar aws_storage_enabled: Whether all recordings are written to the `aws_s3_url`. When `false`, all recordings are stored in our cloud. :ivar encryption_key_sid: The SID of the Public Key resource used for encryption. :ivar encryption_enabled: Whether all recordings are stored in an encrypted form. The default is `false`. @@ -75,7 +75,7 @@ def create( :param friendly_name: A descriptive string that you create to describe the resource and be shown to users in the console :param aws_credentials_sid: The SID of the stored Credential resource. :param encryption_key_sid: The SID of the Public Key resource to use for encryption. - :param aws_s3_url: The URL of the AWS S3 bucket where the recordings should be stored. We only support DNS-compliant URLs like `https://documentation-example-twilio-bucket/recordings`, where `recordings` is the path in which you want the recordings to be stored. This URL accepts only URI-valid characters, as described in the RFC 3986. + :param aws_s3_url: The URL of the AWS S3 bucket where the recordings should be stored. We only support DNS-compliant URLs like `https://documentation-example-twilio-bucket/recordings`, where `recordings` is the path in which you want the recordings to be stored. This URL accepts only URI-valid characters, as described in the [RFC 3986](https://tools.ietf.org/html/rfc3986#section-2). :param aws_storage_enabled: Whether all recordings should be written to the `aws_s3_url`. When `false`, all recordings are stored in our cloud. :param encryption_enabled: Whether all recordings should be stored in an encrypted form. The default is `false`. @@ -105,7 +105,7 @@ async def create_async( :param friendly_name: A descriptive string that you create to describe the resource and be shown to users in the console :param aws_credentials_sid: The SID of the stored Credential resource. :param encryption_key_sid: The SID of the Public Key resource to use for encryption. - :param aws_s3_url: The URL of the AWS S3 bucket where the recordings should be stored. We only support DNS-compliant URLs like `https://documentation-example-twilio-bucket/recordings`, where `recordings` is the path in which you want the recordings to be stored. This URL accepts only URI-valid characters, as described in the RFC 3986. + :param aws_s3_url: The URL of the AWS S3 bucket where the recordings should be stored. We only support DNS-compliant URLs like `https://documentation-example-twilio-bucket/recordings`, where `recordings` is the path in which you want the recordings to be stored. This URL accepts only URI-valid characters, as described in the [RFC 3986](https://tools.ietf.org/html/rfc3986#section-2). :param aws_storage_enabled: Whether all recordings should be written to the `aws_s3_url`. When `false`, all recordings are stored in our cloud. :param encryption_enabled: Whether all recordings should be stored in an encrypted form. The default is `false`. @@ -149,6 +149,7 @@ def __repr__(self) -> str: class RecordingSettingsContext(InstanceContext): + def __init__(self, version: Version): """ Initialize the RecordingSettingsContext @@ -174,7 +175,7 @@ def create( :param friendly_name: A descriptive string that you create to describe the resource and be shown to users in the console :param aws_credentials_sid: The SID of the stored Credential resource. :param encryption_key_sid: The SID of the Public Key resource to use for encryption. - :param aws_s3_url: The URL of the AWS S3 bucket where the recordings should be stored. We only support DNS-compliant URLs like `https://documentation-example-twilio-bucket/recordings`, where `recordings` is the path in which you want the recordings to be stored. This URL accepts only URI-valid characters, as described in the RFC 3986. + :param aws_s3_url: The URL of the AWS S3 bucket where the recordings should be stored. We only support DNS-compliant URLs like `https://documentation-example-twilio-bucket/recordings`, where `recordings` is the path in which you want the recordings to be stored. This URL accepts only URI-valid characters, as described in the [RFC 3986](https://tools.ietf.org/html/rfc3986#section-2). :param aws_storage_enabled: Whether all recordings should be written to the `aws_s3_url`. When `false`, all recordings are stored in our cloud. :param encryption_enabled: Whether all recordings should be stored in an encrypted form. The default is `false`. @@ -210,7 +211,7 @@ async def create_async( :param friendly_name: A descriptive string that you create to describe the resource and be shown to users in the console :param aws_credentials_sid: The SID of the stored Credential resource. :param encryption_key_sid: The SID of the Public Key resource to use for encryption. - :param aws_s3_url: The URL of the AWS S3 bucket where the recordings should be stored. We only support DNS-compliant URLs like `https://documentation-example-twilio-bucket/recordings`, where `recordings` is the path in which you want the recordings to be stored. This URL accepts only URI-valid characters, as described in the RFC 3986. + :param aws_s3_url: The URL of the AWS S3 bucket where the recordings should be stored. We only support DNS-compliant URLs like `https://documentation-example-twilio-bucket/recordings`, where `recordings` is the path in which you want the recordings to be stored. This URL accepts only URI-valid characters, as described in the [RFC 3986](https://tools.ietf.org/html/rfc3986#section-2). :param aws_storage_enabled: Whether all recordings should be written to the `aws_s3_url`. When `false`, all recordings are stored in our cloud. :param encryption_enabled: Whether all recordings should be stored in an encrypted form. The default is `false`. @@ -280,6 +281,7 @@ def __repr__(self) -> str: class RecordingSettingsList(ListResource): + def __init__(self, version: Version): """ Initialize the RecordingSettingsList diff --git a/twilio/rest/video/v1/room/__init__.py b/twilio/rest/video/v1/room/__init__.py index 71fb8a9e7..d787c9896 100644 --- a/twilio/rest/video/v1/room/__init__.py +++ b/twilio/rest/video/v1/room/__init__.py @@ -26,6 +26,7 @@ class RoomInstance(InstanceResource): + class RoomStatus(object): IN_PROGRESS = "in-progress" COMPLETED = "completed" @@ -214,6 +215,7 @@ def __repr__(self) -> str: class RoomContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the RoomContext @@ -362,6 +364,7 @@ def __repr__(self) -> str: class RoomPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> RoomInstance: """ Build an instance of RoomInstance @@ -380,6 +383,7 @@ def __repr__(self) -> str: class RoomList(ListResource): + def __init__(self, version: Version): """ Initialize the RoomList @@ -430,6 +434,7 @@ def create( :returns: The created RoomInstance """ + data = values.of( { "EnableTurn": enable_turn, @@ -497,6 +502,7 @@ async def create_async( :returns: The created RoomInstance """ + data = values.of( { "EnableTurn": enable_turn, diff --git a/twilio/rest/video/v1/room/participant/__init__.py b/twilio/rest/video/v1/room/participant/__init__.py index 40c8dff50..145d95429 100644 --- a/twilio/rest/video/v1/room/participant/__init__.py +++ b/twilio/rest/video/v1/room/participant/__init__.py @@ -27,6 +27,7 @@ class ParticipantInstance(InstanceResource): + class Status(object): CONNECTED = "connected" DISCONNECTED = "disconnected" @@ -183,6 +184,7 @@ def __repr__(self) -> str: class ParticipantContext(InstanceContext): + def __init__(self, version: Version, room_sid: str, sid: str): """ Initialize the ParticipantContext @@ -366,6 +368,7 @@ def __repr__(self) -> str: class ParticipantPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ParticipantInstance: """ Build an instance of ParticipantInstance @@ -386,6 +389,7 @@ def __repr__(self) -> str: class ParticipantList(ListResource): + def __init__(self, version: Version, room_sid: str): """ Initialize the ParticipantList diff --git a/twilio/rest/video/v1/room/participant/anonymize.py b/twilio/rest/video/v1/room/participant/anonymize.py index 2f1b29b26..e9a7f1383 100644 --- a/twilio/rest/video/v1/room/participant/anonymize.py +++ b/twilio/rest/video/v1/room/participant/anonymize.py @@ -22,6 +22,7 @@ class AnonymizeInstance(InstanceResource): + class Status(object): CONNECTED = "connected" DISCONNECTED = "disconnected" @@ -116,6 +117,7 @@ def __repr__(self) -> str: class AnonymizeContext(InstanceContext): + def __init__(self, version: Version, room_sid: str, sid: str): """ Initialize the AnonymizeContext @@ -190,6 +192,7 @@ def __repr__(self) -> str: class AnonymizeList(ListResource): + def __init__(self, version: Version, room_sid: str, sid: str): """ Initialize the AnonymizeList diff --git a/twilio/rest/video/v1/room/participant/published_track.py b/twilio/rest/video/v1/room/participant/published_track.py index faedb7f71..1fa84827b 100644 --- a/twilio/rest/video/v1/room/participant/published_track.py +++ b/twilio/rest/video/v1/room/participant/published_track.py @@ -23,6 +23,7 @@ class PublishedTrackInstance(InstanceResource): + class Kind(object): AUDIO = "audio" VIDEO = "video" @@ -117,6 +118,7 @@ def __repr__(self) -> str: class PublishedTrackContext(InstanceContext): + def __init__(self, version: Version, room_sid: str, participant_sid: str, sid: str): """ Initialize the PublishedTrackContext @@ -191,6 +193,7 @@ def __repr__(self) -> str: class PublishedTrackPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> PublishedTrackInstance: """ Build an instance of PublishedTrackInstance @@ -214,6 +217,7 @@ def __repr__(self) -> str: class PublishedTrackList(ListResource): + def __init__(self, version: Version, room_sid: str, participant_sid: str): """ Initialize the PublishedTrackList diff --git a/twilio/rest/video/v1/room/participant/subscribe_rules.py b/twilio/rest/video/v1/room/participant/subscribe_rules.py index cc3a62cb2..3015163e6 100644 --- a/twilio/rest/video/v1/room/participant/subscribe_rules.py +++ b/twilio/rest/video/v1/room/participant/subscribe_rules.py @@ -65,6 +65,7 @@ def __repr__(self) -> str: class SubscribeRulesList(ListResource): + def __init__(self, version: Version, room_sid: str, participant_sid: str): """ Initialize the SubscribeRulesList @@ -91,8 +92,10 @@ def fetch(self) -> SubscribeRulesInstance: """ Asynchronously fetch the SubscribeRulesInstance + :returns: The fetched SubscribeRulesInstance """ + payload = self._version.fetch(method="GET", uri=self._uri) return SubscribeRulesInstance( @@ -106,8 +109,10 @@ 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/participant/subscribed_track.py b/twilio/rest/video/v1/room/participant/subscribed_track.py index aaffdf5f9..7c915095e 100644 --- a/twilio/rest/video/v1/room/participant/subscribed_track.py +++ b/twilio/rest/video/v1/room/participant/subscribed_track.py @@ -23,6 +23,7 @@ class SubscribedTrackInstance(InstanceResource): + class Kind(object): AUDIO = "audio" VIDEO = "video" @@ -119,6 +120,7 @@ def __repr__(self) -> str: class SubscribedTrackContext(InstanceContext): + def __init__(self, version: Version, room_sid: str, participant_sid: str, sid: str): """ Initialize the SubscribedTrackContext @@ -193,6 +195,7 @@ def __repr__(self) -> str: class SubscribedTrackPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> SubscribedTrackInstance: """ Build an instance of SubscribedTrackInstance @@ -216,6 +219,7 @@ def __repr__(self) -> str: class SubscribedTrackList(ListResource): + def __init__(self, version: Version, room_sid: str, participant_sid: str): """ Initialize the SubscribedTrackList diff --git a/twilio/rest/video/v1/room/recording_rules.py b/twilio/rest/video/v1/room/recording_rules.py index 9ebbb2408..6e731a145 100644 --- a/twilio/rest/video/v1/room/recording_rules.py +++ b/twilio/rest/video/v1/room/recording_rules.py @@ -56,6 +56,7 @@ def __repr__(self) -> str: class RecordingRulesList(ListResource): + def __init__(self, version: Version, room_sid: str): """ Initialize the RecordingRulesList @@ -76,8 +77,10 @@ def fetch(self) -> RecordingRulesInstance: """ Asynchronously fetch the RecordingRulesInstance + :returns: The fetched RecordingRulesInstance """ + payload = self._version.fetch(method="GET", uri=self._uri) return RecordingRulesInstance( @@ -88,8 +91,10 @@ 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/video/v1/room/room_recording.py b/twilio/rest/video/v1/room/room_recording.py index 284e2670c..db67f2994 100644 --- a/twilio/rest/video/v1/room/room_recording.py +++ b/twilio/rest/video/v1/room/room_recording.py @@ -23,6 +23,7 @@ class RoomRecordingInstance(InstanceResource): + class Codec(object): VP8 = "VP8" H264 = "H264" @@ -166,6 +167,7 @@ def __repr__(self) -> str: class RoomRecordingContext(InstanceContext): + def __init__(self, version: Version, room_sid: str, sid: str): """ Initialize the RoomRecordingContext @@ -258,6 +260,7 @@ def __repr__(self) -> str: class RoomRecordingPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> RoomRecordingInstance: """ Build an instance of RoomRecordingInstance @@ -278,6 +281,7 @@ def __repr__(self) -> str: class RoomRecordingList(ListResource): + def __init__(self, version: Version, room_sid: str): """ Initialize the RoomRecordingList diff --git a/twilio/rest/voice/VoiceBase.py b/twilio/rest/voice/VoiceBase.py index 21a11ce35..4394ab1a2 100644 --- a/twilio/rest/voice/VoiceBase.py +++ b/twilio/rest/voice/VoiceBase.py @@ -17,6 +17,7 @@ class VoiceBase(Domain): + def __init__(self, twilio: Client): """ Initialize the Voice Domain diff --git a/twilio/rest/voice/v1/__init__.py b/twilio/rest/voice/v1/__init__.py index 2014cd162..75c0c7fc7 100644 --- a/twilio/rest/voice/v1/__init__.py +++ b/twilio/rest/voice/v1/__init__.py @@ -24,6 +24,7 @@ class V1(Version): + def __init__(self, domain: Domain): """ Initialize the V1 version of Voice diff --git a/twilio/rest/voice/v1/archived_call.py b/twilio/rest/voice/v1/archived_call.py index a5272513a..ec8a5bb68 100644 --- a/twilio/rest/voice/v1/archived_call.py +++ b/twilio/rest/voice/v1/archived_call.py @@ -20,6 +20,7 @@ class ArchivedCallContext(InstanceContext): + def __init__(self, version: Version, date: date, sid: str): """ Initialize the ArchivedCallContext @@ -72,6 +73,7 @@ def __repr__(self) -> str: class ArchivedCallList(ListResource): + def __init__(self, version: Version): """ Initialize the ArchivedCallList diff --git a/twilio/rest/voice/v1/byoc_trunk.py b/twilio/rest/voice/v1/byoc_trunk.py index 31e3b6d4e..1a8f60984 100644 --- a/twilio/rest/voice/v1/byoc_trunk.py +++ b/twilio/rest/voice/v1/byoc_trunk.py @@ -219,6 +219,7 @@ def __repr__(self) -> str: class ByocTrunkContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the ByocTrunkContext @@ -411,6 +412,7 @@ def __repr__(self) -> str: class ByocTrunkPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ByocTrunkInstance: """ Build an instance of ByocTrunkInstance @@ -429,6 +431,7 @@ def __repr__(self) -> str: class ByocTrunkList(ListResource): + def __init__(self, version: Version): """ Initialize the ByocTrunkList @@ -469,6 +472,7 @@ def create( :returns: The created ByocTrunkInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -521,6 +525,7 @@ 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 d4e626071..d1d8aac89 100644 --- a/twilio/rest/voice/v1/connection_policy/__init__.py +++ b/twilio/rest/voice/v1/connection_policy/__init__.py @@ -155,6 +155,7 @@ def __repr__(self) -> str: class ConnectionPolicyContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the ConnectionPolicyContext @@ -309,6 +310,7 @@ def __repr__(self) -> str: class ConnectionPolicyPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ConnectionPolicyInstance: """ Build an instance of ConnectionPolicyInstance @@ -327,6 +329,7 @@ def __repr__(self) -> str: class ConnectionPolicyList(ListResource): + def __init__(self, version: Version): """ Initialize the ConnectionPolicyList @@ -348,6 +351,7 @@ def create( :returns: The created ConnectionPolicyInstance """ + data = values.of( { "FriendlyName": friendly_name, @@ -372,6 +376,7 @@ 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 67b720914..d1f8a4152 100644 --- a/twilio/rest/voice/v1/connection_policy/connection_policy_target.py +++ b/twilio/rest/voice/v1/connection_policy/connection_policy_target.py @@ -185,6 +185,7 @@ def __repr__(self) -> str: class ConnectionPolicyTargetContext(InstanceContext): + def __init__(self, version: Version, connection_policy_sid: str, sid: str): """ Initialize the ConnectionPolicyTargetContext @@ -363,6 +364,7 @@ def __repr__(self) -> str: class ConnectionPolicyTargetPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> ConnectionPolicyTargetInstance: """ Build an instance of ConnectionPolicyTargetInstance @@ -385,6 +387,7 @@ def __repr__(self) -> str: class ConnectionPolicyTargetList(ListResource): + def __init__(self, version: Version, connection_policy_sid: str): """ Initialize the ConnectionPolicyTargetList @@ -422,6 +425,7 @@ def create( :returns: The created ConnectionPolicyTargetInstance """ + data = values.of( { "Target": target, @@ -463,6 +467,7 @@ async def create_async( :returns: The created ConnectionPolicyTargetInstance """ + data = values.of( { "Target": target, diff --git a/twilio/rest/voice/v1/dialing_permissions/__init__.py b/twilio/rest/voice/v1/dialing_permissions/__init__.py index 1439a7ef6..2346430ad 100644 --- a/twilio/rest/voice/v1/dialing_permissions/__init__.py +++ b/twilio/rest/voice/v1/dialing_permissions/__init__.py @@ -26,6 +26,7 @@ class DialingPermissionsList(ListResource): + def __init__(self, version: Version): """ Initialize the DialingPermissionsList 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 d8f2e33eb..60aa2642f 100644 --- a/twilio/rest/voice/v1/dialing_permissions/bulk_country_update.py +++ b/twilio/rest/voice/v1/dialing_permissions/bulk_country_update.py @@ -45,6 +45,7 @@ def __repr__(self) -> str: class BulkCountryUpdateList(ListResource): + def __init__(self, version: Version): """ Initialize the BulkCountryUpdateList @@ -64,6 +65,7 @@ def create(self, update_request: str) -> BulkCountryUpdateInstance: :returns: The created BulkCountryUpdateInstance """ + data = values.of( { "UpdateRequest": update_request, @@ -86,6 +88,7 @@ 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/dialing_permissions/country/__init__.py b/twilio/rest/voice/v1/dialing_permissions/country/__init__.py index 63bf8fa63..4f694f41b 100644 --- a/twilio/rest/voice/v1/dialing_permissions/country/__init__.py +++ b/twilio/rest/voice/v1/dialing_permissions/country/__init__.py @@ -114,6 +114,7 @@ def __repr__(self) -> str: class CountryContext(InstanceContext): + def __init__(self, version: Version, iso_code: str): """ Initialize the CountryContext @@ -192,6 +193,7 @@ def __repr__(self) -> str: class CountryPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> CountryInstance: """ Build an instance of CountryInstance @@ -210,6 +212,7 @@ def __repr__(self) -> str: class CountryList(ListResource): + def __init__(self, version: Version): """ Initialize the CountryList diff --git a/twilio/rest/voice/v1/dialing_permissions/country/highrisk_special_prefix.py b/twilio/rest/voice/v1/dialing_permissions/country/highrisk_special_prefix.py index ce08da28b..9303f2c9a 100644 --- a/twilio/rest/voice/v1/dialing_permissions/country/highrisk_special_prefix.py +++ b/twilio/rest/voice/v1/dialing_permissions/country/highrisk_special_prefix.py @@ -46,6 +46,7 @@ def __repr__(self) -> str: class HighriskSpecialPrefixPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> HighriskSpecialPrefixInstance: """ Build an instance of HighriskSpecialPrefixInstance @@ -66,6 +67,7 @@ def __repr__(self) -> str: class HighriskSpecialPrefixList(ListResource): + def __init__(self, version: Version, iso_code: str): """ Initialize the HighriskSpecialPrefixList diff --git a/twilio/rest/voice/v1/dialing_permissions/settings.py b/twilio/rest/voice/v1/dialing_permissions/settings.py index eba5fa801..6ede5e3a6 100644 --- a/twilio/rest/voice/v1/dialing_permissions/settings.py +++ b/twilio/rest/voice/v1/dialing_permissions/settings.py @@ -107,6 +107,7 @@ def __repr__(self) -> str: class SettingsContext(InstanceContext): + def __init__(self, version: Version): """ Initialize the SettingsContext @@ -212,6 +213,7 @@ def __repr__(self) -> str: class SettingsList(ListResource): + def __init__(self, version: Version): """ Initialize the SettingsList diff --git a/twilio/rest/voice/v1/ip_record.py b/twilio/rest/voice/v1/ip_record.py index 9e8a0f5c0..ee409ba78 100644 --- a/twilio/rest/voice/v1/ip_record.py +++ b/twilio/rest/voice/v1/ip_record.py @@ -149,6 +149,7 @@ def __repr__(self) -> str: class IpRecordContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the IpRecordContext @@ -285,6 +286,7 @@ def __repr__(self) -> str: class IpRecordPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> IpRecordInstance: """ Build an instance of IpRecordInstance @@ -303,6 +305,7 @@ def __repr__(self) -> str: class IpRecordList(ListResource): + def __init__(self, version: Version): """ Initialize the IpRecordList @@ -329,6 +332,7 @@ def create( :returns: The created IpRecordInstance """ + data = values.of( { "IpAddress": ip_address, @@ -360,6 +364,7 @@ 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 7123ca1aa..8a0d4a912 100644 --- a/twilio/rest/voice/v1/source_ip_mapping.py +++ b/twilio/rest/voice/v1/source_ip_mapping.py @@ -139,6 +139,7 @@ def __repr__(self) -> str: class SourceIpMappingContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the SourceIpMappingContext @@ -275,6 +276,7 @@ def __repr__(self) -> str: class SourceIpMappingPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> SourceIpMappingInstance: """ Build an instance of SourceIpMappingInstance @@ -293,6 +295,7 @@ def __repr__(self) -> str: class SourceIpMappingList(ListResource): + def __init__(self, version: Version): """ Initialize the SourceIpMappingList @@ -315,6 +318,7 @@ def create( :returns: The created SourceIpMappingInstance """ + data = values.of( { "IpRecordSid": ip_record_sid, @@ -341,6 +345,7 @@ async def create_async( :returns: The created SourceIpMappingInstance """ + data = values.of( { "IpRecordSid": ip_record_sid, diff --git a/twilio/rest/wireless/WirelessBase.py b/twilio/rest/wireless/WirelessBase.py index 5bec36968..0228c4d66 100644 --- a/twilio/rest/wireless/WirelessBase.py +++ b/twilio/rest/wireless/WirelessBase.py @@ -17,6 +17,7 @@ class WirelessBase(Domain): + def __init__(self, twilio: Client): """ Initialize the Wireless Domain diff --git a/twilio/rest/wireless/v1/__init__.py b/twilio/rest/wireless/v1/__init__.py index 7d94692e4..8f4d0dc5d 100644 --- a/twilio/rest/wireless/v1/__init__.py +++ b/twilio/rest/wireless/v1/__init__.py @@ -22,6 +22,7 @@ class V1(Version): + def __init__(self, domain: Domain): """ Initialize the V1 version of Wireless diff --git a/twilio/rest/wireless/v1/command.py b/twilio/rest/wireless/v1/command.py index b669e287d..cb33e1d39 100644 --- a/twilio/rest/wireless/v1/command.py +++ b/twilio/rest/wireless/v1/command.py @@ -23,6 +23,7 @@ class CommandInstance(InstanceResource): + class CommandMode(object): TEXT = "text" BINARY = "binary" @@ -150,6 +151,7 @@ def __repr__(self) -> str: class CommandContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the CommandContext @@ -238,6 +240,7 @@ def __repr__(self) -> str: class CommandPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> CommandInstance: """ Build an instance of CommandInstance @@ -256,6 +259,7 @@ def __repr__(self) -> str: class CommandList(ListResource): + def __init__(self, version: Version): """ Initialize the CommandList @@ -290,6 +294,7 @@ def create( :returns: The created CommandInstance """ + data = values.of( { "Command": command, @@ -333,6 +338,7 @@ 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 e6f6b4bcf..2bc893925 100644 --- a/twilio/rest/wireless/v1/rate_plan.py +++ b/twilio/rest/wireless/v1/rate_plan.py @@ -179,6 +179,7 @@ def __repr__(self) -> str: class RatePlanContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the RatePlanContext @@ -323,6 +324,7 @@ def __repr__(self) -> str: class RatePlanPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> RatePlanInstance: """ Build an instance of RatePlanInstance @@ -341,6 +343,7 @@ def __repr__(self) -> str: class RatePlanList(ListResource): + def __init__(self, version: Version): """ Initialize the RatePlanList @@ -383,6 +386,7 @@ def create( :returns: The created RatePlanInstance """ + data = values.of( { "UniqueName": unique_name, @@ -440,6 +444,7 @@ async def create_async( :returns: The created RatePlanInstance """ + data = values.of( { "UniqueName": unique_name, diff --git a/twilio/rest/wireless/v1/sim/__init__.py b/twilio/rest/wireless/v1/sim/__init__.py index 0060eb688..f0d21c447 100644 --- a/twilio/rest/wireless/v1/sim/__init__.py +++ b/twilio/rest/wireless/v1/sim/__init__.py @@ -25,6 +25,7 @@ class SimInstance(InstanceResource): + class ResetStatus(object): RESETTING = "resetting" @@ -316,6 +317,7 @@ def __repr__(self) -> str: class SimContext(InstanceContext): + def __init__(self, version: Version, sid: str): """ Initialize the SimContext @@ -583,6 +585,7 @@ def __repr__(self) -> str: class SimPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> SimInstance: """ Build an instance of SimInstance @@ -601,6 +604,7 @@ def __repr__(self) -> str: class SimList(ListResource): + def __init__(self, version: Version): """ Initialize the SimList diff --git a/twilio/rest/wireless/v1/sim/data_session.py b/twilio/rest/wireless/v1/sim/data_session.py index 0b94a9836..649eb4963 100644 --- a/twilio/rest/wireless/v1/sim/data_session.py +++ b/twilio/rest/wireless/v1/sim/data_session.py @@ -87,6 +87,7 @@ def __repr__(self) -> str: class DataSessionPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> DataSessionInstance: """ Build an instance of DataSessionInstance @@ -107,6 +108,7 @@ def __repr__(self) -> str: class DataSessionList(ListResource): + def __init__(self, version: Version, sim_sid: str): """ Initialize the DataSessionList diff --git a/twilio/rest/wireless/v1/sim/usage_record.py b/twilio/rest/wireless/v1/sim/usage_record.py index a759afe51..8b1db6d0d 100644 --- a/twilio/rest/wireless/v1/sim/usage_record.py +++ b/twilio/rest/wireless/v1/sim/usage_record.py @@ -23,6 +23,7 @@ class UsageRecordInstance(InstanceResource): + class Granularity(object): HOURLY = "hourly" DAILY = "daily" @@ -60,6 +61,7 @@ def __repr__(self) -> str: class UsageRecordPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> UsageRecordInstance: """ Build an instance of UsageRecordInstance @@ -80,6 +82,7 @@ def __repr__(self) -> str: class UsageRecordList(ListResource): + def __init__(self, version: Version, sim_sid: str): """ Initialize the UsageRecordList diff --git a/twilio/rest/wireless/v1/usage_record.py b/twilio/rest/wireless/v1/usage_record.py index 40992a01d..43e34469c 100644 --- a/twilio/rest/wireless/v1/usage_record.py +++ b/twilio/rest/wireless/v1/usage_record.py @@ -23,6 +23,7 @@ class UsageRecordInstance(InstanceResource): + class Granularity(object): HOURLY = "hourly" DAILY = "daily" @@ -54,6 +55,7 @@ def __repr__(self) -> str: class UsageRecordPage(Page): + def get_instance(self, payload: Dict[str, Any]) -> UsageRecordInstance: """ Build an instance of UsageRecordInstance @@ -72,6 +74,7 @@ def __repr__(self) -> str: class UsageRecordList(ListResource): + def __init__(self, version: Version): """ Initialize the UsageRecordList