From 6543c4a0a7aa2efe73c5bd5a8488ac7e16c90bff Mon Sep 17 00:00:00 2001 From: Shubham Date: Mon, 16 Jun 2025 13:04:39 +0530 Subject: [PATCH 1/7] chore: support Python 3.13 (#872) --- .github/workflows/test-and-deploy.yml | 2 +- README.md | 2 ++ setup.py | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-and-deploy.yml b/.github/workflows/test-and-deploy.yml index db745daca2..f5bd133256 100644 --- a/.github/workflows/test-and-deploy.yml +++ b/.github/workflows/test-and-deploy.yml @@ -17,7 +17,7 @@ jobs: timeout-minutes: 20 strategy: matrix: - python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ] + python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12', '3.13' ] steps: - name: Checkout twilio-python uses: actions/checkout@v3 diff --git a/README.md b/README.md index e6382a5242..ed277788d1 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,8 @@ This library supports the following Python implementations: - Python 3.9 - Python 3.10 - Python 3.11 +- Python 3.12 +- Python 3.13 ## Installation diff --git a/setup.py b/setup.py index fc1072b943..97004e4a02 100644 --- a/setup.py +++ b/setup.py @@ -39,6 +39,8 @@ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Programming Language :: Python :: Implementation :: CPython", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Communications :: Telephony", From ee0714ccb52582db6fd853450546fda4c014d15e Mon Sep 17 00:00:00 2001 From: Ankit Khani <42815139+akhani18@users.noreply.github.com> Date: Tue, 17 Jun 2025 22:53:10 -0700 Subject: [PATCH 2/7] chore: Remove references to microvisor (#865) * Deprecate microvisor * Update __init__.py --- twilio/rest/__init__.py | 15 - twilio/rest/microvisor/MicrovisorBase.py | 44 -- twilio/rest/microvisor/__init__.py | 43 -- twilio/rest/microvisor/v1/__init__.py | 67 -- twilio/rest/microvisor/v1/account_config.py | 585 ---------------- twilio/rest/microvisor/v1/account_secret.py | 583 ---------------- twilio/rest/microvisor/v1/app/__init__.py | 485 -------------- twilio/rest/microvisor/v1/app/app_manifest.py | 193 ------ twilio/rest/microvisor/v1/device/__init__.py | 588 ----------------- .../microvisor/v1/device/device_config.py | 622 ------------------ .../microvisor/v1/device/device_secret.py | 620 ----------------- 11 files changed, 3845 deletions(-) delete mode 100644 twilio/rest/microvisor/MicrovisorBase.py delete mode 100644 twilio/rest/microvisor/__init__.py delete mode 100644 twilio/rest/microvisor/v1/__init__.py delete mode 100644 twilio/rest/microvisor/v1/account_config.py delete mode 100644 twilio/rest/microvisor/v1/account_secret.py delete mode 100644 twilio/rest/microvisor/v1/app/__init__.py delete mode 100644 twilio/rest/microvisor/v1/app/app_manifest.py delete mode 100644 twilio/rest/microvisor/v1/device/__init__.py delete mode 100644 twilio/rest/microvisor/v1/device/device_config.py delete mode 100644 twilio/rest/microvisor/v1/device/device_secret.py diff --git a/twilio/rest/__init__.py b/twilio/rest/__init__.py index 5838363c52..823cbbfaa0 100644 --- a/twilio/rest/__init__.py +++ b/twilio/rest/__init__.py @@ -32,7 +32,6 @@ from twilio.rest.lookups import Lookups from twilio.rest.marketplace import Marketplace from twilio.rest.messaging import Messaging - from twilio.rest.microvisor import Microvisor from twilio.rest.monitor import Monitor from twilio.rest.notify import Notify from twilio.rest.numbers import Numbers @@ -145,7 +144,6 @@ def __init__( self._lookups: Optional["Lookups"] = None self._marketplace: Optional["Marketplace"] = None self._messaging: Optional["Messaging"] = None - self._microvisor: Optional["Microvisor"] = None self._monitor: Optional["Monitor"] = None self._notify: Optional["Notify"] = None self._numbers: Optional["Numbers"] = None @@ -400,19 +398,6 @@ def messaging(self) -> "Messaging": self._messaging = Messaging(self) return self._messaging - @property - def microvisor(self) -> "Microvisor": - """ - Access the Microvisor Twilio Domain - - :returns: Microvisor Twilio Domain - """ - if self._microvisor is None: - from twilio.rest.microvisor import Microvisor - - self._microvisor = Microvisor(self) - return self._microvisor - @property def monitor(self) -> "Monitor": """ diff --git a/twilio/rest/microvisor/MicrovisorBase.py b/twilio/rest/microvisor/MicrovisorBase.py deleted file mode 100644 index e8c874b920..0000000000 --- a/twilio/rest/microvisor/MicrovisorBase.py +++ /dev/null @@ -1,44 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - NOTE: This class is auto generated by OpenAPI Generator. - https://openapi-generator.tech - Do not edit the class manually. -""" - -from typing import Optional - -from twilio.base.domain import Domain -from twilio.rest import Client -from twilio.rest.microvisor.v1 import V1 - - -class MicrovisorBase(Domain): - - def __init__(self, twilio: Client): - """ - Initialize the Microvisor Domain - - :returns: Domain for Microvisor - """ - super().__init__(twilio, "https://microvisor.twilio.com") - self._v1: Optional[V1] = None - - @property - def v1(self) -> V1: - """ - :returns: Versions v1 of Microvisor - """ - 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/microvisor/__init__.py b/twilio/rest/microvisor/__init__.py deleted file mode 100644 index 6bf448b29c..0000000000 --- a/twilio/rest/microvisor/__init__.py +++ /dev/null @@ -1,43 +0,0 @@ -from warnings import warn - -from twilio.rest.microvisor.MicrovisorBase import MicrovisorBase -from twilio.rest.microvisor.v1.account_config import AccountConfigList -from twilio.rest.microvisor.v1.account_secret import AccountSecretList -from twilio.rest.microvisor.v1.app import AppList -from twilio.rest.microvisor.v1.device import DeviceList - - -class Microvisor(MicrovisorBase): - @property - def account_configs(self) -> AccountConfigList: - warn( - "account_configs is deprecated. Use v1.account_configs instead.", - DeprecationWarning, - stacklevel=2, - ) - return self.v1.account_configs - - @property - def account_secrets(self) -> AccountSecretList: - warn( - "account_secrets is deprecated. Use v1.account_secrets instead.", - DeprecationWarning, - stacklevel=2, - ) - return self.v1.account_secrets - - @property - def apps(self) -> AppList: - warn( - "apps is deprecated. Use v1.apps instead.", DeprecationWarning, stacklevel=2 - ) - return self.v1.apps - - @property - def devices(self) -> DeviceList: - warn( - "devices is deprecated. Use v1.devices instead.", - DeprecationWarning, - stacklevel=2, - ) - return self.v1.devices diff --git a/twilio/rest/microvisor/v1/__init__.py b/twilio/rest/microvisor/v1/__init__.py deleted file mode 100644 index 22010d62e5..0000000000 --- a/twilio/rest/microvisor/v1/__init__.py +++ /dev/null @@ -1,67 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Microvisor - 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.microvisor.v1.account_config import AccountConfigList -from twilio.rest.microvisor.v1.account_secret import AccountSecretList -from twilio.rest.microvisor.v1.app import AppList -from twilio.rest.microvisor.v1.device import DeviceList - - -class V1(Version): - - def __init__(self, domain: Domain): - """ - Initialize the V1 version of Microvisor - - :param domain: The Twilio.microvisor domain - """ - super().__init__(domain, "v1") - self._account_configs: Optional[AccountConfigList] = None - self._account_secrets: Optional[AccountSecretList] = None - self._apps: Optional[AppList] = None - self._devices: Optional[DeviceList] = None - - @property - def account_configs(self) -> AccountConfigList: - if self._account_configs is None: - self._account_configs = AccountConfigList(self) - return self._account_configs - - @property - def account_secrets(self) -> AccountSecretList: - if self._account_secrets is None: - self._account_secrets = AccountSecretList(self) - return self._account_secrets - - @property - def apps(self) -> AppList: - if self._apps is None: - self._apps = AppList(self) - return self._apps - - @property - def devices(self) -> DeviceList: - if self._devices is None: - self._devices = DeviceList(self) - return self._devices - - def __repr__(self) -> str: - """ - Provide a friendly representation - :returns: Machine friendly representation - """ - return "" diff --git a/twilio/rest/microvisor/v1/account_config.py b/twilio/rest/microvisor/v1/account_config.py deleted file mode 100644 index 7faba8acb1..0000000000 --- a/twilio/rest/microvisor/v1/account_config.py +++ /dev/null @@ -1,585 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Microvisor - 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 AccountConfigInstance(InstanceResource): - """ - :ivar key: The config key; up to 100 characters. - :ivar date_updated: - :ivar value: The config value; up to 4096 characters. - :ivar url: The absolute URL of the Config. - """ - - def __init__( - self, version: Version, payload: Dict[str, Any], key: Optional[str] = None - ): - super().__init__(version) - - self.key: Optional[str] = payload.get("key") - self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("date_updated") - ) - self.value: Optional[str] = payload.get("value") - self.url: Optional[str] = payload.get("url") - - self._solution = { - "key": key or self.key, - } - self._context: Optional[AccountConfigContext] = None - - @property - def _proxy(self) -> "AccountConfigContext": - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AccountConfigContext for this AccountConfigInstance - """ - if self._context is None: - self._context = AccountConfigContext( - self._version, - key=self._solution["key"], - ) - return self._context - - def delete(self) -> bool: - """ - Deletes the AccountConfigInstance - - - :returns: True if delete succeeds, False otherwise - """ - return self._proxy.delete() - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the AccountConfigInstance - - - :returns: True if delete succeeds, False otherwise - """ - return await self._proxy.delete_async() - - def fetch(self) -> "AccountConfigInstance": - """ - Fetch the AccountConfigInstance - - - :returns: The fetched AccountConfigInstance - """ - return self._proxy.fetch() - - async def fetch_async(self) -> "AccountConfigInstance": - """ - Asynchronous coroutine to fetch the AccountConfigInstance - - - :returns: The fetched AccountConfigInstance - """ - return await self._proxy.fetch_async() - - def update(self, value: str) -> "AccountConfigInstance": - """ - Update the AccountConfigInstance - - :param value: The config value; up to 4096 characters. - - :returns: The updated AccountConfigInstance - """ - return self._proxy.update( - value=value, - ) - - async def update_async(self, value: str) -> "AccountConfigInstance": - """ - Asynchronous coroutine to update the AccountConfigInstance - - :param value: The config value; up to 4096 characters. - - :returns: The updated AccountConfigInstance - """ - return await self._proxy.update_async( - value=value, - ) - - 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 AccountConfigContext(InstanceContext): - - def __init__(self, version: Version, key: str): - """ - Initialize the AccountConfigContext - - :param version: Version that contains the resource - :param key: The config key; up to 100 characters. - """ - super().__init__(version) - - # Path Solution - self._solution = { - "key": key, - } - self._uri = "/Configs/{key}".format(**self._solution) - - def delete(self) -> bool: - """ - Deletes the AccountConfigInstance - - - :returns: True if delete succeeds, False otherwise - """ - - headers = values.of({}) - - return self._version.delete(method="DELETE", uri=self._uri, headers=headers) - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the AccountConfigInstance - - - :returns: True if delete succeeds, False otherwise - """ - - headers = values.of({}) - - return await self._version.delete_async( - method="DELETE", uri=self._uri, headers=headers - ) - - def fetch(self) -> AccountConfigInstance: - """ - Fetch the AccountConfigInstance - - - :returns: The fetched AccountConfigInstance - """ - - headers = values.of({}) - - headers["Accept"] = "application/json" - - payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) - - return AccountConfigInstance( - self._version, - payload, - key=self._solution["key"], - ) - - async def fetch_async(self) -> AccountConfigInstance: - """ - Asynchronous coroutine to fetch the AccountConfigInstance - - - :returns: The fetched AccountConfigInstance - """ - - headers = values.of({}) - - headers["Accept"] = "application/json" - - payload = await self._version.fetch_async( - method="GET", uri=self._uri, headers=headers - ) - - return AccountConfigInstance( - self._version, - payload, - key=self._solution["key"], - ) - - def update(self, value: str) -> AccountConfigInstance: - """ - Update the AccountConfigInstance - - :param value: The config value; up to 4096 characters. - - :returns: The updated AccountConfigInstance - """ - - data = values.of( - { - "Value": value, - } - ) - headers = values.of({}) - - headers["Content-Type"] = "application/x-www-form-urlencoded" - - headers["Accept"] = "application/json" - - payload = self._version.update( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return AccountConfigInstance(self._version, payload, key=self._solution["key"]) - - async def update_async(self, value: str) -> AccountConfigInstance: - """ - Asynchronous coroutine to update the AccountConfigInstance - - :param value: The config value; up to 4096 characters. - - :returns: The updated AccountConfigInstance - """ - - data = values.of( - { - "Value": value, - } - ) - headers = values.of({}) - - headers["Content-Type"] = "application/x-www-form-urlencoded" - - headers["Accept"] = "application/json" - - payload = await self._version.update_async( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return AccountConfigInstance(self._version, payload, key=self._solution["key"]) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) - return "".format(context) - - -class AccountConfigPage(Page): - - def get_instance(self, payload: Dict[str, Any]) -> AccountConfigInstance: - """ - Build an instance of AccountConfigInstance - - :param payload: Payload response from the API - """ - return AccountConfigInstance(self._version, payload) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" - - -class AccountConfigList(ListResource): - - def __init__(self, version: Version): - """ - Initialize the AccountConfigList - - :param version: Version that contains the resource - - """ - super().__init__(version) - - self._uri = "/Configs" - - def create(self, key: str, value: str) -> AccountConfigInstance: - """ - Create the AccountConfigInstance - - :param key: The config key; up to 100 characters. - :param value: The config value; up to 4096 characters. - - :returns: The created AccountConfigInstance - """ - - data = values.of( - { - "Key": key, - "Value": value, - } - ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Content-Type"] = "application/x-www-form-urlencoded" - - headers["Accept"] = "application/json" - - payload = self._version.create( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return AccountConfigInstance(self._version, payload) - - async def create_async(self, key: str, value: str) -> AccountConfigInstance: - """ - Asynchronously create the AccountConfigInstance - - :param key: The config key; up to 100 characters. - :param value: The config value; up to 4096 characters. - - :returns: The created AccountConfigInstance - """ - - data = values.of( - { - "Key": key, - "Value": value, - } - ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Content-Type"] = "application/x-www-form-urlencoded" - - headers["Accept"] = "application/json" - - payload = await self._version.create_async( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return AccountConfigInstance(self._version, payload) - - def stream( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> Iterator[AccountConfigInstance]: - """ - Streams AccountConfigInstance 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[AccountConfigInstance]: - """ - Asynchronously streams AccountConfigInstance 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[AccountConfigInstance]: - """ - Lists AccountConfigInstance 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[AccountConfigInstance]: - """ - Asynchronously lists AccountConfigInstance 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, - ) -> AccountConfigPage: - """ - Retrieve a single page of AccountConfigInstance 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 AccountConfigInstance - """ - data = values.of( - { - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Accept"] = "application/json" - - response = self._version.page( - method="GET", uri=self._uri, params=data, headers=headers - ) - return AccountConfigPage(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, - ) -> AccountConfigPage: - """ - Asynchronously retrieve a single page of AccountConfigInstance 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 AccountConfigInstance - """ - data = values.of( - { - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Accept"] = "application/json" - - response = await self._version.page_async( - method="GET", uri=self._uri, params=data, headers=headers - ) - return AccountConfigPage(self._version, response) - - def get_page(self, target_url: str) -> AccountConfigPage: - """ - Retrieve a specific page of AccountConfigInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of AccountConfigInstance - """ - response = self._version.domain.twilio.request("GET", target_url) - return AccountConfigPage(self._version, response) - - async def get_page_async(self, target_url: str) -> AccountConfigPage: - """ - Asynchronously retrieve a specific page of AccountConfigInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of AccountConfigInstance - """ - response = await self._version.domain.twilio.request_async("GET", target_url) - return AccountConfigPage(self._version, response) - - def get(self, key: str) -> AccountConfigContext: - """ - Constructs a AccountConfigContext - - :param key: The config key; up to 100 characters. - """ - return AccountConfigContext(self._version, key=key) - - def __call__(self, key: str) -> AccountConfigContext: - """ - Constructs a AccountConfigContext - - :param key: The config key; up to 100 characters. - """ - return AccountConfigContext(self._version, key=key) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" diff --git a/twilio/rest/microvisor/v1/account_secret.py b/twilio/rest/microvisor/v1/account_secret.py deleted file mode 100644 index 13ca961e61..0000000000 --- a/twilio/rest/microvisor/v1/account_secret.py +++ /dev/null @@ -1,583 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Microvisor - 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 AccountSecretInstance(InstanceResource): - """ - :ivar key: The secret key; up to 100 characters. - :ivar date_rotated: - :ivar url: The absolute URL of the Secret. - """ - - def __init__( - self, version: Version, payload: Dict[str, Any], key: Optional[str] = None - ): - super().__init__(version) - - self.key: Optional[str] = payload.get("key") - self.date_rotated: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("date_rotated") - ) - self.url: Optional[str] = payload.get("url") - - self._solution = { - "key": key or self.key, - } - self._context: Optional[AccountSecretContext] = None - - @property - def _proxy(self) -> "AccountSecretContext": - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AccountSecretContext for this AccountSecretInstance - """ - if self._context is None: - self._context = AccountSecretContext( - self._version, - key=self._solution["key"], - ) - return self._context - - def delete(self) -> bool: - """ - Deletes the AccountSecretInstance - - - :returns: True if delete succeeds, False otherwise - """ - return self._proxy.delete() - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the AccountSecretInstance - - - :returns: True if delete succeeds, False otherwise - """ - return await self._proxy.delete_async() - - def fetch(self) -> "AccountSecretInstance": - """ - Fetch the AccountSecretInstance - - - :returns: The fetched AccountSecretInstance - """ - return self._proxy.fetch() - - async def fetch_async(self) -> "AccountSecretInstance": - """ - Asynchronous coroutine to fetch the AccountSecretInstance - - - :returns: The fetched AccountSecretInstance - """ - return await self._proxy.fetch_async() - - def update(self, value: str) -> "AccountSecretInstance": - """ - Update the AccountSecretInstance - - :param value: The secret value; up to 4096 characters. - - :returns: The updated AccountSecretInstance - """ - return self._proxy.update( - value=value, - ) - - async def update_async(self, value: str) -> "AccountSecretInstance": - """ - Asynchronous coroutine to update the AccountSecretInstance - - :param value: The secret value; up to 4096 characters. - - :returns: The updated AccountSecretInstance - """ - return await self._proxy.update_async( - value=value, - ) - - 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 AccountSecretContext(InstanceContext): - - def __init__(self, version: Version, key: str): - """ - Initialize the AccountSecretContext - - :param version: Version that contains the resource - :param key: The secret key; up to 100 characters. - """ - super().__init__(version) - - # Path Solution - self._solution = { - "key": key, - } - self._uri = "/Secrets/{key}".format(**self._solution) - - def delete(self) -> bool: - """ - Deletes the AccountSecretInstance - - - :returns: True if delete succeeds, False otherwise - """ - - headers = values.of({}) - - return self._version.delete(method="DELETE", uri=self._uri, headers=headers) - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the AccountSecretInstance - - - :returns: True if delete succeeds, False otherwise - """ - - headers = values.of({}) - - return await self._version.delete_async( - method="DELETE", uri=self._uri, headers=headers - ) - - def fetch(self) -> AccountSecretInstance: - """ - Fetch the AccountSecretInstance - - - :returns: The fetched AccountSecretInstance - """ - - headers = values.of({}) - - headers["Accept"] = "application/json" - - payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) - - return AccountSecretInstance( - self._version, - payload, - key=self._solution["key"], - ) - - async def fetch_async(self) -> AccountSecretInstance: - """ - Asynchronous coroutine to fetch the AccountSecretInstance - - - :returns: The fetched AccountSecretInstance - """ - - headers = values.of({}) - - headers["Accept"] = "application/json" - - payload = await self._version.fetch_async( - method="GET", uri=self._uri, headers=headers - ) - - return AccountSecretInstance( - self._version, - payload, - key=self._solution["key"], - ) - - def update(self, value: str) -> AccountSecretInstance: - """ - Update the AccountSecretInstance - - :param value: The secret value; up to 4096 characters. - - :returns: The updated AccountSecretInstance - """ - - data = values.of( - { - "Value": value, - } - ) - headers = values.of({}) - - headers["Content-Type"] = "application/x-www-form-urlencoded" - - headers["Accept"] = "application/json" - - payload = self._version.update( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return AccountSecretInstance(self._version, payload, key=self._solution["key"]) - - async def update_async(self, value: str) -> AccountSecretInstance: - """ - Asynchronous coroutine to update the AccountSecretInstance - - :param value: The secret value; up to 4096 characters. - - :returns: The updated AccountSecretInstance - """ - - data = values.of( - { - "Value": value, - } - ) - headers = values.of({}) - - headers["Content-Type"] = "application/x-www-form-urlencoded" - - headers["Accept"] = "application/json" - - payload = await self._version.update_async( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return AccountSecretInstance(self._version, payload, key=self._solution["key"]) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) - return "".format(context) - - -class AccountSecretPage(Page): - - def get_instance(self, payload: Dict[str, Any]) -> AccountSecretInstance: - """ - Build an instance of AccountSecretInstance - - :param payload: Payload response from the API - """ - return AccountSecretInstance(self._version, payload) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" - - -class AccountSecretList(ListResource): - - def __init__(self, version: Version): - """ - Initialize the AccountSecretList - - :param version: Version that contains the resource - - """ - super().__init__(version) - - self._uri = "/Secrets" - - def create(self, key: str, value: str) -> AccountSecretInstance: - """ - Create the AccountSecretInstance - - :param key: The secret key; up to 100 characters. - :param value: The secret value; up to 4096 characters. - - :returns: The created AccountSecretInstance - """ - - data = values.of( - { - "Key": key, - "Value": value, - } - ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Content-Type"] = "application/x-www-form-urlencoded" - - headers["Accept"] = "application/json" - - payload = self._version.create( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return AccountSecretInstance(self._version, payload) - - async def create_async(self, key: str, value: str) -> AccountSecretInstance: - """ - Asynchronously create the AccountSecretInstance - - :param key: The secret key; up to 100 characters. - :param value: The secret value; up to 4096 characters. - - :returns: The created AccountSecretInstance - """ - - data = values.of( - { - "Key": key, - "Value": value, - } - ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Content-Type"] = "application/x-www-form-urlencoded" - - headers["Accept"] = "application/json" - - payload = await self._version.create_async( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return AccountSecretInstance(self._version, payload) - - def stream( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> Iterator[AccountSecretInstance]: - """ - Streams AccountSecretInstance 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[AccountSecretInstance]: - """ - Asynchronously streams AccountSecretInstance 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[AccountSecretInstance]: - """ - Lists AccountSecretInstance 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[AccountSecretInstance]: - """ - Asynchronously lists AccountSecretInstance 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, - ) -> AccountSecretPage: - """ - Retrieve a single page of AccountSecretInstance 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 AccountSecretInstance - """ - data = values.of( - { - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Accept"] = "application/json" - - response = self._version.page( - method="GET", uri=self._uri, params=data, headers=headers - ) - return AccountSecretPage(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, - ) -> AccountSecretPage: - """ - Asynchronously retrieve a single page of AccountSecretInstance 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 AccountSecretInstance - """ - data = values.of( - { - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Accept"] = "application/json" - - response = await self._version.page_async( - method="GET", uri=self._uri, params=data, headers=headers - ) - return AccountSecretPage(self._version, response) - - def get_page(self, target_url: str) -> AccountSecretPage: - """ - Retrieve a specific page of AccountSecretInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of AccountSecretInstance - """ - response = self._version.domain.twilio.request("GET", target_url) - return AccountSecretPage(self._version, response) - - async def get_page_async(self, target_url: str) -> AccountSecretPage: - """ - Asynchronously retrieve a specific page of AccountSecretInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of AccountSecretInstance - """ - response = await self._version.domain.twilio.request_async("GET", target_url) - return AccountSecretPage(self._version, response) - - def get(self, key: str) -> AccountSecretContext: - """ - Constructs a AccountSecretContext - - :param key: The secret key; up to 100 characters. - """ - return AccountSecretContext(self._version, key=key) - - def __call__(self, key: str) -> AccountSecretContext: - """ - Constructs a AccountSecretContext - - :param key: The secret key; up to 100 characters. - """ - return AccountSecretContext(self._version, key=key) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" diff --git a/twilio/rest/microvisor/v1/app/__init__.py b/twilio/rest/microvisor/v1/app/__init__.py deleted file mode 100644 index 8cfbbe68df..0000000000 --- a/twilio/rest/microvisor/v1/app/__init__.py +++ /dev/null @@ -1,485 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Microvisor - 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.microvisor.v1.app.app_manifest import AppManifestList - - -class AppInstance(InstanceResource): - """ - :ivar sid: A 34-character string that uniquely identifies this App. - :ivar account_sid: The unique SID identifier of the Account. - :ivar hash: App manifest hash represented as `hash_algorithm:hash_value`. - :ivar unique_name: A developer-defined string that uniquely identifies the App. This value must be unique for all Apps on this Account. The `unique_name` value may be used as an alternative to the `sid` in the URL path to address the resource. - :ivar date_created: The date that this App was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - :ivar date_updated: The date that this App was last updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - :ivar url: The URL of this resource. - :ivar links: - """ - - def __init__( - self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None - ): - super().__init__(version) - - self.sid: Optional[str] = payload.get("sid") - self.account_sid: Optional[str] = payload.get("account_sid") - self.hash: Optional[str] = payload.get("hash") - self.unique_name: Optional[str] = payload.get("unique_name") - self.date_created: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("date_created") - ) - self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("date_updated") - ) - self.url: Optional[str] = payload.get("url") - self.links: Optional[Dict[str, object]] = payload.get("links") - - self._solution = { - "sid": sid or self.sid, - } - self._context: Optional[AppContext] = None - - @property - def _proxy(self) -> "AppContext": - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AppContext for this AppInstance - """ - if self._context is None: - self._context = AppContext( - self._version, - sid=self._solution["sid"], - ) - return self._context - - def delete(self) -> bool: - """ - Deletes the AppInstance - - - :returns: True if delete succeeds, False otherwise - """ - return self._proxy.delete() - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the AppInstance - - - :returns: True if delete succeeds, False otherwise - """ - return await self._proxy.delete_async() - - def fetch(self) -> "AppInstance": - """ - Fetch the AppInstance - - - :returns: The fetched AppInstance - """ - return self._proxy.fetch() - - async def fetch_async(self) -> "AppInstance": - """ - Asynchronous coroutine to fetch the AppInstance - - - :returns: The fetched AppInstance - """ - return await self._proxy.fetch_async() - - @property - def app_manifests(self) -> AppManifestList: - """ - Access the app_manifests - """ - return self._proxy.app_manifests - - 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 AppContext(InstanceContext): - - def __init__(self, version: Version, sid: str): - """ - Initialize the AppContext - - :param version: Version that contains the resource - :param sid: A 34-character string that uniquely identifies this App. - """ - super().__init__(version) - - # Path Solution - self._solution = { - "sid": sid, - } - self._uri = "/Apps/{sid}".format(**self._solution) - - self._app_manifests: Optional[AppManifestList] = None - - def delete(self) -> bool: - """ - Deletes the AppInstance - - - :returns: True if delete succeeds, False otherwise - """ - - headers = values.of({}) - - return self._version.delete(method="DELETE", uri=self._uri, headers=headers) - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the AppInstance - - - :returns: True if delete succeeds, False otherwise - """ - - headers = values.of({}) - - return await self._version.delete_async( - method="DELETE", uri=self._uri, headers=headers - ) - - def fetch(self) -> AppInstance: - """ - Fetch the AppInstance - - - :returns: The fetched AppInstance - """ - - headers = values.of({}) - - headers["Accept"] = "application/json" - - payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) - - return AppInstance( - self._version, - payload, - sid=self._solution["sid"], - ) - - async def fetch_async(self) -> AppInstance: - """ - Asynchronous coroutine to fetch the AppInstance - - - :returns: The fetched AppInstance - """ - - headers = values.of({}) - - headers["Accept"] = "application/json" - - payload = await self._version.fetch_async( - method="GET", uri=self._uri, headers=headers - ) - - return AppInstance( - self._version, - payload, - sid=self._solution["sid"], - ) - - @property - def app_manifests(self) -> AppManifestList: - """ - Access the app_manifests - """ - if self._app_manifests is None: - self._app_manifests = AppManifestList( - self._version, - self._solution["sid"], - ) - return self._app_manifests - - 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 AppPage(Page): - - def get_instance(self, payload: Dict[str, Any]) -> AppInstance: - """ - Build an instance of AppInstance - - :param payload: Payload response from the API - """ - return AppInstance(self._version, payload) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" - - -class AppList(ListResource): - - def __init__(self, version: Version): - """ - Initialize the AppList - - :param version: Version that contains the resource - - """ - super().__init__(version) - - self._uri = "/Apps" - - def stream( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> Iterator[AppInstance]: - """ - Streams AppInstance 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[AppInstance]: - """ - Asynchronously streams AppInstance 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[AppInstance]: - """ - Lists AppInstance 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[AppInstance]: - """ - Asynchronously lists AppInstance 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, - ) -> AppPage: - """ - Retrieve a single page of AppInstance 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 AppInstance - """ - data = values.of( - { - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Accept"] = "application/json" - - response = self._version.page( - method="GET", uri=self._uri, params=data, headers=headers - ) - return AppPage(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, - ) -> AppPage: - """ - Asynchronously retrieve a single page of AppInstance 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 AppInstance - """ - data = values.of( - { - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Accept"] = "application/json" - - response = await self._version.page_async( - method="GET", uri=self._uri, params=data, headers=headers - ) - return AppPage(self._version, response) - - def get_page(self, target_url: str) -> AppPage: - """ - Retrieve a specific page of AppInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of AppInstance - """ - response = self._version.domain.twilio.request("GET", target_url) - return AppPage(self._version, response) - - async def get_page_async(self, target_url: str) -> AppPage: - """ - Asynchronously retrieve a specific page of AppInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of AppInstance - """ - response = await self._version.domain.twilio.request_async("GET", target_url) - return AppPage(self._version, response) - - def get(self, sid: str) -> AppContext: - """ - Constructs a AppContext - - :param sid: A 34-character string that uniquely identifies this App. - """ - return AppContext(self._version, sid=sid) - - def __call__(self, sid: str) -> AppContext: - """ - Constructs a AppContext - - :param sid: A 34-character string that uniquely identifies this App. - """ - return AppContext(self._version, sid=sid) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" diff --git a/twilio/rest/microvisor/v1/app/app_manifest.py b/twilio/rest/microvisor/v1/app/app_manifest.py deleted file mode 100644 index 0412cadcc1..0000000000 --- a/twilio/rest/microvisor/v1/app/app_manifest.py +++ /dev/null @@ -1,193 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Microvisor - This is the public Twilio REST API. - - NOTE: This class is auto generated by OpenAPI Generator. - https://openapi-generator.tech - Do not edit the class manually. -""" - -from typing import Any, Dict, Optional -from twilio.base import values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.version import Version - - -class AppManifestInstance(InstanceResource): - """ - :ivar app_sid: A 34-character string that uniquely identifies this App. - :ivar hash: App manifest hash represented as `hash_algorithm:hash_value`. - :ivar encoded_bytes: The base-64 encoded manifest - :ivar url: The absolute URL of this Manifest. - """ - - def __init__(self, version: Version, payload: Dict[str, Any], app_sid: str): - super().__init__(version) - - self.app_sid: Optional[str] = payload.get("app_sid") - self.hash: Optional[str] = payload.get("hash") - self.encoded_bytes: Optional[str] = payload.get("encoded_bytes") - self.url: Optional[str] = payload.get("url") - - self._solution = { - "app_sid": app_sid, - } - self._context: Optional[AppManifestContext] = None - - @property - def _proxy(self) -> "AppManifestContext": - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AppManifestContext for this AppManifestInstance - """ - if self._context is None: - self._context = AppManifestContext( - self._version, - app_sid=self._solution["app_sid"], - ) - return self._context - - def fetch(self) -> "AppManifestInstance": - """ - Fetch the AppManifestInstance - - - :returns: The fetched AppManifestInstance - """ - return self._proxy.fetch() - - async def fetch_async(self) -> "AppManifestInstance": - """ - Asynchronous coroutine to fetch the AppManifestInstance - - - :returns: The fetched AppManifestInstance - """ - 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 AppManifestContext(InstanceContext): - - def __init__(self, version: Version, app_sid: str): - """ - Initialize the AppManifestContext - - :param version: Version that contains the resource - :param app_sid: A 34-character string that uniquely identifies this App. - """ - super().__init__(version) - - # Path Solution - self._solution = { - "app_sid": app_sid, - } - self._uri = "/Apps/{app_sid}/Manifest".format(**self._solution) - - def fetch(self) -> AppManifestInstance: - """ - Fetch the AppManifestInstance - - - :returns: The fetched AppManifestInstance - """ - - headers = values.of({}) - - headers["Accept"] = "application/json" - - payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) - - return AppManifestInstance( - self._version, - payload, - app_sid=self._solution["app_sid"], - ) - - async def fetch_async(self) -> AppManifestInstance: - """ - Asynchronous coroutine to fetch the AppManifestInstance - - - :returns: The fetched AppManifestInstance - """ - - headers = values.of({}) - - headers["Accept"] = "application/json" - - payload = await self._version.fetch_async( - method="GET", uri=self._uri, headers=headers - ) - - return AppManifestInstance( - self._version, - payload, - app_sid=self._solution["app_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 AppManifestList(ListResource): - - def __init__(self, version: Version, app_sid: str): - """ - Initialize the AppManifestList - - :param version: Version that contains the resource - :param app_sid: A 34-character string that uniquely identifies this App. - - """ - super().__init__(version) - - # Path Solution - self._solution = { - "app_sid": app_sid, - } - - def get(self) -> AppManifestContext: - """ - Constructs a AppManifestContext - - """ - return AppManifestContext(self._version, app_sid=self._solution["app_sid"]) - - def __call__(self) -> AppManifestContext: - """ - Constructs a AppManifestContext - - """ - return AppManifestContext(self._version, app_sid=self._solution["app_sid"]) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" diff --git a/twilio/rest/microvisor/v1/device/__init__.py b/twilio/rest/microvisor/v1/device/__init__.py deleted file mode 100644 index a3b3089162..0000000000 --- a/twilio/rest/microvisor/v1/device/__init__.py +++ /dev/null @@ -1,588 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Microvisor - 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.microvisor.v1.device.device_config import DeviceConfigList -from twilio.rest.microvisor.v1.device.device_secret import DeviceSecretList - - -class DeviceInstance(InstanceResource): - """ - :ivar sid: A 34-character string that uniquely identifies this Device. - :ivar unique_name: A developer-defined string that uniquely identifies the Device. This value must be unique for all Devices on this Account. The `unique_name` value may be used as an alternative to the `sid` in the URL path to address the resource. - :ivar account_sid: The unique SID identifier of the Account. - :ivar app: Information about the target App and the App reported by this Device. Contains the properties `target_sid`, `date_targeted`, `update_status` (one of `up-to-date`, `pending` and `error`), `update_error_code`, `reported_sid` and `date_reported`. - :ivar logging: Object specifying whether application logging is enabled for this Device. Contains the properties `enabled` and `date_expires`. - :ivar date_created: The date that this Device was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - :ivar date_updated: The date that this Device was last updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - :ivar url: The URL of this resource. - :ivar links: The absolute URLs of related resources. - """ - - def __init__( - self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None - ): - super().__init__(version) - - self.sid: Optional[str] = payload.get("sid") - self.unique_name: Optional[str] = payload.get("unique_name") - self.account_sid: Optional[str] = payload.get("account_sid") - self.app: Optional[Dict[str, object]] = payload.get("app") - self.logging: Optional[Dict[str, object]] = payload.get("logging") - self.date_created: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("date_created") - ) - self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("date_updated") - ) - self.url: Optional[str] = payload.get("url") - self.links: Optional[Dict[str, object]] = payload.get("links") - - self._solution = { - "sid": sid or self.sid, - } - self._context: Optional[DeviceContext] = None - - @property - def _proxy(self) -> "DeviceContext": - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: DeviceContext for this DeviceInstance - """ - if self._context is None: - self._context = DeviceContext( - self._version, - sid=self._solution["sid"], - ) - return self._context - - def fetch(self) -> "DeviceInstance": - """ - Fetch the DeviceInstance - - - :returns: The fetched DeviceInstance - """ - return self._proxy.fetch() - - async def fetch_async(self) -> "DeviceInstance": - """ - Asynchronous coroutine to fetch the DeviceInstance - - - :returns: The fetched DeviceInstance - """ - return await self._proxy.fetch_async() - - def update( - self, - unique_name: Union[str, object] = values.unset, - target_app: Union[str, object] = values.unset, - logging_enabled: Union[bool, object] = values.unset, - restart_app: Union[bool, object] = values.unset, - ) -> "DeviceInstance": - """ - Update the DeviceInstance - - :param unique_name: A unique and addressable name to be assigned to this Device by the developer. It may be used in place of the Device SID. - :param target_app: The SID or unique name of the App to be targeted to the Device. - :param logging_enabled: A Boolean flag specifying whether to enable application logging. Logs will be enabled or extended for 24 hours. - :param restart_app: Set to true to restart the App running on the Device. - - :returns: The updated DeviceInstance - """ - return self._proxy.update( - unique_name=unique_name, - target_app=target_app, - logging_enabled=logging_enabled, - restart_app=restart_app, - ) - - async def update_async( - self, - unique_name: Union[str, object] = values.unset, - target_app: Union[str, object] = values.unset, - logging_enabled: Union[bool, object] = values.unset, - restart_app: Union[bool, object] = values.unset, - ) -> "DeviceInstance": - """ - Asynchronous coroutine to update the DeviceInstance - - :param unique_name: A unique and addressable name to be assigned to this Device by the developer. It may be used in place of the Device SID. - :param target_app: The SID or unique name of the App to be targeted to the Device. - :param logging_enabled: A Boolean flag specifying whether to enable application logging. Logs will be enabled or extended for 24 hours. - :param restart_app: Set to true to restart the App running on the Device. - - :returns: The updated DeviceInstance - """ - return await self._proxy.update_async( - unique_name=unique_name, - target_app=target_app, - logging_enabled=logging_enabled, - restart_app=restart_app, - ) - - @property - def device_configs(self) -> DeviceConfigList: - """ - Access the device_configs - """ - return self._proxy.device_configs - - @property - def device_secrets(self) -> DeviceSecretList: - """ - Access the device_secrets - """ - return self._proxy.device_secrets - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) - return "".format(context) - - -class DeviceContext(InstanceContext): - - def __init__(self, version: Version, sid: str): - """ - Initialize the DeviceContext - - :param version: Version that contains the resource - :param sid: A 34-character string that uniquely identifies this Device. - """ - super().__init__(version) - - # Path Solution - self._solution = { - "sid": sid, - } - self._uri = "/Devices/{sid}".format(**self._solution) - - self._device_configs: Optional[DeviceConfigList] = None - self._device_secrets: Optional[DeviceSecretList] = None - - def fetch(self) -> DeviceInstance: - """ - Fetch the DeviceInstance - - - :returns: The fetched DeviceInstance - """ - - headers = values.of({}) - - headers["Accept"] = "application/json" - - payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) - - return DeviceInstance( - self._version, - payload, - sid=self._solution["sid"], - ) - - async def fetch_async(self) -> DeviceInstance: - """ - Asynchronous coroutine to fetch the DeviceInstance - - - :returns: The fetched DeviceInstance - """ - - headers = values.of({}) - - headers["Accept"] = "application/json" - - payload = await self._version.fetch_async( - method="GET", uri=self._uri, headers=headers - ) - - return DeviceInstance( - self._version, - payload, - sid=self._solution["sid"], - ) - - def update( - self, - unique_name: Union[str, object] = values.unset, - target_app: Union[str, object] = values.unset, - logging_enabled: Union[bool, object] = values.unset, - restart_app: Union[bool, object] = values.unset, - ) -> DeviceInstance: - """ - Update the DeviceInstance - - :param unique_name: A unique and addressable name to be assigned to this Device by the developer. It may be used in place of the Device SID. - :param target_app: The SID or unique name of the App to be targeted to the Device. - :param logging_enabled: A Boolean flag specifying whether to enable application logging. Logs will be enabled or extended for 24 hours. - :param restart_app: Set to true to restart the App running on the Device. - - :returns: The updated DeviceInstance - """ - - data = values.of( - { - "UniqueName": unique_name, - "TargetApp": target_app, - "LoggingEnabled": serialize.boolean_to_string(logging_enabled), - "RestartApp": serialize.boolean_to_string(restart_app), - } - ) - headers = values.of({}) - - headers["Content-Type"] = "application/x-www-form-urlencoded" - - headers["Accept"] = "application/json" - - payload = self._version.update( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return DeviceInstance(self._version, payload, sid=self._solution["sid"]) - - async def update_async( - self, - unique_name: Union[str, object] = values.unset, - target_app: Union[str, object] = values.unset, - logging_enabled: Union[bool, object] = values.unset, - restart_app: Union[bool, object] = values.unset, - ) -> DeviceInstance: - """ - Asynchronous coroutine to update the DeviceInstance - - :param unique_name: A unique and addressable name to be assigned to this Device by the developer. It may be used in place of the Device SID. - :param target_app: The SID or unique name of the App to be targeted to the Device. - :param logging_enabled: A Boolean flag specifying whether to enable application logging. Logs will be enabled or extended for 24 hours. - :param restart_app: Set to true to restart the App running on the Device. - - :returns: The updated DeviceInstance - """ - - data = values.of( - { - "UniqueName": unique_name, - "TargetApp": target_app, - "LoggingEnabled": serialize.boolean_to_string(logging_enabled), - "RestartApp": serialize.boolean_to_string(restart_app), - } - ) - headers = values.of({}) - - headers["Content-Type"] = "application/x-www-form-urlencoded" - - headers["Accept"] = "application/json" - - payload = await self._version.update_async( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return DeviceInstance(self._version, payload, sid=self._solution["sid"]) - - @property - def device_configs(self) -> DeviceConfigList: - """ - Access the device_configs - """ - if self._device_configs is None: - self._device_configs = DeviceConfigList( - self._version, - self._solution["sid"], - ) - return self._device_configs - - @property - def device_secrets(self) -> DeviceSecretList: - """ - Access the device_secrets - """ - if self._device_secrets is None: - self._device_secrets = DeviceSecretList( - self._version, - self._solution["sid"], - ) - return self._device_secrets - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) - return "".format(context) - - -class DevicePage(Page): - - def get_instance(self, payload: Dict[str, Any]) -> DeviceInstance: - """ - Build an instance of DeviceInstance - - :param payload: Payload response from the API - """ - return DeviceInstance(self._version, payload) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" - - -class DeviceList(ListResource): - - def __init__(self, version: Version): - """ - Initialize the DeviceList - - :param version: Version that contains the resource - - """ - super().__init__(version) - - self._uri = "/Devices" - - def stream( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> Iterator[DeviceInstance]: - """ - Streams DeviceInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param 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[DeviceInstance]: - """ - Asynchronously streams DeviceInstance records from the API as a generator stream. - This operation lazily loads records as efficiently as possible until the limit - is reached. - The results are returned as a generator, so this operation is memory efficient. - - :param 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[DeviceInstance]: - """ - Lists DeviceInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param 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[DeviceInstance]: - """ - Asynchronously lists DeviceInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param 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, - ) -> DevicePage: - """ - Retrieve a single page of DeviceInstance 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 DeviceInstance - """ - data = values.of( - { - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Accept"] = "application/json" - - response = self._version.page( - method="GET", uri=self._uri, params=data, headers=headers - ) - return DevicePage(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, - ) -> DevicePage: - """ - Asynchronously retrieve a single page of DeviceInstance 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 DeviceInstance - """ - data = values.of( - { - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Accept"] = "application/json" - - response = await self._version.page_async( - method="GET", uri=self._uri, params=data, headers=headers - ) - return DevicePage(self._version, response) - - def get_page(self, target_url: str) -> DevicePage: - """ - Retrieve a specific page of DeviceInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of DeviceInstance - """ - response = self._version.domain.twilio.request("GET", target_url) - return DevicePage(self._version, response) - - async def get_page_async(self, target_url: str) -> DevicePage: - """ - Asynchronously retrieve a specific page of DeviceInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of DeviceInstance - """ - response = await self._version.domain.twilio.request_async("GET", target_url) - return DevicePage(self._version, response) - - def get(self, sid: str) -> DeviceContext: - """ - Constructs a DeviceContext - - :param sid: A 34-character string that uniquely identifies this Device. - """ - return DeviceContext(self._version, sid=sid) - - def __call__(self, sid: str) -> DeviceContext: - """ - Constructs a DeviceContext - - :param sid: A 34-character string that uniquely identifies this Device. - """ - return DeviceContext(self._version, sid=sid) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" diff --git a/twilio/rest/microvisor/v1/device/device_config.py b/twilio/rest/microvisor/v1/device/device_config.py deleted file mode 100644 index b87063f53f..0000000000 --- a/twilio/rest/microvisor/v1/device/device_config.py +++ /dev/null @@ -1,622 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Microvisor - 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 DeviceConfigInstance(InstanceResource): - """ - :ivar device_sid: A 34-character string that uniquely identifies the parent Device. - :ivar key: The config key; up to 100 characters. - :ivar value: The config value; up to 4096 characters. - :ivar date_updated: - :ivar url: The absolute URL of the Config. - """ - - def __init__( - self, - version: Version, - payload: Dict[str, Any], - device_sid: str, - key: Optional[str] = None, - ): - super().__init__(version) - - self.device_sid: Optional[str] = payload.get("device_sid") - self.key: Optional[str] = payload.get("key") - self.value: Optional[str] = payload.get("value") - self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("date_updated") - ) - self.url: Optional[str] = payload.get("url") - - self._solution = { - "device_sid": device_sid, - "key": key or self.key, - } - self._context: Optional[DeviceConfigContext] = None - - @property - def _proxy(self) -> "DeviceConfigContext": - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: DeviceConfigContext for this DeviceConfigInstance - """ - if self._context is None: - self._context = DeviceConfigContext( - self._version, - device_sid=self._solution["device_sid"], - key=self._solution["key"], - ) - return self._context - - def delete(self) -> bool: - """ - Deletes the DeviceConfigInstance - - - :returns: True if delete succeeds, False otherwise - """ - return self._proxy.delete() - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the DeviceConfigInstance - - - :returns: True if delete succeeds, False otherwise - """ - return await self._proxy.delete_async() - - def fetch(self) -> "DeviceConfigInstance": - """ - Fetch the DeviceConfigInstance - - - :returns: The fetched DeviceConfigInstance - """ - return self._proxy.fetch() - - async def fetch_async(self) -> "DeviceConfigInstance": - """ - Asynchronous coroutine to fetch the DeviceConfigInstance - - - :returns: The fetched DeviceConfigInstance - """ - return await self._proxy.fetch_async() - - def update(self, value: str) -> "DeviceConfigInstance": - """ - Update the DeviceConfigInstance - - :param value: The config value; up to 4096 characters. - - :returns: The updated DeviceConfigInstance - """ - return self._proxy.update( - value=value, - ) - - async def update_async(self, value: str) -> "DeviceConfigInstance": - """ - Asynchronous coroutine to update the DeviceConfigInstance - - :param value: The config value; up to 4096 characters. - - :returns: The updated DeviceConfigInstance - """ - return await self._proxy.update_async( - value=value, - ) - - 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 DeviceConfigContext(InstanceContext): - - def __init__(self, version: Version, device_sid: str, key: str): - """ - Initialize the DeviceConfigContext - - :param version: Version that contains the resource - :param device_sid: A 34-character string that uniquely identifies the Device. - :param key: The config key; up to 100 characters. - """ - super().__init__(version) - - # Path Solution - self._solution = { - "device_sid": device_sid, - "key": key, - } - self._uri = "/Devices/{device_sid}/Configs/{key}".format(**self._solution) - - def delete(self) -> bool: - """ - Deletes the DeviceConfigInstance - - - :returns: True if delete succeeds, False otherwise - """ - - headers = values.of({}) - - return self._version.delete(method="DELETE", uri=self._uri, headers=headers) - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the DeviceConfigInstance - - - :returns: True if delete succeeds, False otherwise - """ - - headers = values.of({}) - - return await self._version.delete_async( - method="DELETE", uri=self._uri, headers=headers - ) - - def fetch(self) -> DeviceConfigInstance: - """ - Fetch the DeviceConfigInstance - - - :returns: The fetched DeviceConfigInstance - """ - - headers = values.of({}) - - headers["Accept"] = "application/json" - - payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) - - return DeviceConfigInstance( - self._version, - payload, - device_sid=self._solution["device_sid"], - key=self._solution["key"], - ) - - async def fetch_async(self) -> DeviceConfigInstance: - """ - Asynchronous coroutine to fetch the DeviceConfigInstance - - - :returns: The fetched DeviceConfigInstance - """ - - headers = values.of({}) - - headers["Accept"] = "application/json" - - payload = await self._version.fetch_async( - method="GET", uri=self._uri, headers=headers - ) - - return DeviceConfigInstance( - self._version, - payload, - device_sid=self._solution["device_sid"], - key=self._solution["key"], - ) - - def update(self, value: str) -> DeviceConfigInstance: - """ - Update the DeviceConfigInstance - - :param value: The config value; up to 4096 characters. - - :returns: The updated DeviceConfigInstance - """ - - data = values.of( - { - "Value": value, - } - ) - headers = values.of({}) - - headers["Content-Type"] = "application/x-www-form-urlencoded" - - headers["Accept"] = "application/json" - - payload = self._version.update( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return DeviceConfigInstance( - self._version, - payload, - device_sid=self._solution["device_sid"], - key=self._solution["key"], - ) - - async def update_async(self, value: str) -> DeviceConfigInstance: - """ - Asynchronous coroutine to update the DeviceConfigInstance - - :param value: The config value; up to 4096 characters. - - :returns: The updated DeviceConfigInstance - """ - - data = values.of( - { - "Value": value, - } - ) - headers = values.of({}) - - headers["Content-Type"] = "application/x-www-form-urlencoded" - - headers["Accept"] = "application/json" - - payload = await self._version.update_async( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return DeviceConfigInstance( - self._version, - payload, - device_sid=self._solution["device_sid"], - key=self._solution["key"], - ) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) - return "".format(context) - - -class DeviceConfigPage(Page): - - def get_instance(self, payload: Dict[str, Any]) -> DeviceConfigInstance: - """ - Build an instance of DeviceConfigInstance - - :param payload: Payload response from the API - """ - return DeviceConfigInstance( - self._version, payload, device_sid=self._solution["device_sid"] - ) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" - - -class DeviceConfigList(ListResource): - - def __init__(self, version: Version, device_sid: str): - """ - Initialize the DeviceConfigList - - :param version: Version that contains the resource - :param device_sid: A 34-character string that uniquely identifies the Device. - - """ - super().__init__(version) - - # Path Solution - self._solution = { - "device_sid": device_sid, - } - self._uri = "/Devices/{device_sid}/Configs".format(**self._solution) - - def create(self, key: str, value: str) -> DeviceConfigInstance: - """ - Create the DeviceConfigInstance - - :param key: The config key; up to 100 characters. - :param value: The config value; up to 4096 characters. - - :returns: The created DeviceConfigInstance - """ - - data = values.of( - { - "Key": key, - "Value": value, - } - ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Content-Type"] = "application/x-www-form-urlencoded" - - headers["Accept"] = "application/json" - - payload = self._version.create( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return DeviceConfigInstance( - self._version, payload, device_sid=self._solution["device_sid"] - ) - - async def create_async(self, key: str, value: str) -> DeviceConfigInstance: - """ - Asynchronously create the DeviceConfigInstance - - :param key: The config key; up to 100 characters. - :param value: The config value; up to 4096 characters. - - :returns: The created DeviceConfigInstance - """ - - data = values.of( - { - "Key": key, - "Value": value, - } - ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Content-Type"] = "application/x-www-form-urlencoded" - - headers["Accept"] = "application/json" - - payload = await self._version.create_async( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return DeviceConfigInstance( - self._version, payload, device_sid=self._solution["device_sid"] - ) - - def stream( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> Iterator[DeviceConfigInstance]: - """ - Streams DeviceConfigInstance 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[DeviceConfigInstance]: - """ - Asynchronously streams DeviceConfigInstance 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[DeviceConfigInstance]: - """ - Lists DeviceConfigInstance 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[DeviceConfigInstance]: - """ - Asynchronously lists DeviceConfigInstance 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, - ) -> DeviceConfigPage: - """ - Retrieve a single page of DeviceConfigInstance 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 DeviceConfigInstance - """ - data = values.of( - { - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Accept"] = "application/json" - - response = self._version.page( - method="GET", uri=self._uri, params=data, headers=headers - ) - return DeviceConfigPage(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, - ) -> DeviceConfigPage: - """ - Asynchronously retrieve a single page of DeviceConfigInstance 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 DeviceConfigInstance - """ - data = values.of( - { - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Accept"] = "application/json" - - response = await self._version.page_async( - method="GET", uri=self._uri, params=data, headers=headers - ) - return DeviceConfigPage(self._version, response, self._solution) - - def get_page(self, target_url: str) -> DeviceConfigPage: - """ - Retrieve a specific page of DeviceConfigInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of DeviceConfigInstance - """ - response = self._version.domain.twilio.request("GET", target_url) - return DeviceConfigPage(self._version, response, self._solution) - - async def get_page_async(self, target_url: str) -> DeviceConfigPage: - """ - Asynchronously retrieve a specific page of DeviceConfigInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of DeviceConfigInstance - """ - response = await self._version.domain.twilio.request_async("GET", target_url) - return DeviceConfigPage(self._version, response, self._solution) - - def get(self, key: str) -> DeviceConfigContext: - """ - Constructs a DeviceConfigContext - - :param key: The config key; up to 100 characters. - """ - return DeviceConfigContext( - self._version, device_sid=self._solution["device_sid"], key=key - ) - - def __call__(self, key: str) -> DeviceConfigContext: - """ - Constructs a DeviceConfigContext - - :param key: The config key; up to 100 characters. - """ - return DeviceConfigContext( - self._version, device_sid=self._solution["device_sid"], key=key - ) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" diff --git a/twilio/rest/microvisor/v1/device/device_secret.py b/twilio/rest/microvisor/v1/device/device_secret.py deleted file mode 100644 index 30b805ea6b..0000000000 --- a/twilio/rest/microvisor/v1/device/device_secret.py +++ /dev/null @@ -1,620 +0,0 @@ -r""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Microvisor - 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 DeviceSecretInstance(InstanceResource): - """ - :ivar device_sid: A 34-character string that uniquely identifies the parent Device. - :ivar key: The secret key; up to 100 characters. - :ivar date_rotated: - :ivar url: The absolute URL of the Secret. - """ - - def __init__( - self, - version: Version, - payload: Dict[str, Any], - device_sid: str, - key: Optional[str] = None, - ): - super().__init__(version) - - self.device_sid: Optional[str] = payload.get("device_sid") - self.key: Optional[str] = payload.get("key") - self.date_rotated: Optional[datetime] = deserialize.iso8601_datetime( - payload.get("date_rotated") - ) - self.url: Optional[str] = payload.get("url") - - self._solution = { - "device_sid": device_sid, - "key": key or self.key, - } - self._context: Optional[DeviceSecretContext] = None - - @property - def _proxy(self) -> "DeviceSecretContext": - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: DeviceSecretContext for this DeviceSecretInstance - """ - if self._context is None: - self._context = DeviceSecretContext( - self._version, - device_sid=self._solution["device_sid"], - key=self._solution["key"], - ) - return self._context - - def delete(self) -> bool: - """ - Deletes the DeviceSecretInstance - - - :returns: True if delete succeeds, False otherwise - """ - return self._proxy.delete() - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the DeviceSecretInstance - - - :returns: True if delete succeeds, False otherwise - """ - return await self._proxy.delete_async() - - def fetch(self) -> "DeviceSecretInstance": - """ - Fetch the DeviceSecretInstance - - - :returns: The fetched DeviceSecretInstance - """ - return self._proxy.fetch() - - async def fetch_async(self) -> "DeviceSecretInstance": - """ - Asynchronous coroutine to fetch the DeviceSecretInstance - - - :returns: The fetched DeviceSecretInstance - """ - return await self._proxy.fetch_async() - - def update(self, value: str) -> "DeviceSecretInstance": - """ - Update the DeviceSecretInstance - - :param value: The secret value; up to 4096 characters. - - :returns: The updated DeviceSecretInstance - """ - return self._proxy.update( - value=value, - ) - - async def update_async(self, value: str) -> "DeviceSecretInstance": - """ - Asynchronous coroutine to update the DeviceSecretInstance - - :param value: The secret value; up to 4096 characters. - - :returns: The updated DeviceSecretInstance - """ - return await self._proxy.update_async( - value=value, - ) - - 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 DeviceSecretContext(InstanceContext): - - def __init__(self, version: Version, device_sid: str, key: str): - """ - Initialize the DeviceSecretContext - - :param version: Version that contains the resource - :param device_sid: A 34-character string that uniquely identifies the Device. - :param key: The secret key; up to 100 characters. - """ - super().__init__(version) - - # Path Solution - self._solution = { - "device_sid": device_sid, - "key": key, - } - self._uri = "/Devices/{device_sid}/Secrets/{key}".format(**self._solution) - - def delete(self) -> bool: - """ - Deletes the DeviceSecretInstance - - - :returns: True if delete succeeds, False otherwise - """ - - headers = values.of({}) - - return self._version.delete(method="DELETE", uri=self._uri, headers=headers) - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the DeviceSecretInstance - - - :returns: True if delete succeeds, False otherwise - """ - - headers = values.of({}) - - return await self._version.delete_async( - method="DELETE", uri=self._uri, headers=headers - ) - - def fetch(self) -> DeviceSecretInstance: - """ - Fetch the DeviceSecretInstance - - - :returns: The fetched DeviceSecretInstance - """ - - headers = values.of({}) - - headers["Accept"] = "application/json" - - payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) - - return DeviceSecretInstance( - self._version, - payload, - device_sid=self._solution["device_sid"], - key=self._solution["key"], - ) - - async def fetch_async(self) -> DeviceSecretInstance: - """ - Asynchronous coroutine to fetch the DeviceSecretInstance - - - :returns: The fetched DeviceSecretInstance - """ - - headers = values.of({}) - - headers["Accept"] = "application/json" - - payload = await self._version.fetch_async( - method="GET", uri=self._uri, headers=headers - ) - - return DeviceSecretInstance( - self._version, - payload, - device_sid=self._solution["device_sid"], - key=self._solution["key"], - ) - - def update(self, value: str) -> DeviceSecretInstance: - """ - Update the DeviceSecretInstance - - :param value: The secret value; up to 4096 characters. - - :returns: The updated DeviceSecretInstance - """ - - data = values.of( - { - "Value": value, - } - ) - headers = values.of({}) - - headers["Content-Type"] = "application/x-www-form-urlencoded" - - headers["Accept"] = "application/json" - - payload = self._version.update( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return DeviceSecretInstance( - self._version, - payload, - device_sid=self._solution["device_sid"], - key=self._solution["key"], - ) - - async def update_async(self, value: str) -> DeviceSecretInstance: - """ - Asynchronous coroutine to update the DeviceSecretInstance - - :param value: The secret value; up to 4096 characters. - - :returns: The updated DeviceSecretInstance - """ - - data = values.of( - { - "Value": value, - } - ) - headers = values.of({}) - - headers["Content-Type"] = "application/x-www-form-urlencoded" - - headers["Accept"] = "application/json" - - payload = await self._version.update_async( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return DeviceSecretInstance( - self._version, - payload, - device_sid=self._solution["device_sid"], - key=self._solution["key"], - ) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) - return "".format(context) - - -class DeviceSecretPage(Page): - - def get_instance(self, payload: Dict[str, Any]) -> DeviceSecretInstance: - """ - Build an instance of DeviceSecretInstance - - :param payload: Payload response from the API - """ - return DeviceSecretInstance( - self._version, payload, device_sid=self._solution["device_sid"] - ) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" - - -class DeviceSecretList(ListResource): - - def __init__(self, version: Version, device_sid: str): - """ - Initialize the DeviceSecretList - - :param version: Version that contains the resource - :param device_sid: A 34-character string that uniquely identifies the Device. - - """ - super().__init__(version) - - # Path Solution - self._solution = { - "device_sid": device_sid, - } - self._uri = "/Devices/{device_sid}/Secrets".format(**self._solution) - - def create(self, key: str, value: str) -> DeviceSecretInstance: - """ - Create the DeviceSecretInstance - - :param key: The secret key; up to 100 characters. - :param value: The secret value; up to 4096 characters. - - :returns: The created DeviceSecretInstance - """ - - data = values.of( - { - "Key": key, - "Value": value, - } - ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Content-Type"] = "application/x-www-form-urlencoded" - - headers["Accept"] = "application/json" - - payload = self._version.create( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return DeviceSecretInstance( - self._version, payload, device_sid=self._solution["device_sid"] - ) - - async def create_async(self, key: str, value: str) -> DeviceSecretInstance: - """ - Asynchronously create the DeviceSecretInstance - - :param key: The secret key; up to 100 characters. - :param value: The secret value; up to 4096 characters. - - :returns: The created DeviceSecretInstance - """ - - data = values.of( - { - "Key": key, - "Value": value, - } - ) - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Content-Type"] = "application/x-www-form-urlencoded" - - headers["Accept"] = "application/json" - - payload = await self._version.create_async( - method="POST", uri=self._uri, data=data, headers=headers - ) - - return DeviceSecretInstance( - self._version, payload, device_sid=self._solution["device_sid"] - ) - - def stream( - self, - limit: Optional[int] = None, - page_size: Optional[int] = None, - ) -> Iterator[DeviceSecretInstance]: - """ - Streams DeviceSecretInstance 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[DeviceSecretInstance]: - """ - Asynchronously streams DeviceSecretInstance 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[DeviceSecretInstance]: - """ - Lists DeviceSecretInstance 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[DeviceSecretInstance]: - """ - Asynchronously lists DeviceSecretInstance 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, - ) -> DeviceSecretPage: - """ - Retrieve a single page of DeviceSecretInstance 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 DeviceSecretInstance - """ - data = values.of( - { - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Accept"] = "application/json" - - response = self._version.page( - method="GET", uri=self._uri, params=data, headers=headers - ) - return DeviceSecretPage(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, - ) -> DeviceSecretPage: - """ - Asynchronously retrieve a single page of DeviceSecretInstance 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 DeviceSecretInstance - """ - data = values.of( - { - "PageToken": page_token, - "Page": page_number, - "PageSize": page_size, - } - ) - - headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) - - headers["Accept"] = "application/json" - - response = await self._version.page_async( - method="GET", uri=self._uri, params=data, headers=headers - ) - return DeviceSecretPage(self._version, response, self._solution) - - def get_page(self, target_url: str) -> DeviceSecretPage: - """ - Retrieve a specific page of DeviceSecretInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of DeviceSecretInstance - """ - response = self._version.domain.twilio.request("GET", target_url) - return DeviceSecretPage(self._version, response, self._solution) - - async def get_page_async(self, target_url: str) -> DeviceSecretPage: - """ - Asynchronously retrieve a specific page of DeviceSecretInstance records from the API. - Request is executed immediately - - :param target_url: API-generated URL for the requested results page - - :returns: Page of DeviceSecretInstance - """ - response = await self._version.domain.twilio.request_async("GET", target_url) - return DeviceSecretPage(self._version, response, self._solution) - - def get(self, key: str) -> DeviceSecretContext: - """ - Constructs a DeviceSecretContext - - :param key: The secret key; up to 100 characters. - """ - return DeviceSecretContext( - self._version, device_sid=self._solution["device_sid"], key=key - ) - - def __call__(self, key: str) -> DeviceSecretContext: - """ - Constructs a DeviceSecretContext - - :param key: The secret key; up to 100 characters. - """ - return DeviceSecretContext( - self._version, device_sid=self._solution["device_sid"], key=key - ) - - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - return "" From f9b4ce19af475c8f3bdcc5a8a6785bb50cd50674 Mon Sep 17 00:00:00 2001 From: Twilio Date: Thu, 3 Jul 2025 09:38:34 +0000 Subject: [PATCH 3/7] [Librarian] Regenerated @ d122b05026327019e18cb5763c557a68138cc2c8 0e8634d10afc0145e18ccb8d90598b642b67ad87 --- CHANGES.md | 29 + .../v1/export/export_custom_job.py | 2 +- twilio/rest/bulkexports/v1/export/job.py | 4 +- .../conversations/v1/address_configuration.py | 4 +- .../conversations/v1/conversation/webhook.py | 4 +- .../v1/service/conversation/webhook.py | 4 +- twilio/rest/lookups/v2/__init__.py | 32 + twilio/rest/lookups/v2/bucket.py | 401 ++++++++ twilio/rest/lookups/v2/lookup_override.py | 508 ++++++++++ twilio/rest/lookups/v2/query.py | 874 ++++++++++++++++++ twilio/rest/lookups/v2/rate_limit.py | 112 +++ twilio/rest/messaging/v1/service/__init__.py | 14 +- twilio/rest/messaging/v2/channels_sender.py | 102 ++ twilio/rest/numbers/v1/__init__.py | 24 +- ...hook_configuration_fetch.py => webhook.py} | 26 +- twilio/rest/proxy/v1/service/__init__.py | 21 - .../serverless/v1/service/environment/log.py | 10 +- .../taskrouter/v1/workspace/task/__init__.py | 4 +- twilio/rest/trunking/v1/trunk/__init__.py | 4 + twilio/rest/verify/v2/verification_attempt.py | 13 +- .../v2/verification_attempts_summary.py | 9 +- twilio/rest/video/v1/room/__init__.py | 21 + .../v1/room/transcriptions.py} | 355 ++++--- twilio/twiml/voice_response.py | 44 + 24 files changed, 2343 insertions(+), 278 deletions(-) create mode 100644 twilio/rest/lookups/v2/bucket.py create mode 100644 twilio/rest/lookups/v2/lookup_override.py create mode 100644 twilio/rest/lookups/v2/query.py create mode 100644 twilio/rest/lookups/v2/rate_limit.py rename twilio/rest/numbers/v1/{porting_webhook_configuration_fetch.py => webhook.py} (78%) rename twilio/rest/{proxy/v1/service/short_code.py => video/v1/room/transcriptions.py} (53%) diff --git a/CHANGES.md b/CHANGES.md index 37c7984d2f..37ae0d14b5 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,35 @@ twilio-python Changelog Here you can see the full list of changes between each twilio-python release. +[2025-07-03] Version 9.6.4 +-------------------------- +**Library - Chore** +- [PR #865](https://github.com/twilio/twilio-python/pull/865): Remove references to microvisor. Thanks to [@akhani18](https://github.com/akhani18)! +- [PR #872](https://github.com/twilio/twilio-python/pull/872): support Python 3.13. Thanks to [@tiwarishubham635](https://github.com/tiwarishubham635)! +- [PR #870](https://github.com/twilio/twilio-python/pull/870): remove knowledge domain. Thanks to [@tiwarishubham635](https://github.com/tiwarishubham635)! + +**Bulkexports** +- Changed the type of 'details' field to be a list of objects instead of a single object + +**Conversations** +- Updates to `method` casing for ConfgurationAddress, ConversationScopedWebhook, and ServiceConversationScopedWebhook for RestProxy compatibility + +**Proxy** +- remove shortcodes resource as its no longer used + +**Serverless** +- Change log field level from type `ienum` to `string` in Logs api + +**Taskrouter** +- Remove `URL-encoded` from attributes param definition in tasks + +**Trunking** +- Added `symmetric_rtp_enabled` property on Trunks. + +**Twiml** +- Add support for `` noun under `` verb + + [2025-06-12] Version 9.6.3 -------------------------- **Library - Chore** diff --git a/twilio/rest/bulkexports/v1/export/export_custom_job.py b/twilio/rest/bulkexports/v1/export/export_custom_job.py index 72d0e9b328..39f45f14b3 100644 --- a/twilio/rest/bulkexports/v1/export/export_custom_job.py +++ b/twilio/rest/bulkexports/v1/export/export_custom_job.py @@ -47,7 +47,7 @@ def __init__(self, version: Version, payload: Dict[str, Any], resource_type: str self.webhook_method: Optional[str] = payload.get("webhook_method") self.email: Optional[str] = payload.get("email") self.job_sid: Optional[str] = payload.get("job_sid") - self.details: Optional[Dict[str, object]] = payload.get("details") + self.details: Optional[List[Dict[str, object]]] = payload.get("details") self.job_queue_position: Optional[str] = payload.get("job_queue_position") self.estimated_completion_time: Optional[str] = payload.get( "estimated_completion_time" diff --git a/twilio/rest/bulkexports/v1/export/job.py b/twilio/rest/bulkexports/v1/export/job.py index 5358ffa83a..847c14f4ef 100644 --- a/twilio/rest/bulkexports/v1/export/job.py +++ b/twilio/rest/bulkexports/v1/export/job.py @@ -12,7 +12,7 @@ Do not edit the class manually. """ -from typing import Any, Dict, Optional +from typing import Any, Dict, List, Optional from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -43,7 +43,7 @@ def __init__( self.resource_type: Optional[str] = payload.get("resource_type") self.friendly_name: Optional[str] = payload.get("friendly_name") - self.details: Optional[Dict[str, object]] = payload.get("details") + self.details: Optional[List[Dict[str, object]]] = payload.get("details") self.start_day: Optional[str] = payload.get("start_day") self.end_day: Optional[str] = payload.get("end_day") self.job_sid: Optional[str] = payload.get("job_sid") diff --git a/twilio/rest/conversations/v1/address_configuration.py b/twilio/rest/conversations/v1/address_configuration.py index c12e3c7170..ab61a04c99 100644 --- a/twilio/rest/conversations/v1/address_configuration.py +++ b/twilio/rest/conversations/v1/address_configuration.py @@ -30,8 +30,8 @@ class AutoCreationType(object): DEFAULT = "default" class Method(object): - GET = "GET" - POST = "POST" + GET = "get" + POST = "post" class Type(object): SMS = "sms" diff --git a/twilio/rest/conversations/v1/conversation/webhook.py b/twilio/rest/conversations/v1/conversation/webhook.py index 837f88c26f..3b432caae3 100644 --- a/twilio/rest/conversations/v1/conversation/webhook.py +++ b/twilio/rest/conversations/v1/conversation/webhook.py @@ -25,8 +25,8 @@ class WebhookInstance(InstanceResource): class Method(object): - GET = "GET" - POST = "POST" + GET = "get" + POST = "post" class Target(object): WEBHOOK = "webhook" diff --git a/twilio/rest/conversations/v1/service/conversation/webhook.py b/twilio/rest/conversations/v1/service/conversation/webhook.py index 08ec93ce4e..270dfaef3a 100644 --- a/twilio/rest/conversations/v1/service/conversation/webhook.py +++ b/twilio/rest/conversations/v1/service/conversation/webhook.py @@ -25,8 +25,8 @@ class WebhookInstance(InstanceResource): class Method(object): - GET = "GET" - POST = "POST" + GET = "get" + POST = "post" class Target(object): WEBHOOK = "webhook" diff --git a/twilio/rest/lookups/v2/__init__.py b/twilio/rest/lookups/v2/__init__.py index d795aea168..852f552540 100644 --- a/twilio/rest/lookups/v2/__init__.py +++ b/twilio/rest/lookups/v2/__init__.py @@ -15,7 +15,11 @@ from typing import Optional from twilio.base.version import Version from twilio.base.domain import Domain +from twilio.rest.lookups.v2.bucket import BucketList +from twilio.rest.lookups.v2.lookup_override import LookupOverrideList from twilio.rest.lookups.v2.phone_number import PhoneNumberList +from twilio.rest.lookups.v2.query import QueryList +from twilio.rest.lookups.v2.rate_limit import RateLimitList class V2(Version): @@ -27,7 +31,23 @@ def __init__(self, domain: Domain): :param domain: The Twilio.lookups domain """ super().__init__(domain, "v2") + self._bucket: Optional[BucketList] = None + self._lookup_overrides: Optional[LookupOverrideList] = None self._phone_numbers: Optional[PhoneNumberList] = None + self._query: Optional[QueryList] = None + self._rate_limits: Optional[RateLimitList] = None + + @property + def bucket(self) -> BucketList: + if self._bucket is None: + self._bucket = BucketList(self) + return self._bucket + + @property + def lookup_overrides(self) -> LookupOverrideList: + if self._lookup_overrides is None: + self._lookup_overrides = LookupOverrideList(self) + return self._lookup_overrides @property def phone_numbers(self) -> PhoneNumberList: @@ -35,6 +55,18 @@ def phone_numbers(self) -> PhoneNumberList: self._phone_numbers = PhoneNumberList(self) return self._phone_numbers + @property + def query(self) -> QueryList: + if self._query is None: + self._query = QueryList(self) + return self._query + + @property + def rate_limits(self) -> RateLimitList: + if self._rate_limits is None: + self._rate_limits = RateLimitList(self) + return self._rate_limits + def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/lookups/v2/bucket.py b/twilio/rest/lookups/v2/bucket.py new file mode 100644 index 0000000000..c8f9bdad6b --- /dev/null +++ b/twilio/rest/lookups/v2/bucket.py @@ -0,0 +1,401 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Lookups + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +from typing import Any, Dict, Optional, Union +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class BucketInstance(InstanceResource): + + class RateLimitRequest(object): + """ + :ivar limit: Limit of requests for the bucket + :ivar ttl: Time to live of the rule + """ + + def __init__(self, payload: Dict[str, Any]): + + self.limit: Optional[int] = payload.get("limit") + self.ttl: Optional[int] = payload.get("ttl") + + def to_dict(self): + return { + "limit": self.limit, + "ttl": self.ttl, + } + + """ + :ivar code: Twilio-specific error code + :ivar message: Error message + :ivar more_info: Link to Error Code References + :ivar status: HTTP response status code + :ivar field: Limit of requests for the bucket + :ivar limit: Limit of requests for the bucket + :ivar bucket: Name of the bucket + :ivar owner: Owner of the rule + :ivar ttl: Time to live of the rule + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + field: Optional[str] = None, + bucket: Optional[str] = None, + ): + super().__init__(version) + + self.code: Optional[int] = payload.get("code") + self.message: Optional[str] = payload.get("message") + self.more_info: Optional[str] = payload.get("more_info") + self.status: Optional[int] = payload.get("status") + self.field: Optional[str] = payload.get("field") + self.limit: Optional[int] = payload.get("limit") + self.bucket: Optional[str] = payload.get("bucket") + self.owner: Optional[str] = payload.get("owner") + self.ttl: Optional[int] = payload.get("ttl") + + self._solution = { + "field": field or self.field, + "bucket": bucket or self.bucket, + } + self._context: Optional[BucketContext] = None + + @property + def _proxy(self) -> "BucketContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: BucketContext for this BucketInstance + """ + if self._context is None: + self._context = BucketContext( + self._version, + field=self._solution["field"], + bucket=self._solution["bucket"], + ) + return self._context + + def delete(self) -> bool: + """ + Deletes the BucketInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the BucketInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def fetch(self) -> "BucketInstance": + """ + Fetch the BucketInstance + + + :returns: The fetched BucketInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "BucketInstance": + """ + Asynchronous coroutine to fetch the BucketInstance + + + :returns: The fetched BucketInstance + """ + return await self._proxy.fetch_async() + + def update( + self, rate_limit_request: Union[RateLimitRequest, object] = values.unset + ) -> "BucketInstance": + """ + Update the BucketInstance + + :param rate_limit_request: + + :returns: The updated BucketInstance + """ + return self._proxy.update( + rate_limit_request=rate_limit_request, + ) + + async def update_async( + self, rate_limit_request: Union[RateLimitRequest, object] = values.unset + ) -> "BucketInstance": + """ + Asynchronous coroutine to update the BucketInstance + + :param rate_limit_request: + + :returns: The updated BucketInstance + """ + return await self._proxy.update_async( + rate_limit_request=rate_limit_request, + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class BucketContext(InstanceContext): + + class RateLimitRequest(object): + """ + :ivar limit: Limit of requests for the bucket + :ivar ttl: Time to live of the rule + """ + + def __init__(self, payload: Dict[str, Any]): + + self.limit: Optional[int] = payload.get("limit") + self.ttl: Optional[int] = payload.get("ttl") + + def to_dict(self): + return { + "limit": self.limit, + "ttl": self.ttl, + } + + def __init__(self, version: Version, field: str, bucket: str): + """ + Initialize the BucketContext + + :param version: Version that contains the resource + :param field: field name + :param bucket: bucket name + """ + super().__init__(version) + + # Path Solution + self._solution = { + "field": field, + "bucket": bucket, + } + self._uri = "/RateLimits/Fields/{field}/Bucket/{bucket}".format( + **self._solution + ) + + def delete(self) -> bool: + """ + Deletes the BucketInstance + + + :returns: True if delete succeeds, False otherwise + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the BucketInstance + + + :returns: True if delete succeeds, False otherwise + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return await self._version.delete_async( + method="DELETE", uri=self._uri, headers=headers + ) + + def fetch(self) -> BucketInstance: + """ + Fetch the BucketInstance + + + :returns: The fetched BucketInstance + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) + + return BucketInstance( + self._version, + payload, + field=self._solution["field"], + bucket=self._solution["bucket"], + ) + + async def fetch_async(self) -> BucketInstance: + """ + Asynchronous coroutine to fetch the BucketInstance + + + :returns: The fetched BucketInstance + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = await self._version.fetch_async( + method="GET", uri=self._uri, headers=headers + ) + + return BucketInstance( + self._version, + payload, + field=self._solution["field"], + bucket=self._solution["bucket"], + ) + + def update( + self, rate_limit_request: Union[RateLimitRequest, object] = values.unset + ) -> BucketInstance: + """ + Update the BucketInstance + + :param rate_limit_request: + + :returns: The updated BucketInstance + """ + data = rate_limit_request.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + payload = self._version.update( + method="PUT", uri=self._uri, data=data, headers=headers + ) + + return BucketInstance( + self._version, + payload, + field=self._solution["field"], + bucket=self._solution["bucket"], + ) + + async def update_async( + self, rate_limit_request: Union[RateLimitRequest, object] = values.unset + ) -> BucketInstance: + """ + Asynchronous coroutine to update the BucketInstance + + :param rate_limit_request: + + :returns: The updated BucketInstance + """ + data = rate_limit_request.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + payload = await self._version.update_async( + method="PUT", uri=self._uri, data=data, headers=headers + ) + + return BucketInstance( + self._version, + payload, + field=self._solution["field"], + bucket=self._solution["bucket"], + ) + + 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 BucketList(ListResource): + + class RateLimitRequest(object): + """ + :ivar limit: Limit of requests for the bucket + :ivar ttl: Time to live of the rule + """ + + def __init__(self, payload: Dict[str, Any]): + + self.limit: Optional[int] = payload.get("limit") + self.ttl: Optional[int] = payload.get("ttl") + + def to_dict(self): + return { + "limit": self.limit, + "ttl": self.ttl, + } + + def __init__(self, version: Version): + """ + Initialize the BucketList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + def get(self, field: str, bucket: str) -> BucketContext: + """ + Constructs a BucketContext + + :param field: field name + :param bucket: bucket name + """ + return BucketContext(self._version, field=field, bucket=bucket) + + def __call__(self, field: str, bucket: str) -> BucketContext: + """ + Constructs a BucketContext + + :param field: field name + :param bucket: bucket name + """ + return BucketContext(self._version, field=field, bucket=bucket) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/lookups/v2/lookup_override.py b/twilio/rest/lookups/v2/lookup_override.py new file mode 100644 index 0000000000..04da72c46e --- /dev/null +++ b/twilio/rest/lookups/v2/lookup_override.py @@ -0,0 +1,508 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Lookups + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +from datetime import datetime +from typing import Any, Dict, Optional, Union +from twilio.base import deserialize, values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class LookupOverrideInstance(InstanceResource): + + class OverridesRequest(object): + """ + :ivar line_type: + :ivar reason: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.line_type: Optional["LookupOverrideInstance.str"] = payload.get( + "line_type" + ) + self.reason: Optional[str] = payload.get("reason") + + def to_dict(self): + return { + "line_type": self.line_type, + "reason": self.reason, + } + + """ + :ivar phone_number: + :ivar original_line_type: + :ivar overridden_line_type: + :ivar override_reason: The reason for the override + :ivar override_timestamp: + :ivar overridden_by_account_sid: The user who overrode the line type + :ivar code: Twilio-specific error code + :ivar message: Error message + :ivar more_info: Link to Error Code References + :ivar status: HTTP response status code + :ivar field: Limit of requests for the bucket + :ivar limit: Limit of requests for the bucket + :ivar bucket: Name of the bucket + :ivar owner: Owner of the rule + :ivar ttl: Time to live of the rule + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + field: Optional[str] = None, + phone_number: Optional[str] = None, + ): + super().__init__(version) + + self.phone_number: Optional[str] = payload.get("phone_number") + self.original_line_type: Optional[str] = payload.get("original_line_type") + self.overridden_line_type: Optional[str] = payload.get("overridden_line_type") + self.override_reason: Optional[str] = payload.get("override_reason") + self.override_timestamp: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("override_timestamp") + ) + self.overridden_by_account_sid: Optional[str] = payload.get( + "overridden_by_account_sid" + ) + self.code: Optional[int] = payload.get("code") + self.message: Optional[str] = payload.get("message") + self.more_info: Optional[str] = payload.get("more_info") + self.status: Optional[int] = payload.get("status") + self.field: Optional[str] = payload.get("field") + self.limit: Optional[int] = payload.get("limit") + self.bucket: Optional[str] = payload.get("bucket") + self.owner: Optional[str] = payload.get("owner") + self.ttl: Optional[int] = payload.get("ttl") + + self._solution = { + "field": field or self.field, + "phone_number": phone_number or self.phone_number, + } + self._context: Optional[LookupOverrideContext] = None + + @property + def _proxy(self) -> "LookupOverrideContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: LookupOverrideContext for this LookupOverrideInstance + """ + if self._context is None: + self._context = LookupOverrideContext( + self._version, + field=self._solution["field"], + phone_number=self._solution["phone_number"], + ) + return self._context + + def create( + self, overrides_request: Union[OverridesRequest, object] = values.unset + ) -> "LookupOverrideInstance": + """ + Create the LookupOverrideInstance + + :param overrides_request: + + :returns: The created LookupOverrideInstance + """ + return self._proxy.create( + overrides_request=overrides_request, + ) + + async def create_async( + self, overrides_request: Union[OverridesRequest, object] = values.unset + ) -> "LookupOverrideInstance": + """ + Asynchronous coroutine to create the LookupOverrideInstance + + :param overrides_request: + + :returns: The created LookupOverrideInstance + """ + return await self._proxy.create_async( + overrides_request=overrides_request, + ) + + def delete(self) -> bool: + """ + Deletes the LookupOverrideInstance + + + :returns: True if delete succeeds, False otherwise + """ + return self._proxy.delete() + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the LookupOverrideInstance + + + :returns: True if delete succeeds, False otherwise + """ + return await self._proxy.delete_async() + + def fetch(self) -> "LookupOverrideInstance": + """ + Fetch the LookupOverrideInstance + + + :returns: The fetched LookupOverrideInstance + """ + return self._proxy.fetch() + + async def fetch_async(self) -> "LookupOverrideInstance": + """ + Asynchronous coroutine to fetch the LookupOverrideInstance + + + :returns: The fetched LookupOverrideInstance + """ + return await self._proxy.fetch_async() + + def update( + self, overrides_request: Union[OverridesRequest, object] = values.unset + ) -> "LookupOverrideInstance": + """ + Update the LookupOverrideInstance + + :param overrides_request: + + :returns: The updated LookupOverrideInstance + """ + return self._proxy.update( + overrides_request=overrides_request, + ) + + async def update_async( + self, overrides_request: Union[OverridesRequest, object] = values.unset + ) -> "LookupOverrideInstance": + """ + Asynchronous coroutine to update the LookupOverrideInstance + + :param overrides_request: + + :returns: The updated LookupOverrideInstance + """ + return await self._proxy.update_async( + overrides_request=overrides_request, + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class LookupOverrideContext(InstanceContext): + + class OverridesRequest(object): + """ + :ivar line_type: + :ivar reason: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.line_type: Optional["LookupOverrideInstance.str"] = payload.get( + "line_type" + ) + self.reason: Optional[str] = payload.get("reason") + + def to_dict(self): + return { + "line_type": self.line_type, + "reason": self.reason, + } + + def __init__(self, version: Version, field: str, phone_number: str): + """ + Initialize the LookupOverrideContext + + :param version: Version that contains the resource + :param field: + :param phone_number: + """ + super().__init__(version) + + # Path Solution + self._solution = { + "field": field, + "phone_number": phone_number, + } + self._uri = "/PhoneNumbers/{phone_number}/Overrides/{field}".format( + **self._solution + ) + + def create( + self, overrides_request: Union[OverridesRequest, object] = values.unset + ) -> LookupOverrideInstance: + """ + Create the LookupOverrideInstance + + :param overrides_request: + + :returns: The created LookupOverrideInstance + """ + data = values.of( + { + "OverridesRequest": overrides_request, + } + ) + + payload = self._version.create(method="POST", uri=self._uri, data=data) + + return LookupOverrideInstance( + self._version, + payload, + field=self._solution["field"], + phone_number=self._solution["phone_number"], + ) + + async def create_async( + self, overrides_request: Union[OverridesRequest, object] = values.unset + ) -> LookupOverrideInstance: + """ + Asynchronous coroutine to create the LookupOverrideInstance + + :param overrides_request: + + :returns: The created LookupOverrideInstance + """ + data = values.of( + { + "OverridesRequest": overrides_request, + } + ) + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data + ) + + return LookupOverrideInstance( + self._version, + payload, + field=self._solution["field"], + phone_number=self._solution["phone_number"], + ) + + def delete(self) -> bool: + """ + Deletes the LookupOverrideInstance + + + :returns: True if delete succeeds, False otherwise + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return self._version.delete(method="DELETE", uri=self._uri, headers=headers) + + async def delete_async(self) -> bool: + """ + Asynchronous coroutine that deletes the LookupOverrideInstance + + + :returns: True if delete succeeds, False otherwise + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + return await self._version.delete_async( + method="DELETE", uri=self._uri, headers=headers + ) + + def fetch(self) -> LookupOverrideInstance: + """ + Fetch the LookupOverrideInstance + + + :returns: The fetched LookupOverrideInstance + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) + + return LookupOverrideInstance( + self._version, + payload, + field=self._solution["field"], + phone_number=self._solution["phone_number"], + ) + + async def fetch_async(self) -> LookupOverrideInstance: + """ + Asynchronous coroutine to fetch the LookupOverrideInstance + + + :returns: The fetched LookupOverrideInstance + """ + + headers = values.of({}) + + headers["Accept"] = "application/json" + + payload = await self._version.fetch_async( + method="GET", uri=self._uri, headers=headers + ) + + return LookupOverrideInstance( + self._version, + payload, + field=self._solution["field"], + phone_number=self._solution["phone_number"], + ) + + def update( + self, overrides_request: Union[OverridesRequest, object] = values.unset + ) -> LookupOverrideInstance: + """ + Update the LookupOverrideInstance + + :param overrides_request: + + :returns: The updated LookupOverrideInstance + """ + data = overrides_request.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + payload = self._version.update( + method="PUT", uri=self._uri, data=data, headers=headers + ) + + return LookupOverrideInstance( + self._version, + payload, + field=self._solution["field"], + phone_number=self._solution["phone_number"], + ) + + async def update_async( + self, overrides_request: Union[OverridesRequest, object] = values.unset + ) -> LookupOverrideInstance: + """ + Asynchronous coroutine to update the LookupOverrideInstance + + :param overrides_request: + + :returns: The updated LookupOverrideInstance + """ + data = overrides_request.to_dict() + + headers = values.of({}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + payload = await self._version.update_async( + method="PUT", uri=self._uri, data=data, headers=headers + ) + + return LookupOverrideInstance( + self._version, + payload, + field=self._solution["field"], + phone_number=self._solution["phone_number"], + ) + + 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 LookupOverrideList(ListResource): + + class OverridesRequest(object): + """ + :ivar line_type: + :ivar reason: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.line_type: Optional["LookupOverrideInstance.str"] = payload.get( + "line_type" + ) + self.reason: Optional[str] = payload.get("reason") + + def to_dict(self): + return { + "line_type": self.line_type, + "reason": self.reason, + } + + def __init__(self, version: Version): + """ + Initialize the LookupOverrideList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + def get(self, field: str, phone_number: str) -> LookupOverrideContext: + """ + Constructs a LookupOverrideContext + + :param field: + :param phone_number: + """ + return LookupOverrideContext( + self._version, field=field, phone_number=phone_number + ) + + def __call__(self, field: str, phone_number: str) -> LookupOverrideContext: + """ + Constructs a LookupOverrideContext + + :param field: + :param phone_number: + """ + return LookupOverrideContext( + self._version, field=field, phone_number=phone_number + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/lookups/v2/query.py b/twilio/rest/lookups/v2/query.py new file mode 100644 index 0000000000..4a8047859a --- /dev/null +++ b/twilio/rest/lookups/v2/query.py @@ -0,0 +1,874 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Lookups + 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 values + +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class QueryInstance(InstanceResource): + + class CallForwarding(object): + """ + :ivar call_forwarding_enabled: + :ivar error_code: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.call_forwarding_enabled: Optional[bool] = payload.get( + "call_forwarding_enabled" + ) + self.error_code: Optional[int] = payload.get("error_code") + + def to_dict(self): + return { + "": self.call_forwarding_enabled, + "": self.error_code, + } + + class CallerName(object): + """ + :ivar caller_name: + :ivar caller_type: + :ivar error_code: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.caller_name: Optional[str] = payload.get("caller_name") + self.caller_type: Optional[str] = payload.get("caller_type") + self.error_code: Optional[int] = payload.get("error_code") + + def to_dict(self): + return { + "": self.caller_name, + "": self.caller_type, + "": self.error_code, + } + + class IdentityMatch(object): + """ + :ivar first_name_match: + :ivar last_name_match: + :ivar address_line_match: + :ivar city_match: + :ivar state_match: + :ivar postal_code_match: + :ivar country_code_match: + :ivar national_id_match: + :ivar date_of_birth_match: + :ivar summary_score: + :ivar error_code: + :ivar error_message: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.first_name_match: Optional[str] = payload.get("first_name_match") + self.last_name_match: Optional[str] = payload.get("last_name_match") + self.address_line_match: Optional[str] = payload.get("address_line_match") + self.city_match: Optional[str] = payload.get("city_match") + self.state_match: Optional[str] = payload.get("state_match") + self.postal_code_match: Optional[str] = payload.get("postal_code_match") + self.country_code_match: Optional[str] = payload.get("country_code_match") + self.national_id_match: Optional[str] = payload.get("national_id_match") + self.date_of_birth_match: Optional[str] = payload.get("date_of_birth_match") + self.summary_score: Optional[int] = payload.get("summary_score") + self.error_code: Optional[int] = payload.get("error_code") + self.error_message: Optional[str] = payload.get("error_message") + + def to_dict(self): + return { + "": self.first_name_match, + "": self.last_name_match, + "": self.address_line_match, + "": self.city_match, + "": self.state_match, + "": self.postal_code_match, + "": self.country_code_match, + "": self.national_id_match, + "": self.date_of_birth_match, + "": self.summary_score, + "": self.error_code, + "": self.error_message, + } + + class IdentityMatchParameters(object): + """ + :ivar first_name: + :ivar last_name: + :ivar address_line1: + :ivar address_line2: + :ivar city: + :ivar state: + :ivar postal_code: + :ivar address_country_code: + :ivar national_id: + :ivar date_of_birth: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.first_name: Optional[str] = payload.get("first_name") + self.last_name: Optional[str] = payload.get("last_name") + self.address_line1: Optional[str] = payload.get("address_line1") + self.address_line2: Optional[str] = payload.get("address_line2") + self.city: Optional[str] = payload.get("city") + self.state: Optional[str] = payload.get("state") + self.postal_code: Optional[str] = payload.get("postal_code") + self.address_country_code: Optional[str] = payload.get( + "address_country_code" + ) + self.national_id: Optional[str] = payload.get("national_id") + self.date_of_birth: Optional[str] = payload.get("date_of_birth") + + def to_dict(self): + return { + "first_name": self.first_name, + "last_name": self.last_name, + "address_line1": self.address_line1, + "address_line2": self.address_line2, + "city": self.city, + "state": self.state, + "postal_code": self.postal_code, + "address_country_code": self.address_country_code, + "national_id": self.national_id, + "date_of_birth": self.date_of_birth, + } + + class LastSimSwap(object): + """ + :ivar last_sim_swap_date: + :ivar swapped_period: + :ivar swapped_in_period: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.last_sim_swap_date: Optional[datetime] = payload.get( + "last_sim_swap_date" + ) + self.swapped_period: Optional[str] = payload.get("swapped_period") + self.swapped_in_period: Optional[bool] = payload.get("swapped_in_period") + + def to_dict(self): + return { + "": self.last_sim_swap_date, + "": self.swapped_period, + "": self.swapped_in_period, + } + + class LineStatus(object): + """ + :ivar status: + :ivar error_code: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.status: Optional[str] = payload.get("status") + self.error_code: Optional[int] = payload.get("error_code") + + def to_dict(self): + return { + "": self.status, + "": self.error_code, + } + + class LineTypeIntelligence(object): + """ + :ivar type: + :ivar carrier_name: + :ivar mobile_country_code: + :ivar mobile_network_code: + :ivar error_code: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.type: Optional[str] = payload.get("type") + self.carrier_name: Optional[str] = payload.get("carrier_name") + self.mobile_country_code: Optional[str] = payload.get("mobile_country_code") + self.mobile_network_code: Optional[str] = payload.get("mobile_network_code") + self.error_code: Optional[int] = payload.get("error_code") + + def to_dict(self): + return { + "": self.type, + "": self.carrier_name, + "": self.mobile_country_code, + "": self.mobile_network_code, + "": self.error_code, + } + + class LookupRequest1(object): + """ + :ivar phone_numbers: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.phone_numbers: Optional[List[QueryList.LookupRequestWithCorId]] = ( + payload.get("phone_numbers") + ) + + def to_dict(self): + return { + "phone_numbers": ( + [phone_numbers.to_dict() for phone_numbers in self.phone_numbers] + if self.phone_numbers is not None + else None + ), + } + + class LookupRequestWithCorId(object): + """ + :ivar correlation_id: Unique identifier used to match request with response + :ivar phone_number: + :ivar fields: + :ivar country_code: + :ivar identity_match: + :ivar reassigned_number: + :ivar sms_pumping_risk: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.correlation_id: Optional[str] = payload.get("correlation_id") + self.phone_number: Optional[str] = payload.get("phone_number") + self.fields: Optional[List[Enumstr]] = payload.get("fields") + self.country_code: Optional[str] = payload.get("country_code") + self.identity_match: Optional[QueryList.IdentityMatchParameters] = ( + payload.get("identity_match") + ) + self.reassigned_number: Optional[QueryList.ReassignedNumberRequest] = ( + payload.get("reassigned_number") + ) + self.sms_pumping_risk: Optional[QueryList.SmsPumpingRiskParameters] = ( + payload.get("sms_pumping_risk") + ) + + def to_dict(self): + return { + "correlation_id": self.correlation_id, + "phone_number": self.phone_number, + "fields": self.fields, + "country_code": self.country_code, + "identity_match": ( + self.identity_match.to_dict() + if self.identity_match is not None + else None + ), + "reassigned_number": ( + self.reassigned_number.to_dict() + if self.reassigned_number is not None + else None + ), + "sms_pumping_risk": ( + self.sms_pumping_risk.to_dict() + if self.sms_pumping_risk is not None + else None + ), + } + + class ReassignedNumberRequest(object): + """ + :ivar last_verified_date: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.last_verified_date: Optional[str] = payload.get("last_verified_date") + + def to_dict(self): + return { + "last_verified_date": self.last_verified_date, + } + + class ReassignedNumberResponse(object): + """ + :ivar last_verified_date: + :ivar is_number_reassigned: + :ivar error_code: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.last_verified_date: Optional[str] = payload.get("last_verified_date") + self.is_number_reassigned: Optional[str] = payload.get( + "is_number_reassigned" + ) + self.error_code: Optional[str] = payload.get("error_code") + + def to_dict(self): + return { + "": self.last_verified_date, + "": self.is_number_reassigned, + "": self.error_code, + } + + class SimSwap(object): + """ + :ivar last_sim_swap: + :ivar carrier_name: + :ivar mobile_country_code: + :ivar mobile_network_code: + :ivar error_code: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.last_sim_swap: Optional[LastSimSwap] = payload.get("last_sim_swap") + self.carrier_name: Optional[str] = payload.get("carrier_name") + self.mobile_country_code: Optional[str] = payload.get("mobile_country_code") + self.mobile_network_code: Optional[str] = payload.get("mobile_network_code") + self.error_code: Optional[int] = payload.get("error_code") + + def to_dict(self): + return { + "": ( + self.last_sim_swap.to_dict() + if self.last_sim_swap is not None + else None + ), + "": self.carrier_name, + "": self.mobile_country_code, + "": self.mobile_network_code, + "": self.error_code, + } + + class SmsPumpingRisk(object): + """ + :ivar carrier_risk_category: + :ivar number_blocked: + :ivar number_blocked_date: + :ivar number_blocked_last_3_months: + :ivar sms_pumping_risk_score: + :ivar error_code: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.carrier_risk_category: Optional[str] = payload.get( + "carrier_risk_category" + ) + self.number_blocked: Optional[bool] = payload.get("number_blocked") + self.number_blocked_date: Optional[datetime] = payload.get( + "number_blocked_date" + ) + self.number_blocked_last_3_months: Optional[bool] = payload.get( + "number_blocked_last_3_months" + ) + self.sms_pumping_risk_score: Optional[int] = payload.get( + "sms_pumping_risk_score" + ) + self.error_code: Optional[int] = payload.get("error_code") + + def to_dict(self): + return { + "": self.carrier_risk_category, + "": self.number_blocked, + "": self.number_blocked_date, + "": self.number_blocked_last_3_months, + "": self.sms_pumping_risk_score, + "": self.error_code, + } + + class SmsPumpingRiskParameters(object): + """ + :ivar partner_sub_id: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.partner_sub_id: Optional[str] = payload.get("partner_sub_id") + + def to_dict(self): + return { + "partner_sub_id": self.partner_sub_id, + } + + """ + :ivar phone_numbers: + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) + + self.phone_numbers: Optional[List[str]] = payload.get("phone_numbers") + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "" + + +class QueryList(ListResource): + + class CallForwarding(object): + """ + :ivar call_forwarding_enabled: + :ivar error_code: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.call_forwarding_enabled: Optional[bool] = payload.get( + "call_forwarding_enabled" + ) + self.error_code: Optional[int] = payload.get("error_code") + + def to_dict(self): + return { + "": self.call_forwarding_enabled, + "": self.error_code, + } + + class CallerName(object): + """ + :ivar caller_name: + :ivar caller_type: + :ivar error_code: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.caller_name: Optional[str] = payload.get("caller_name") + self.caller_type: Optional[str] = payload.get("caller_type") + self.error_code: Optional[int] = payload.get("error_code") + + def to_dict(self): + return { + "": self.caller_name, + "": self.caller_type, + "": self.error_code, + } + + class IdentityMatch(object): + """ + :ivar first_name_match: + :ivar last_name_match: + :ivar address_line_match: + :ivar city_match: + :ivar state_match: + :ivar postal_code_match: + :ivar country_code_match: + :ivar national_id_match: + :ivar date_of_birth_match: + :ivar summary_score: + :ivar error_code: + :ivar error_message: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.first_name_match: Optional[str] = payload.get("first_name_match") + self.last_name_match: Optional[str] = payload.get("last_name_match") + self.address_line_match: Optional[str] = payload.get("address_line_match") + self.city_match: Optional[str] = payload.get("city_match") + self.state_match: Optional[str] = payload.get("state_match") + self.postal_code_match: Optional[str] = payload.get("postal_code_match") + self.country_code_match: Optional[str] = payload.get("country_code_match") + self.national_id_match: Optional[str] = payload.get("national_id_match") + self.date_of_birth_match: Optional[str] = payload.get("date_of_birth_match") + self.summary_score: Optional[int] = payload.get("summary_score") + self.error_code: Optional[int] = payload.get("error_code") + self.error_message: Optional[str] = payload.get("error_message") + + def to_dict(self): + return { + "": self.first_name_match, + "": self.last_name_match, + "": self.address_line_match, + "": self.city_match, + "": self.state_match, + "": self.postal_code_match, + "": self.country_code_match, + "": self.national_id_match, + "": self.date_of_birth_match, + "": self.summary_score, + "": self.error_code, + "": self.error_message, + } + + class IdentityMatchParameters(object): + """ + :ivar first_name: + :ivar last_name: + :ivar address_line1: + :ivar address_line2: + :ivar city: + :ivar state: + :ivar postal_code: + :ivar address_country_code: + :ivar national_id: + :ivar date_of_birth: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.first_name: Optional[str] = payload.get("first_name") + self.last_name: Optional[str] = payload.get("last_name") + self.address_line1: Optional[str] = payload.get("address_line1") + self.address_line2: Optional[str] = payload.get("address_line2") + self.city: Optional[str] = payload.get("city") + self.state: Optional[str] = payload.get("state") + self.postal_code: Optional[str] = payload.get("postal_code") + self.address_country_code: Optional[str] = payload.get( + "address_country_code" + ) + self.national_id: Optional[str] = payload.get("national_id") + self.date_of_birth: Optional[str] = payload.get("date_of_birth") + + def to_dict(self): + return { + "first_name": self.first_name, + "last_name": self.last_name, + "address_line1": self.address_line1, + "address_line2": self.address_line2, + "city": self.city, + "state": self.state, + "postal_code": self.postal_code, + "address_country_code": self.address_country_code, + "national_id": self.national_id, + "date_of_birth": self.date_of_birth, + } + + class LastSimSwap(object): + """ + :ivar last_sim_swap_date: + :ivar swapped_period: + :ivar swapped_in_period: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.last_sim_swap_date: Optional[datetime] = payload.get( + "last_sim_swap_date" + ) + self.swapped_period: Optional[str] = payload.get("swapped_period") + self.swapped_in_period: Optional[bool] = payload.get("swapped_in_period") + + def to_dict(self): + return { + "": self.last_sim_swap_date, + "": self.swapped_period, + "": self.swapped_in_period, + } + + class LineStatus(object): + """ + :ivar status: + :ivar error_code: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.status: Optional[str] = payload.get("status") + self.error_code: Optional[int] = payload.get("error_code") + + def to_dict(self): + return { + "": self.status, + "": self.error_code, + } + + class LineTypeIntelligence(object): + """ + :ivar type: + :ivar carrier_name: + :ivar mobile_country_code: + :ivar mobile_network_code: + :ivar error_code: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.type: Optional[str] = payload.get("type") + self.carrier_name: Optional[str] = payload.get("carrier_name") + self.mobile_country_code: Optional[str] = payload.get("mobile_country_code") + self.mobile_network_code: Optional[str] = payload.get("mobile_network_code") + self.error_code: Optional[int] = payload.get("error_code") + + def to_dict(self): + return { + "": self.type, + "": self.carrier_name, + "": self.mobile_country_code, + "": self.mobile_network_code, + "": self.error_code, + } + + class LookupRequest1(object): + """ + :ivar phone_numbers: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.phone_numbers: Optional[List[QueryList.LookupRequestWithCorId]] = ( + payload.get("phone_numbers") + ) + + def to_dict(self): + return { + "phone_numbers": ( + [phone_numbers.to_dict() for phone_numbers in self.phone_numbers] + if self.phone_numbers is not None + else None + ), + } + + class LookupRequestWithCorId(object): + """ + :ivar correlation_id: Unique identifier used to match request with response + :ivar phone_number: + :ivar fields: + :ivar country_code: + :ivar identity_match: + :ivar reassigned_number: + :ivar sms_pumping_risk: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.correlation_id: Optional[str] = payload.get("correlation_id") + self.phone_number: Optional[str] = payload.get("phone_number") + self.fields: Optional[List[Enumstr]] = payload.get("fields") + self.country_code: Optional[str] = payload.get("country_code") + self.identity_match: Optional[QueryList.IdentityMatchParameters] = ( + payload.get("identity_match") + ) + self.reassigned_number: Optional[QueryList.ReassignedNumberRequest] = ( + payload.get("reassigned_number") + ) + self.sms_pumping_risk: Optional[QueryList.SmsPumpingRiskParameters] = ( + payload.get("sms_pumping_risk") + ) + + def to_dict(self): + return { + "correlation_id": self.correlation_id, + "phone_number": self.phone_number, + "fields": self.fields, + "country_code": self.country_code, + "identity_match": ( + self.identity_match.to_dict() + if self.identity_match is not None + else None + ), + "reassigned_number": ( + self.reassigned_number.to_dict() + if self.reassigned_number is not None + else None + ), + "sms_pumping_risk": ( + self.sms_pumping_risk.to_dict() + if self.sms_pumping_risk is not None + else None + ), + } + + class ReassignedNumberRequest(object): + """ + :ivar last_verified_date: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.last_verified_date: Optional[str] = payload.get("last_verified_date") + + def to_dict(self): + return { + "last_verified_date": self.last_verified_date, + } + + class ReassignedNumberResponse(object): + """ + :ivar last_verified_date: + :ivar is_number_reassigned: + :ivar error_code: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.last_verified_date: Optional[str] = payload.get("last_verified_date") + self.is_number_reassigned: Optional[str] = payload.get( + "is_number_reassigned" + ) + self.error_code: Optional[str] = payload.get("error_code") + + def to_dict(self): + return { + "": self.last_verified_date, + "": self.is_number_reassigned, + "": self.error_code, + } + + class SimSwap(object): + """ + :ivar last_sim_swap: + :ivar carrier_name: + :ivar mobile_country_code: + :ivar mobile_network_code: + :ivar error_code: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.last_sim_swap: Optional[LastSimSwap] = payload.get("last_sim_swap") + self.carrier_name: Optional[str] = payload.get("carrier_name") + self.mobile_country_code: Optional[str] = payload.get("mobile_country_code") + self.mobile_network_code: Optional[str] = payload.get("mobile_network_code") + self.error_code: Optional[int] = payload.get("error_code") + + def to_dict(self): + return { + "": ( + self.last_sim_swap.to_dict() + if self.last_sim_swap is not None + else None + ), + "": self.carrier_name, + "": self.mobile_country_code, + "": self.mobile_network_code, + "": self.error_code, + } + + class SmsPumpingRisk(object): + """ + :ivar carrier_risk_category: + :ivar number_blocked: + :ivar number_blocked_date: + :ivar number_blocked_last_3_months: + :ivar sms_pumping_risk_score: + :ivar error_code: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.carrier_risk_category: Optional[str] = payload.get( + "carrier_risk_category" + ) + self.number_blocked: Optional[bool] = payload.get("number_blocked") + self.number_blocked_date: Optional[datetime] = payload.get( + "number_blocked_date" + ) + self.number_blocked_last_3_months: Optional[bool] = payload.get( + "number_blocked_last_3_months" + ) + self.sms_pumping_risk_score: Optional[int] = payload.get( + "sms_pumping_risk_score" + ) + self.error_code: Optional[int] = payload.get("error_code") + + def to_dict(self): + return { + "": self.carrier_risk_category, + "": self.number_blocked, + "": self.number_blocked_date, + "": self.number_blocked_last_3_months, + "": self.sms_pumping_risk_score, + "": self.error_code, + } + + class SmsPumpingRiskParameters(object): + """ + :ivar partner_sub_id: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.partner_sub_id: Optional[str] = payload.get("partner_sub_id") + + def to_dict(self): + return { + "partner_sub_id": self.partner_sub_id, + } + + def __init__(self, version: Version): + """ + Initialize the QueryList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/batch/query" + + def create( + self, lookup_request1: Union[LookupRequest1, object] = values.unset + ) -> QueryInstance: + """ + Create the QueryInstance + + :param lookup_request1: + + :returns: The created QueryInstance + """ + data = lookup_request1.to_dict() + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return QueryInstance(self._version, payload) + + async def create_async( + self, lookup_request1: Union[LookupRequest1, object] = values.unset + ) -> QueryInstance: + """ + Asynchronously create the QueryInstance + + :param lookup_request1: + + :returns: The created QueryInstance + """ + data = lookup_request1.to_dict() + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Content-Type"] = "application/json" + + headers["Accept"] = "application/json" + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return QueryInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/lookups/v2/rate_limit.py b/twilio/rest/lookups/v2/rate_limit.py new file mode 100644 index 0000000000..6870ce7495 --- /dev/null +++ b/twilio/rest/lookups/v2/rate_limit.py @@ -0,0 +1,112 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Lookups + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +from typing import Any, Dict, List, Optional, Union +from twilio.base import values + +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class RateLimitInstance(InstanceResource): + """ + :ivar rate_limits: + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) + + self.rate_limits: Optional[List[str]] = payload.get("rate_limits") + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "" + + +class RateLimitList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the RateLimitList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/RateLimits" + + def fetch( + self, fields: Union[List[str], object] = values.unset + ) -> RateLimitInstance: + """ + Asynchronously fetch the RateLimitInstance + + :param fields: + :returns: The fetched RateLimitInstance + """ + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + params = values.of( + { + "Fields": fields, + } + ) + + payload = self._version.fetch( + method="GET", uri=self._uri, headers=headers, params=params + ) + + return RateLimitInstance(self._version, payload) + + async def fetch_async( + self, fields: Union[List[str], object] = values.unset + ) -> RateLimitInstance: + """ + Asynchronously fetch the RateLimitInstance + + :param fields: + :returns: The fetched RateLimitInstance + """ + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + + headers["Accept"] = "application/json" + + params = values.of( + { + "Fields": fields, + } + ) + + payload = await self._version.fetch_async( + method="GET", uri=self._uri, headers=headers, params=params + ) + + return RateLimitInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/messaging/v1/service/__init__.py b/twilio/rest/messaging/v1/service/__init__.py index 06a53c9a20..78a2b83015 100644 --- a/twilio/rest/messaging/v1/service/__init__.py +++ b/twilio/rest/messaging/v1/service/__init__.py @@ -58,7 +58,7 @@ class ScanMessageContent(object): :ivar fallback_to_long_code: [OBSOLETE] Former feature used to fallback to long code sender after certain short code message failures. :ivar area_code_geomatch: Whether to enable [Area Code Geomatch](https://www.twilio.com/docs/messaging/services#area-code-geomatch) on the Service Instance. :ivar synchronous_validation: Reserved. - :ivar validity_period: How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `14,400`. Default value is `14,400`. + :ivar validity_period: How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `36,000`. Default value is `36,000`. :ivar url: The absolute URL of the Service resource. :ivar links: The absolute URLs of related resources. :ivar usecase: A string that describes the scenario in which the Messaging Service will be used. Possible values are `notifications`, `marketing`, `verification`, `discussion`, `poll`, `undeclared`. @@ -203,7 +203,7 @@ def update( :param scan_message_content: :param fallback_to_long_code: [OBSOLETE] Former feature used to fallback to long code sender after certain short code message failures. :param area_code_geomatch: Whether to enable [Area Code Geomatch](https://www.twilio.com/docs/messaging/services#area-code-geomatch) on the Service Instance. - :param validity_period: How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `14,400`. Default value is `14,400`. + :param validity_period: How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `36,000`. Default value is `36,000`. :param synchronous_validation: Reserved. :param usecase: A string that describes the scenario in which the Messaging Service will be used. Possible values are `notifications`, `marketing`, `verification`, `discussion`, `poll`, `undeclared`. :param use_inbound_webhook_on_number: A boolean value that indicates either the webhook url configured on the phone number will be used or `inbound_request_url`/`fallback_url` url will be called when a message is received from the phone number. If this field is enabled then the webhook url defined on the phone number will override the `inbound_request_url`/`fallback_url` defined for the Messaging Service. @@ -265,7 +265,7 @@ async def update_async( :param scan_message_content: :param fallback_to_long_code: [OBSOLETE] Former feature used to fallback to long code sender after certain short code message failures. :param area_code_geomatch: Whether to enable [Area Code Geomatch](https://www.twilio.com/docs/messaging/services#area-code-geomatch) on the Service Instance. - :param validity_period: How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `14,400`. Default value is `14,400`. + :param validity_period: How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `36,000`. Default value is `36,000`. :param synchronous_validation: Reserved. :param usecase: A string that describes the scenario in which the Messaging Service will be used. Possible values are `notifications`, `marketing`, `verification`, `discussion`, `poll`, `undeclared`. :param use_inbound_webhook_on_number: A boolean value that indicates either the webhook url configured on the phone number will be used or `inbound_request_url`/`fallback_url` url will be called when a message is received from the phone number. If this field is enabled then the webhook url defined on the phone number will override the `inbound_request_url`/`fallback_url` defined for the Messaging Service. @@ -479,7 +479,7 @@ def update( :param scan_message_content: :param fallback_to_long_code: [OBSOLETE] Former feature used to fallback to long code sender after certain short code message failures. :param area_code_geomatch: Whether to enable [Area Code Geomatch](https://www.twilio.com/docs/messaging/services#area-code-geomatch) on the Service Instance. - :param validity_period: How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `14,400`. Default value is `14,400`. + :param validity_period: How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `36,000`. Default value is `36,000`. :param synchronous_validation: Reserved. :param usecase: A string that describes the scenario in which the Messaging Service will be used. Possible values are `notifications`, `marketing`, `verification`, `discussion`, `poll`, `undeclared`. :param use_inbound_webhook_on_number: A boolean value that indicates either the webhook url configured on the phone number will be used or `inbound_request_url`/`fallback_url` url will be called when a message is received from the phone number. If this field is enabled then the webhook url defined on the phone number will override the `inbound_request_url`/`fallback_url` defined for the Messaging Service. @@ -561,7 +561,7 @@ async def update_async( :param scan_message_content: :param fallback_to_long_code: [OBSOLETE] Former feature used to fallback to long code sender after certain short code message failures. :param area_code_geomatch: Whether to enable [Area Code Geomatch](https://www.twilio.com/docs/messaging/services#area-code-geomatch) on the Service Instance. - :param validity_period: How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `14,400`. Default value is `14,400`. + :param validity_period: How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `36,000`. Default value is `36,000`. :param synchronous_validation: Reserved. :param usecase: A string that describes the scenario in which the Messaging Service will be used. Possible values are `notifications`, `marketing`, `verification`, `discussion`, `poll`, `undeclared`. :param use_inbound_webhook_on_number: A boolean value that indicates either the webhook url configured on the phone number will be used or `inbound_request_url`/`fallback_url` url will be called when a message is received from the phone number. If this field is enabled then the webhook url defined on the phone number will override the `inbound_request_url`/`fallback_url` defined for the Messaging Service. @@ -769,7 +769,7 @@ def create( :param scan_message_content: :param fallback_to_long_code: [OBSOLETE] Former feature used to fallback to long code sender after certain short code message failures. :param area_code_geomatch: Whether to enable [Area Code Geomatch](https://www.twilio.com/docs/messaging/services#area-code-geomatch) on the Service Instance. - :param validity_period: How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `14,400`. Default value is `14,400`. + :param validity_period: How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `36,000`. Default value is `36,000`. :param synchronous_validation: Reserved. :param usecase: A string that describes the scenario in which the Messaging Service will be used. Possible values are `notifications`, `marketing`, `verification`, `discussion`, `poll`, `undeclared`. :param use_inbound_webhook_on_number: A boolean value that indicates either the webhook url configured on the phone number will be used or `inbound_request_url`/`fallback_url` url will be called when a message is received from the phone number. If this field is enabled then the webhook url defined on the phone number will override the `inbound_request_url`/`fallback_url` defined for the Messaging Service. @@ -851,7 +851,7 @@ async def create_async( :param scan_message_content: :param fallback_to_long_code: [OBSOLETE] Former feature used to fallback to long code sender after certain short code message failures. :param area_code_geomatch: Whether to enable [Area Code Geomatch](https://www.twilio.com/docs/messaging/services#area-code-geomatch) on the Service Instance. - :param validity_period: How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `14,400`. Default value is `14,400`. + :param validity_period: How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `36,000`. Default value is `36,000`. :param synchronous_validation: Reserved. :param usecase: A string that describes the scenario in which the Messaging Service will be used. Possible values are `notifications`, `marketing`, `verification`, `discussion`, `poll`, `undeclared`. :param use_inbound_webhook_on_number: A boolean value that indicates either the webhook url configured on the phone number will be used or `inbound_request_url`/`fallback_url` url will be called when a message is received from the phone number. If this field is enabled then the webhook url defined on the phone number will override the `inbound_request_url`/`fallback_url` defined for the Messaging Service. diff --git a/twilio/rest/messaging/v2/channels_sender.py b/twilio/rest/messaging/v2/channels_sender.py index a6e4252dc0..16bfaefe4e 100644 --- a/twilio/rest/messaging/v2/channels_sender.py +++ b/twilio/rest/messaging/v2/channels_sender.py @@ -85,6 +85,40 @@ def to_dict(self): "websites": self.websites, } + class MessagingV2ChannelsSenderProfileResponseEmails(object): + """ + :ivar email: + :ivar label: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.email: Optional[str] = payload.get("email") + self.label: Optional[str] = payload.get("label") + + def to_dict(self): + return { + "": self.email, + "": self.label, + } + + class MessagingV2ChannelsSenderProfileResponseWebsites(object): + """ + :ivar website: + :ivar label: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.website: Optional[str] = payload.get("website") + self.label: Optional[str] = payload.get("label") + + def to_dict(self): + return { + "": self.website, + "": self.label, + } + class MessagingV2ChannelsSenderRequestsCreate(object): """ :ivar sender_id: The ID of this Sender prefixed with the channel, e.g., `whatsapp:E.164` @@ -383,6 +417,40 @@ def to_dict(self): "websites": self.websites, } + class MessagingV2ChannelsSenderProfileResponseEmails(object): + """ + :ivar email: + :ivar label: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.email: Optional[str] = payload.get("email") + self.label: Optional[str] = payload.get("label") + + def to_dict(self): + return { + "": self.email, + "": self.label, + } + + class MessagingV2ChannelsSenderProfileResponseWebsites(object): + """ + :ivar website: + :ivar label: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.website: Optional[str] = payload.get("website") + self.label: Optional[str] = payload.get("label") + + def to_dict(self): + return { + "": self.website, + "": self.label, + } + class MessagingV2ChannelsSenderRequestsCreate(object): """ :ivar sender_id: The ID of this Sender prefixed with the channel, e.g., `whatsapp:E.164` @@ -711,6 +779,40 @@ def to_dict(self): "websites": self.websites, } + class MessagingV2ChannelsSenderProfileResponseEmails(object): + """ + :ivar email: + :ivar label: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.email: Optional[str] = payload.get("email") + self.label: Optional[str] = payload.get("label") + + def to_dict(self): + return { + "": self.email, + "": self.label, + } + + class MessagingV2ChannelsSenderProfileResponseWebsites(object): + """ + :ivar website: + :ivar label: + """ + + def __init__(self, payload: Dict[str, Any]): + + self.website: Optional[str] = payload.get("website") + self.label: Optional[str] = payload.get("label") + + def to_dict(self): + return { + "": self.website, + "": self.label, + } + class MessagingV2ChannelsSenderRequestsCreate(object): """ :ivar sender_id: The ID of this Sender prefixed with the channel, e.g., `whatsapp:E.164` diff --git a/twilio/rest/numbers/v1/__init__.py b/twilio/rest/numbers/v1/__init__.py index 043364c3d5..68f078a88d 100644 --- a/twilio/rest/numbers/v1/__init__.py +++ b/twilio/rest/numbers/v1/__init__.py @@ -28,12 +28,10 @@ from twilio.rest.numbers.v1.porting_webhook_configuration_delete import ( PortingWebhookConfigurationDeleteList, ) -from twilio.rest.numbers.v1.porting_webhook_configuration_fetch import ( - PortingWebhookConfigurationFetchList, -) from twilio.rest.numbers.v1.signing_request_configuration import ( SigningRequestConfigurationList, ) +from twilio.rest.numbers.v1.webhook import WebhookList class V1(Version): @@ -58,12 +56,10 @@ def __init__(self, domain: Domain): self._porting_webhook_configurations_delete: Optional[ PortingWebhookConfigurationDeleteList ] = None - self._porting_webhook_configuration_fetch: Optional[ - PortingWebhookConfigurationFetchList - ] = None self._signing_request_configurations: Optional[ SigningRequestConfigurationList ] = None + self._webhook: Optional[WebhookList] = None @property def bulk_eligibilities(self) -> BulkEligibilityList: @@ -111,22 +107,18 @@ def porting_webhook_configurations_delete( ) return self._porting_webhook_configurations_delete - @property - def porting_webhook_configuration_fetch( - self, - ) -> PortingWebhookConfigurationFetchList: - if self._porting_webhook_configuration_fetch is None: - self._porting_webhook_configuration_fetch = ( - PortingWebhookConfigurationFetchList(self) - ) - return self._porting_webhook_configuration_fetch - @property def signing_request_configurations(self) -> SigningRequestConfigurationList: if self._signing_request_configurations is None: self._signing_request_configurations = SigningRequestConfigurationList(self) return self._signing_request_configurations + @property + def webhook(self) -> WebhookList: + if self._webhook is None: + self._webhook = WebhookList(self) + return self._webhook + def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py b/twilio/rest/numbers/v1/webhook.py similarity index 78% rename from twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py rename to twilio/rest/numbers/v1/webhook.py index 5d381768c7..69bd556326 100644 --- a/twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py +++ b/twilio/rest/numbers/v1/webhook.py @@ -21,7 +21,7 @@ from twilio.base.version import Version -class PortingWebhookConfigurationFetchInstance(InstanceResource): +class WebhookInstance(InstanceResource): """ :ivar url: The URL of the webhook configuration request :ivar port_in_target_url: The complete webhook url that will be called when a notification event for port in request or port in phone number happens @@ -52,14 +52,14 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" -class PortingWebhookConfigurationFetchList(ListResource): +class WebhookList(ListResource): def __init__(self, version: Version): """ - Initialize the PortingWebhookConfigurationFetchList + Initialize the WebhookList :param version: Version that contains the resource @@ -68,12 +68,12 @@ def __init__(self, version: Version): self._uri = "/Porting/Configuration/Webhook" - def fetch(self) -> PortingWebhookConfigurationFetchInstance: + def fetch(self) -> WebhookInstance: """ - Asynchronously fetch the PortingWebhookConfigurationFetchInstance + Asynchronously fetch the WebhookInstance - :returns: The fetched PortingWebhookConfigurationFetchInstance + :returns: The fetched WebhookInstance """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -81,14 +81,14 @@ def fetch(self) -> PortingWebhookConfigurationFetchInstance: payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) - return PortingWebhookConfigurationFetchInstance(self._version, payload) + return WebhookInstance(self._version, payload) - async def fetch_async(self) -> PortingWebhookConfigurationFetchInstance: + async def fetch_async(self) -> WebhookInstance: """ - Asynchronously fetch the PortingWebhookConfigurationFetchInstance + Asynchronously fetch the WebhookInstance - :returns: The fetched PortingWebhookConfigurationFetchInstance + :returns: The fetched WebhookInstance """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -98,7 +98,7 @@ async def fetch_async(self) -> PortingWebhookConfigurationFetchInstance: method="GET", uri=self._uri, headers=headers ) - return PortingWebhookConfigurationFetchInstance(self._version, payload) + return WebhookInstance(self._version, payload) def __repr__(self) -> str: """ @@ -106,4 +106,4 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" diff --git a/twilio/rest/proxy/v1/service/__init__.py b/twilio/rest/proxy/v1/service/__init__.py index ff1e7ed7d7..8e35536547 100644 --- a/twilio/rest/proxy/v1/service/__init__.py +++ b/twilio/rest/proxy/v1/service/__init__.py @@ -22,7 +22,6 @@ from twilio.base.page import Page from twilio.rest.proxy.v1.service.phone_number import PhoneNumberList from twilio.rest.proxy.v1.service.session import SessionList -from twilio.rest.proxy.v1.service.short_code import ShortCodeList class ServiceInstance(InstanceResource): @@ -234,13 +233,6 @@ def sessions(self) -> SessionList: """ return self._proxy.sessions - @property - def short_codes(self) -> ShortCodeList: - """ - Access the short_codes - """ - return self._proxy.short_codes - def __repr__(self) -> str: """ Provide a friendly representation @@ -270,7 +262,6 @@ def __init__(self, version: Version, sid: str): self._phone_numbers: Optional[PhoneNumberList] = None self._sessions: Optional[SessionList] = None - self._short_codes: Optional[ShortCodeList] = None def delete(self) -> bool: """ @@ -468,18 +459,6 @@ def sessions(self) -> SessionList: ) return self._sessions - @property - def short_codes(self) -> ShortCodeList: - """ - Access the short_codes - """ - if self._short_codes is None: - self._short_codes = ShortCodeList( - self._version, - self._solution["sid"], - ) - return self._short_codes - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/serverless/v1/service/environment/log.py b/twilio/rest/serverless/v1/service/environment/log.py index a3c9a6c2da..e8d9281060 100644 --- a/twilio/rest/serverless/v1/service/environment/log.py +++ b/twilio/rest/serverless/v1/service/environment/log.py @@ -23,12 +23,6 @@ class LogInstance(InstanceResource): - - class Level(object): - INFO = "info" - WARN = "warn" - ERROR = "error" - """ :ivar sid: The unique string that we created to identify the Log resource. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Log resource. @@ -38,7 +32,7 @@ class Level(object): :ivar deployment_sid: The SID of the deployment that corresponds to the log. :ivar function_sid: The SID of the function whose invocation produced the log. :ivar request_sid: The SID of the request associated with the log. - :ivar level: + :ivar level: The log level. :ivar message: The log message. :ivar date_created: The date and time in GMT when the Log resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. :ivar url: The absolute URL of the Log resource. @@ -62,7 +56,7 @@ def __init__( self.deployment_sid: Optional[str] = payload.get("deployment_sid") self.function_sid: Optional[str] = payload.get("function_sid") self.request_sid: Optional[str] = payload.get("request_sid") - self.level: Optional["LogInstance.Level"] = payload.get("level") + self.level: Optional[str] = payload.get("level") self.message: Optional[str] = payload.get("message") self.date_created: Optional[datetime] = deserialize.iso8601_datetime( payload.get("date_created") diff --git a/twilio/rest/taskrouter/v1/workspace/task/__init__.py b/twilio/rest/taskrouter/v1/workspace/task/__init__.py index 2c4516df77..e7560a66e8 100644 --- a/twilio/rest/taskrouter/v1/workspace/task/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/task/__init__.py @@ -553,7 +553,7 @@ def create( :param priority: The priority to assign the new task and override the default. When supplied, the new Task will have this priority unless it matches a Workflow Target with a Priority set. When not supplied, the new Task will have the priority of the matching Workflow Target. Value can be 0 to 2^31^ (2,147,483,647). :param task_channel: When MultiTasking is enabled, specify the TaskChannel by passing either its `unique_name` or `sid`. Default value is `default`. :param workflow_sid: The SID of the Workflow that you would like to handle routing for the new Task. If there is only one Workflow defined for the Workspace that you are posting the new task to, this parameter is optional. - :param attributes: A URL-encoded JSON string with the attributes of the new task. This value is passed to the Workflow's `assignment_callback_url` when the Task is assigned to a Worker. For example: `{ \\\"task_type\\\": \\\"call\\\", \\\"twilio_call_sid\\\": \\\"CAxxx\\\", \\\"customer_ticket_number\\\": \\\"12345\\\" }`. + :param attributes: A JSON string with the attributes of the new task. This value is passed to the Workflow's `assignment_callback_url` when the Task is assigned to a Worker. For example: `{ \\\"task_type\\\": \\\"call\\\", \\\"twilio_call_sid\\\": \\\"CAxxx\\\", \\\"customer_ticket_number\\\": \\\"12345\\\" }`. :param virtual_start_time: The virtual start time to assign the new task and override the default. When supplied, the new task will have this virtual start time. When not supplied, the new task will have the virtual start time equal to `date_created`. Value can't be in the future or before the year of 1900. :param routing_target: A SID of a Worker, Queue, or Workflow to route a Task to :param ignore_capacity: A boolean that indicates if the Task should respect a Worker's capacity and availability during assignment. This field can only be used when the `RoutingTarget` field is set to a Worker SID. By setting `IgnoreCapacity` to a value of `true`, `1`, or `yes`, the Task will be routed to the Worker without respecting their capacity and availability. Any other value will enforce the Worker's capacity and availability. The default value of `IgnoreCapacity` is `true` when the `RoutingTarget` is set to a Worker SID. @@ -608,7 +608,7 @@ async def create_async( :param priority: The priority to assign the new task and override the default. When supplied, the new Task will have this priority unless it matches a Workflow Target with a Priority set. When not supplied, the new Task will have the priority of the matching Workflow Target. Value can be 0 to 2^31^ (2,147,483,647). :param task_channel: When MultiTasking is enabled, specify the TaskChannel by passing either its `unique_name` or `sid`. Default value is `default`. :param workflow_sid: The SID of the Workflow that you would like to handle routing for the new Task. If there is only one Workflow defined for the Workspace that you are posting the new task to, this parameter is optional. - :param attributes: A URL-encoded JSON string with the attributes of the new task. This value is passed to the Workflow's `assignment_callback_url` when the Task is assigned to a Worker. For example: `{ \\\"task_type\\\": \\\"call\\\", \\\"twilio_call_sid\\\": \\\"CAxxx\\\", \\\"customer_ticket_number\\\": \\\"12345\\\" }`. + :param attributes: A JSON string with the attributes of the new task. This value is passed to the Workflow's `assignment_callback_url` when the Task is assigned to a Worker. For example: `{ \\\"task_type\\\": \\\"call\\\", \\\"twilio_call_sid\\\": \\\"CAxxx\\\", \\\"customer_ticket_number\\\": \\\"12345\\\" }`. :param virtual_start_time: The virtual start time to assign the new task and override the default. When supplied, the new task will have this virtual start time. When not supplied, the new task will have the virtual start time equal to `date_created`. Value can't be in the future or before the year of 1900. :param routing_target: A SID of a Worker, Queue, or Workflow to route a Task to :param ignore_capacity: A boolean that indicates if the Task should respect a Worker's capacity and availability during assignment. This field can only be used when the `RoutingTarget` field is set to a Worker SID. By setting `IgnoreCapacity` to a value of `true`, `1`, or `yes`, the Task will be routed to the Worker without respecting their capacity and availability. Any other value will enforce the Worker's capacity and availability. The default value of `IgnoreCapacity` is `true` when the `RoutingTarget` is set to a Worker SID. diff --git a/twilio/rest/trunking/v1/trunk/__init__.py b/twilio/rest/trunking/v1/trunk/__init__.py index 6a93a83233..8d6898fe14 100644 --- a/twilio/rest/trunking/v1/trunk/__init__.py +++ b/twilio/rest/trunking/v1/trunk/__init__.py @@ -50,6 +50,7 @@ class TransferSetting(object): :ivar transfer_caller_id: :ivar cnam_lookup_enabled: Whether Caller ID Name (CNAM) lookup is enabled for the trunk. If enabled, all inbound calls to the SIP Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See [CNAM Lookups](https://www.twilio.com/docs/sip-trunking#CNAM) for more information. :ivar auth_type: The types of authentication mapped to the domain. Can be: `IP_ACL` and `CREDENTIAL_LIST`. If both are mapped, the values are returned in a comma delimited list. If empty, the domain will not receive any traffic. + :ivar symmetric_rtp_enabled: Whether Symmetric RTP is enabled for the trunk. When Symmetric RTP is disabled, Twilio will send RTP to the destination negotiated in the SDP. Disabling Symmetric RTP is considered to be more secure and therefore recommended. See [Symmetric RTP](https://www.twilio.com/docs/sip-trunking#symmetric-rtp) for more information. :ivar auth_type_set: Reserved. :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. @@ -80,6 +81,9 @@ def __init__( ) self.cnam_lookup_enabled: Optional[bool] = payload.get("cnam_lookup_enabled") self.auth_type: Optional[str] = payload.get("auth_type") + self.symmetric_rtp_enabled: Optional[bool] = payload.get( + "symmetric_rtp_enabled" + ) self.auth_type_set: Optional[List[str]] = payload.get("auth_type_set") self.date_created: Optional[datetime] = deserialize.iso8601_datetime( payload.get("date_created") diff --git a/twilio/rest/verify/v2/verification_attempt.py b/twilio/rest/verify/v2/verification_attempt.py index 129a65a5fb..8014924567 100644 --- a/twilio/rest/verify/v2/verification_attempt.py +++ b/twilio/rest/verify/v2/verification_attempt.py @@ -30,7 +30,6 @@ class Channels(object): EMAIL = "email" WHATSAPP = "whatsapp" RBM = "rbm" - SNA = "sna" class ConversionStatus(object): CONVERTED = "converted" @@ -249,7 +248,7 @@ def stream( :param datetime date_created_before: Datetime filter used to consider only Verification Attempts created before this datetime on the summary aggregation. Given as GMT in ISO 8601 formatted datetime string: yyyy-MM-dd'T'HH:mm:ss'Z. :param str channel_data_to: Destination of a verification. It is phone number in E.164 format. :param str country: Filter used to query Verification Attempts sent to the specified destination country. - :param "VerificationAttemptInstance.Channels" channel: Filter used to query Verification Attempts by communication channel. Valid values are `SMS` and `CALL` + :param "VerificationAttemptInstance.Channels" channel: Filter used to query Verification Attempts by communication channel. :param str verify_service_sid: Filter used to query Verification Attempts by verify service. Only attempts of the provided SID will be returned. :param str verification_sid: Filter used to return all the Verification Attempts of a single verification. Only attempts of the provided verification SID will be returned. :param "VerificationAttemptInstance.ConversionStatus" status: Filter used to query Verification Attempts by conversion status. Valid values are `UNCONVERTED`, for attempts that were not converted, and `CONVERTED`, for attempts that were confirmed. @@ -302,7 +301,7 @@ async def stream_async( :param datetime date_created_before: Datetime filter used to consider only Verification Attempts created before this datetime on the summary aggregation. Given as GMT in ISO 8601 formatted datetime string: yyyy-MM-dd'T'HH:mm:ss'Z. :param str channel_data_to: Destination of a verification. It is phone number in E.164 format. :param str country: Filter used to query Verification Attempts sent to the specified destination country. - :param "VerificationAttemptInstance.Channels" channel: Filter used to query Verification Attempts by communication channel. Valid values are `SMS` and `CALL` + :param "VerificationAttemptInstance.Channels" channel: Filter used to query Verification Attempts by communication channel. :param str verify_service_sid: Filter used to query Verification Attempts by verify service. Only attempts of the provided SID will be returned. :param str verification_sid: Filter used to return all the Verification Attempts of a single verification. Only attempts of the provided verification SID will be returned. :param "VerificationAttemptInstance.ConversionStatus" status: Filter used to query Verification Attempts by conversion status. Valid values are `UNCONVERTED`, for attempts that were not converted, and `CONVERTED`, for attempts that were confirmed. @@ -354,7 +353,7 @@ def list( :param datetime date_created_before: Datetime filter used to consider only Verification Attempts created before this datetime on the summary aggregation. Given as GMT in ISO 8601 formatted datetime string: yyyy-MM-dd'T'HH:mm:ss'Z. :param str channel_data_to: Destination of a verification. It is phone number in E.164 format. :param str country: Filter used to query Verification Attempts sent to the specified destination country. - :param "VerificationAttemptInstance.Channels" channel: Filter used to query Verification Attempts by communication channel. Valid values are `SMS` and `CALL` + :param "VerificationAttemptInstance.Channels" channel: Filter used to query Verification Attempts by communication channel. :param str verify_service_sid: Filter used to query Verification Attempts by verify service. Only attempts of the provided SID will be returned. :param str verification_sid: Filter used to return all the Verification Attempts of a single verification. Only attempts of the provided verification SID will be returned. :param "VerificationAttemptInstance.ConversionStatus" status: Filter used to query Verification Attempts by conversion status. Valid values are `UNCONVERTED`, for attempts that were not converted, and `CONVERTED`, for attempts that were confirmed. @@ -406,7 +405,7 @@ async def list_async( :param datetime date_created_before: Datetime filter used to consider only Verification Attempts created before this datetime on the summary aggregation. Given as GMT in ISO 8601 formatted datetime string: yyyy-MM-dd'T'HH:mm:ss'Z. :param str channel_data_to: Destination of a verification. It is phone number in E.164 format. :param str country: Filter used to query Verification Attempts sent to the specified destination country. - :param "VerificationAttemptInstance.Channels" channel: Filter used to query Verification Attempts by communication channel. Valid values are `SMS` and `CALL` + :param "VerificationAttemptInstance.Channels" channel: Filter used to query Verification Attempts by communication channel. :param str verify_service_sid: Filter used to query Verification Attempts by verify service. Only attempts of the provided SID will be returned. :param str verification_sid: Filter used to return all the Verification Attempts of a single verification. Only attempts of the provided verification SID will be returned. :param "VerificationAttemptInstance.ConversionStatus" status: Filter used to query Verification Attempts by conversion status. Valid values are `UNCONVERTED`, for attempts that were not converted, and `CONVERTED`, for attempts that were confirmed. @@ -459,7 +458,7 @@ def page( :param date_created_before: Datetime filter used to consider only Verification Attempts created before this datetime on the summary aggregation. Given as GMT in ISO 8601 formatted datetime string: yyyy-MM-dd'T'HH:mm:ss'Z. :param channel_data_to: Destination of a verification. It is phone number in E.164 format. :param country: Filter used to query Verification Attempts sent to the specified destination country. - :param channel: Filter used to query Verification Attempts by communication channel. Valid values are `SMS` and `CALL` + :param channel: Filter used to query Verification Attempts by communication channel. :param verify_service_sid: Filter used to query Verification Attempts by verify service. Only attempts of the provided SID will be returned. :param verification_sid: Filter used to return all the Verification Attempts of a single verification. Only attempts of the provided verification SID will be returned. :param status: Filter used to query Verification Attempts by conversion status. Valid values are `UNCONVERTED`, for attempts that were not converted, and `CONVERTED`, for attempts that were confirmed. @@ -518,7 +517,7 @@ async def page_async( :param date_created_before: Datetime filter used to consider only Verification Attempts created before this datetime on the summary aggregation. Given as GMT in ISO 8601 formatted datetime string: yyyy-MM-dd'T'HH:mm:ss'Z. :param channel_data_to: Destination of a verification. It is phone number in E.164 format. :param country: Filter used to query Verification Attempts sent to the specified destination country. - :param channel: Filter used to query Verification Attempts by communication channel. Valid values are `SMS` and `CALL` + :param channel: Filter used to query Verification Attempts by communication channel. :param verify_service_sid: Filter used to query Verification Attempts by verify service. Only attempts of the provided SID will be returned. :param verification_sid: Filter used to return all the Verification Attempts of a single verification. Only attempts of the provided verification SID will be returned. :param status: Filter used to query Verification Attempts by conversion status. Valid values are `UNCONVERTED`, for attempts that were not converted, and `CONVERTED`, for attempts that were confirmed. diff --git a/twilio/rest/verify/v2/verification_attempts_summary.py b/twilio/rest/verify/v2/verification_attempts_summary.py index d662cf8f55..7c9c22b76b 100644 --- a/twilio/rest/verify/v2/verification_attempts_summary.py +++ b/twilio/rest/verify/v2/verification_attempts_summary.py @@ -28,6 +28,7 @@ class Channels(object): CALL = "call" EMAIL = "email" WHATSAPP = "whatsapp" + RBM = "rbm" """ :ivar total_attempts: Total of attempts made according to the provided filters @@ -88,7 +89,7 @@ def fetch( :param date_created_after: Datetime filter used to consider only Verification Attempts created after this datetime on the summary aggregation. Given as GMT in ISO 8601 formatted datetime string: yyyy-MM-dd'T'HH:mm:ss'Z. :param date_created_before: Datetime filter used to consider only Verification Attempts created before this datetime on the summary aggregation. Given as GMT in ISO 8601 formatted datetime string: yyyy-MM-dd'T'HH:mm:ss'Z. :param country: Filter used to consider only Verification Attempts sent to the specified destination country on the summary aggregation. - :param channel: Filter Verification Attempts considered on the summary aggregation by communication channel. Valid values are `SMS`, `CALL` and `WHATSAPP` + :param channel: Filter Verification Attempts considered on the summary aggregation by communication channel. :param destination_prefix: Filter the Verification Attempts considered on the summary aggregation by Destination prefix. It is the prefix of a phone number in E.164 format. :returns: The fetched VerificationAttemptsSummaryInstance @@ -120,7 +121,7 @@ async def fetch_async( :param date_created_after: Datetime filter used to consider only Verification Attempts created after this datetime on the summary aggregation. Given as GMT in ISO 8601 formatted datetime string: yyyy-MM-dd'T'HH:mm:ss'Z. :param date_created_before: Datetime filter used to consider only Verification Attempts created before this datetime on the summary aggregation. Given as GMT in ISO 8601 formatted datetime string: yyyy-MM-dd'T'HH:mm:ss'Z. :param country: Filter used to consider only Verification Attempts sent to the specified destination country on the summary aggregation. - :param channel: Filter Verification Attempts considered on the summary aggregation by communication channel. Valid values are `SMS`, `CALL` and `WHATSAPP` + :param channel: Filter Verification Attempts considered on the summary aggregation by communication channel. :param destination_prefix: Filter the Verification Attempts considered on the summary aggregation by Destination prefix. It is the prefix of a phone number in E.164 format. :returns: The fetched VerificationAttemptsSummaryInstance @@ -174,7 +175,7 @@ def fetch( :param date_created_after: Datetime filter used to consider only Verification Attempts created after this datetime on the summary aggregation. Given as GMT in ISO 8601 formatted datetime string: yyyy-MM-dd'T'HH:mm:ss'Z. :param date_created_before: Datetime filter used to consider only Verification Attempts created before this datetime on the summary aggregation. Given as GMT in ISO 8601 formatted datetime string: yyyy-MM-dd'T'HH:mm:ss'Z. :param country: Filter used to consider only Verification Attempts sent to the specified destination country on the summary aggregation. - :param channel: Filter Verification Attempts considered on the summary aggregation by communication channel. Valid values are `SMS`, `CALL` and `WHATSAPP` + :param channel: Filter Verification Attempts considered on the summary aggregation by communication channel. :param destination_prefix: Filter the Verification Attempts considered on the summary aggregation by Destination prefix. It is the prefix of a phone number in E.164 format. :returns: The fetched VerificationAttemptsSummaryInstance @@ -222,7 +223,7 @@ async def fetch_async( :param date_created_after: Datetime filter used to consider only Verification Attempts created after this datetime on the summary aggregation. Given as GMT in ISO 8601 formatted datetime string: yyyy-MM-dd'T'HH:mm:ss'Z. :param date_created_before: Datetime filter used to consider only Verification Attempts created before this datetime on the summary aggregation. Given as GMT in ISO 8601 formatted datetime string: yyyy-MM-dd'T'HH:mm:ss'Z. :param country: Filter used to consider only Verification Attempts sent to the specified destination country on the summary aggregation. - :param channel: Filter Verification Attempts considered on the summary aggregation by communication channel. Valid values are `SMS`, `CALL` and `WHATSAPP` + :param channel: Filter Verification Attempts considered on the summary aggregation by communication channel. :param destination_prefix: Filter the Verification Attempts considered on the summary aggregation by Destination prefix. It is the prefix of a phone number in E.164 format. :returns: The fetched VerificationAttemptsSummaryInstance diff --git a/twilio/rest/video/v1/room/__init__.py b/twilio/rest/video/v1/room/__init__.py index d51b8b8711..12854e9bfe 100644 --- a/twilio/rest/video/v1/room/__init__.py +++ b/twilio/rest/video/v1/room/__init__.py @@ -23,6 +23,7 @@ from twilio.rest.video.v1.room.participant import ParticipantList from twilio.rest.video.v1.room.recording_rules import RecordingRulesList from twilio.rest.video.v1.room.room_recording import RoomRecordingList +from twilio.rest.video.v1.room.transcriptions import TranscriptionsList class RoomInstance(InstanceResource): @@ -204,6 +205,13 @@ def recordings(self) -> RoomRecordingList: """ return self._proxy.recordings + @property + def transcriptions(self) -> TranscriptionsList: + """ + Access the transcriptions + """ + return self._proxy.transcriptions + def __repr__(self) -> str: """ Provide a friendly representation @@ -234,6 +242,7 @@ def __init__(self, version: Version, sid: str): self._participants: Optional[ParticipantList] = None self._recording_rules: Optional[RecordingRulesList] = None self._recordings: Optional[RoomRecordingList] = None + self._transcriptions: Optional[TranscriptionsList] = None def fetch(self) -> RoomInstance: """ @@ -365,6 +374,18 @@ def recordings(self) -> RoomRecordingList: ) return self._recordings + @property + def transcriptions(self) -> TranscriptionsList: + """ + Access the transcriptions + """ + if self._transcriptions is None: + self._transcriptions = TranscriptionsList( + self._version, + self._solution["sid"], + ) + return self._transcriptions + def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/proxy/v1/service/short_code.py b/twilio/rest/video/v1/room/transcriptions.py similarity index 53% rename from twilio/rest/proxy/v1/service/short_code.py rename to twilio/rest/video/v1/room/transcriptions.py index df71d4bdd5..393f6b13ed 100644 --- a/twilio/rest/proxy/v1/service/short_code.py +++ b/twilio/rest/video/v1/room/transcriptions.py @@ -4,7 +4,7 @@ | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - Twilio - Proxy + Twilio - Video This is the public Twilio REST API. NOTE: This class is auto generated by OpenAPI Generator. @@ -22,128 +22,123 @@ from twilio.base.page import Page -class ShortCodeInstance(InstanceResource): +class TranscriptionsInstance(InstanceResource): + + class Status(object): + CREATED = "created" + STARTED = "started" + STOPPED = "stopped" + FAILED = "failed" + """ - :ivar sid: The unique string that we created to identify the ShortCode resource. - :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ShortCode resource. - :ivar service_sid: The SID of the ShortCode resource's parent [Service](https://www.twilio.com/docs/proxy/api/service) resource. - :ivar date_created: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was created. - :ivar date_updated: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was last updated. - :ivar short_code: The short code's number. - :ivar iso_country: The ISO Country Code for the short code. - :ivar capabilities: - :ivar url: The absolute URL of the ShortCode resource. - :ivar is_reserved: Whether the short code should be reserved and not be assigned to a participant using proxy pool logic. See [Reserved Phone Numbers](https://www.twilio.com/docs/proxy/reserved-phone-numbers) for more information. + :ivar ttid: The unique string that we created to identify the transcriptions resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Room resource. + :ivar room_sid: The SID of the transcriptions's room. + :ivar status: + :ivar identity: The application-defined string that uniquely identifies the resource's User within a Room. If a client joins with an existing Identity, the existing client is disconnected. See [access tokens](https://www.twilio.com/docs/video/tutorials/user-identity-access-tokens) and [limits](https://www.twilio.com/docs/video/programmable-video-limits) for more info. + :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 start_time: The time of transcriptions connected to the room in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. + :ivar end_time: The time when the transcriptions disconnected from the room in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. + :ivar duration: The duration in seconds that the transcriptions were `connected`. Populated only after the transcriptions is `stopped`. + :ivar url: The absolute URL of the resource. """ def __init__( self, version: Version, payload: Dict[str, Any], - service_sid: str, - sid: Optional[str] = None, + room_sid: str, + ttid: Optional[str] = None, ): super().__init__(version) - self.sid: Optional[str] = payload.get("sid") + self.ttid: Optional[str] = payload.get("ttid") self.account_sid: Optional[str] = payload.get("account_sid") - self.service_sid: Optional[str] = payload.get("service_sid") + self.room_sid: Optional[str] = payload.get("room_sid") + self.status: Optional["TranscriptionsInstance.Status"] = payload.get("status") + self.identity: Optional[str] = payload.get("identity") self.date_created: Optional[datetime] = deserialize.iso8601_datetime( payload.get("date_created") ) self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( payload.get("date_updated") ) - self.short_code: Optional[str] = payload.get("short_code") - self.iso_country: Optional[str] = payload.get("iso_country") - self.capabilities: Optional[str] = payload.get("capabilities") + self.start_time: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("start_time") + ) + self.end_time: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("end_time") + ) + self.duration: Optional[int] = deserialize.integer(payload.get("duration")) self.url: Optional[str] = payload.get("url") - self.is_reserved: Optional[bool] = payload.get("is_reserved") self._solution = { - "service_sid": service_sid, - "sid": sid or self.sid, + "room_sid": room_sid, + "ttid": ttid or self.ttid, } - self._context: Optional[ShortCodeContext] = None + self._context: Optional[TranscriptionsContext] = None @property - def _proxy(self) -> "ShortCodeContext": + def _proxy(self) -> "TranscriptionsContext": """ Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context - :returns: ShortCodeContext for this ShortCodeInstance + :returns: TranscriptionsContext for this TranscriptionsInstance """ if self._context is None: - self._context = ShortCodeContext( + self._context = TranscriptionsContext( self._version, - service_sid=self._solution["service_sid"], - sid=self._solution["sid"], + room_sid=self._solution["room_sid"], + ttid=self._solution["ttid"], ) return self._context - def delete(self) -> bool: - """ - Deletes the ShortCodeInstance - - - :returns: True if delete succeeds, False otherwise - """ - return self._proxy.delete() - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the ShortCodeInstance - - - :returns: True if delete succeeds, False otherwise + def fetch(self) -> "TranscriptionsInstance": """ - return await self._proxy.delete_async() - - def fetch(self) -> "ShortCodeInstance": - """ - Fetch the ShortCodeInstance + Fetch the TranscriptionsInstance - :returns: The fetched ShortCodeInstance + :returns: The fetched TranscriptionsInstance """ return self._proxy.fetch() - async def fetch_async(self) -> "ShortCodeInstance": + async def fetch_async(self) -> "TranscriptionsInstance": """ - Asynchronous coroutine to fetch the ShortCodeInstance + Asynchronous coroutine to fetch the TranscriptionsInstance - :returns: The fetched ShortCodeInstance + :returns: The fetched TranscriptionsInstance """ return await self._proxy.fetch_async() def update( - self, is_reserved: Union[bool, object] = values.unset - ) -> "ShortCodeInstance": + self, status: Union["TranscriptionsInstance.Status", object] = values.unset + ) -> "TranscriptionsInstance": """ - Update the ShortCodeInstance + Update the TranscriptionsInstance - :param is_reserved: Whether the short code should be reserved and not be assigned to a participant using proxy pool logic. See [Reserved Phone Numbers](https://www.twilio.com/docs/proxy/reserved-phone-numbers) for more information. + :param status: - :returns: The updated ShortCodeInstance + :returns: The updated TranscriptionsInstance """ return self._proxy.update( - is_reserved=is_reserved, + status=status, ) async def update_async( - self, is_reserved: Union[bool, object] = values.unset - ) -> "ShortCodeInstance": + self, status: Union["TranscriptionsInstance.Status", object] = values.unset + ) -> "TranscriptionsInstance": """ - Asynchronous coroutine to update the ShortCodeInstance + Asynchronous coroutine to update the TranscriptionsInstance - :param is_reserved: Whether the short code should be reserved and not be assigned to a participant using proxy pool logic. See [Reserved Phone Numbers](https://www.twilio.com/docs/proxy/reserved-phone-numbers) for more information. + :param status: - :returns: The updated ShortCodeInstance + :returns: The updated TranscriptionsInstance """ return await self._proxy.update_async( - is_reserved=is_reserved, + status=status, ) def __repr__(self) -> str: @@ -153,60 +148,34 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) - return "".format(context) + return "".format(context) -class ShortCodeContext(InstanceContext): +class TranscriptionsContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): + def __init__(self, version: Version, room_sid: str, ttid: str): """ - Initialize the ShortCodeContext + Initialize the TranscriptionsContext :param version: Version that contains the resource - :param service_sid: The SID of the parent [Service](https://www.twilio.com/docs/proxy/api/service) of the resource to update. - :param sid: The Twilio-provided string that uniquely identifies the ShortCode resource to update. + :param room_sid: The SID of the room with the transcriptions resource to update. + :param ttid: The Twilio type id of the transcriptions resource to update. """ super().__init__(version) # Path Solution self._solution = { - "service_sid": service_sid, - "sid": sid, + "room_sid": room_sid, + "ttid": ttid, } - self._uri = "/Services/{service_sid}/ShortCodes/{sid}".format(**self._solution) - - def delete(self) -> bool: - """ - Deletes the ShortCodeInstance - - - :returns: True if delete succeeds, False otherwise - """ - - headers = values.of({}) - - return self._version.delete(method="DELETE", uri=self._uri, headers=headers) - - async def delete_async(self) -> bool: - """ - Asynchronous coroutine that deletes the ShortCodeInstance - - - :returns: True if delete succeeds, False otherwise - """ - - headers = values.of({}) - - return await self._version.delete_async( - method="DELETE", uri=self._uri, headers=headers - ) + self._uri = "/Rooms/{room_sid}/Transcriptions/{ttid}".format(**self._solution) - def fetch(self) -> ShortCodeInstance: + def fetch(self) -> TranscriptionsInstance: """ - Fetch the ShortCodeInstance + Fetch the TranscriptionsInstance - :returns: The fetched ShortCodeInstance + :returns: The fetched TranscriptionsInstance """ headers = values.of({}) @@ -215,19 +184,19 @@ def fetch(self) -> ShortCodeInstance: payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) - return ShortCodeInstance( + return TranscriptionsInstance( self._version, payload, - service_sid=self._solution["service_sid"], - sid=self._solution["sid"], + room_sid=self._solution["room_sid"], + ttid=self._solution["ttid"], ) - async def fetch_async(self) -> ShortCodeInstance: + async def fetch_async(self) -> TranscriptionsInstance: """ - Asynchronous coroutine to fetch the ShortCodeInstance + Asynchronous coroutine to fetch the TranscriptionsInstance - :returns: The fetched ShortCodeInstance + :returns: The fetched TranscriptionsInstance """ headers = values.of({}) @@ -238,27 +207,27 @@ async def fetch_async(self) -> ShortCodeInstance: method="GET", uri=self._uri, headers=headers ) - return ShortCodeInstance( + return TranscriptionsInstance( self._version, payload, - service_sid=self._solution["service_sid"], - sid=self._solution["sid"], + room_sid=self._solution["room_sid"], + ttid=self._solution["ttid"], ) def update( - self, is_reserved: Union[bool, object] = values.unset - ) -> ShortCodeInstance: + self, status: Union["TranscriptionsInstance.Status", object] = values.unset + ) -> TranscriptionsInstance: """ - Update the ShortCodeInstance + Update the TranscriptionsInstance - :param is_reserved: Whether the short code should be reserved and not be assigned to a participant using proxy pool logic. See [Reserved Phone Numbers](https://www.twilio.com/docs/proxy/reserved-phone-numbers) for more information. + :param status: - :returns: The updated ShortCodeInstance + :returns: The updated TranscriptionsInstance """ data = values.of( { - "IsReserved": serialize.boolean_to_string(is_reserved), + "Status": status, } ) headers = values.of({}) @@ -271,27 +240,27 @@ def update( method="POST", uri=self._uri, data=data, headers=headers ) - return ShortCodeInstance( + return TranscriptionsInstance( self._version, payload, - service_sid=self._solution["service_sid"], - sid=self._solution["sid"], + room_sid=self._solution["room_sid"], + ttid=self._solution["ttid"], ) async def update_async( - self, is_reserved: Union[bool, object] = values.unset - ) -> ShortCodeInstance: + self, status: Union["TranscriptionsInstance.Status", object] = values.unset + ) -> TranscriptionsInstance: """ - Asynchronous coroutine to update the ShortCodeInstance + Asynchronous coroutine to update the TranscriptionsInstance - :param is_reserved: Whether the short code should be reserved and not be assigned to a participant using proxy pool logic. See [Reserved Phone Numbers](https://www.twilio.com/docs/proxy/reserved-phone-numbers) for more information. + :param status: - :returns: The updated ShortCodeInstance + :returns: The updated TranscriptionsInstance """ data = values.of( { - "IsReserved": serialize.boolean_to_string(is_reserved), + "Status": status, } ) headers = values.of({}) @@ -304,11 +273,11 @@ async def update_async( method="POST", uri=self._uri, data=data, headers=headers ) - return ShortCodeInstance( + return TranscriptionsInstance( self._version, payload, - service_sid=self._solution["service_sid"], - sid=self._solution["sid"], + room_sid=self._solution["room_sid"], + ttid=self._solution["ttid"], ) def __repr__(self) -> str: @@ -318,19 +287,19 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) - return "".format(context) + return "".format(context) -class ShortCodePage(Page): +class TranscriptionsPage(Page): - def get_instance(self, payload: Dict[str, Any]) -> ShortCodeInstance: + def get_instance(self, payload: Dict[str, Any]) -> TranscriptionsInstance: """ - Build an instance of ShortCodeInstance + Build an instance of TranscriptionsInstance :param payload: Payload response from the API """ - return ShortCodeInstance( - self._version, payload, service_sid=self._solution["service_sid"] + return TranscriptionsInstance( + self._version, payload, room_sid=self._solution["room_sid"] ) def __repr__(self) -> str: @@ -339,39 +308,41 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" -class ShortCodeList(ListResource): +class TranscriptionsList(ListResource): - def __init__(self, version: Version, service_sid: str): + def __init__(self, version: Version, room_sid: str): """ - Initialize the ShortCodeList + Initialize the TranscriptionsList :param version: Version that contains the resource - :param service_sid: The SID of the parent [Service](https://www.twilio.com/docs/proxy/api/service) to read the resources from. + :param room_sid: The SID of the room with the transcriptions resources to read. """ super().__init__(version) # Path Solution self._solution = { - "service_sid": service_sid, + "room_sid": room_sid, } - self._uri = "/Services/{service_sid}/ShortCodes".format(**self._solution) + self._uri = "/Rooms/{room_sid}/Transcriptions".format(**self._solution) - def create(self, sid: str) -> ShortCodeInstance: + def create( + self, configuration: Union[object, object] = values.unset + ) -> TranscriptionsInstance: """ - Create the ShortCodeInstance + Create the TranscriptionsInstance - :param sid: The SID of a Twilio [ShortCode](https://www.twilio.com/en-us/messaging/channels/sms/short-codes) resource that represents the short code you would like to assign to your Proxy Service. + :param configuration: A collection of properties that describe transcription behaviour. - :returns: The created ShortCodeInstance + :returns: The created TranscriptionsInstance """ data = values.of( { - "Sid": sid, + "Configuration": serialize.object(configuration), } ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -384,22 +355,24 @@ def create(self, sid: str) -> ShortCodeInstance: method="POST", uri=self._uri, data=data, headers=headers ) - return ShortCodeInstance( - self._version, payload, service_sid=self._solution["service_sid"] + return TranscriptionsInstance( + self._version, payload, room_sid=self._solution["room_sid"] ) - async def create_async(self, sid: str) -> ShortCodeInstance: + async def create_async( + self, configuration: Union[object, object] = values.unset + ) -> TranscriptionsInstance: """ - Asynchronously create the ShortCodeInstance + Asynchronously create the TranscriptionsInstance - :param sid: The SID of a Twilio [ShortCode](https://www.twilio.com/en-us/messaging/channels/sms/short-codes) resource that represents the short code you would like to assign to your Proxy Service. + :param configuration: A collection of properties that describe transcription behaviour. - :returns: The created ShortCodeInstance + :returns: The created TranscriptionsInstance """ data = values.of( { - "Sid": sid, + "Configuration": serialize.object(configuration), } ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -412,17 +385,17 @@ async def create_async(self, sid: str) -> ShortCodeInstance: method="POST", uri=self._uri, data=data, headers=headers ) - return ShortCodeInstance( - self._version, payload, service_sid=self._solution["service_sid"] + return TranscriptionsInstance( + self._version, payload, room_sid=self._solution["room_sid"] ) def stream( self, limit: Optional[int] = None, page_size: Optional[int] = None, - ) -> Iterator[ShortCodeInstance]: + ) -> Iterator[TranscriptionsInstance]: """ - Streams ShortCodeInstance records from the API as a generator stream. + Streams TranscriptionsInstance 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. @@ -445,9 +418,9 @@ async def stream_async( self, limit: Optional[int] = None, page_size: Optional[int] = None, - ) -> AsyncIterator[ShortCodeInstance]: + ) -> AsyncIterator[TranscriptionsInstance]: """ - Asynchronously streams ShortCodeInstance records from the API as a generator stream. + Asynchronously streams TranscriptionsInstance 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. @@ -470,9 +443,9 @@ def list( self, limit: Optional[int] = None, page_size: Optional[int] = None, - ) -> List[ShortCodeInstance]: + ) -> List[TranscriptionsInstance]: """ - Lists ShortCodeInstance records from the API as a list. + Lists TranscriptionsInstance records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning. @@ -496,9 +469,9 @@ async def list_async( self, limit: Optional[int] = None, page_size: Optional[int] = None, - ) -> List[ShortCodeInstance]: + ) -> List[TranscriptionsInstance]: """ - Asynchronously lists ShortCodeInstance records from the API as a list. + Asynchronously lists TranscriptionsInstance records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning. @@ -524,16 +497,16 @@ def page( page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, page_size: Union[int, object] = values.unset, - ) -> ShortCodePage: + ) -> TranscriptionsPage: """ - Retrieve a single page of ShortCodeInstance records from the API. + Retrieve a single page of TranscriptionsInstance 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 ShortCodeInstance + :returns: Page of TranscriptionsInstance """ data = values.of( { @@ -550,23 +523,23 @@ def page( response = self._version.page( method="GET", uri=self._uri, params=data, headers=headers ) - return ShortCodePage(self._version, response, self._solution) + return TranscriptionsPage(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, - ) -> ShortCodePage: + ) -> TranscriptionsPage: """ - Asynchronously retrieve a single page of ShortCodeInstance records from the API. + Asynchronously retrieve a single page of TranscriptionsInstance 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 ShortCodeInstance + :returns: Page of TranscriptionsInstance """ data = values.of( { @@ -583,50 +556,50 @@ async def page_async( response = await self._version.page_async( method="GET", uri=self._uri, params=data, headers=headers ) - return ShortCodePage(self._version, response, self._solution) + return TranscriptionsPage(self._version, response, self._solution) - def get_page(self, target_url: str) -> ShortCodePage: + def get_page(self, target_url: str) -> TranscriptionsPage: """ - Retrieve a specific page of ShortCodeInstance records from the API. + Retrieve a specific page of TranscriptionsInstance records from the API. Request is executed immediately :param target_url: API-generated URL for the requested results page - :returns: Page of ShortCodeInstance + :returns: Page of TranscriptionsInstance """ response = self._version.domain.twilio.request("GET", target_url) - return ShortCodePage(self._version, response, self._solution) + return TranscriptionsPage(self._version, response, self._solution) - async def get_page_async(self, target_url: str) -> ShortCodePage: + async def get_page_async(self, target_url: str) -> TranscriptionsPage: """ - Asynchronously retrieve a specific page of ShortCodeInstance records from the API. + Asynchronously retrieve a specific page of TranscriptionsInstance records from the API. Request is executed immediately :param target_url: API-generated URL for the requested results page - :returns: Page of ShortCodeInstance + :returns: Page of TranscriptionsInstance """ response = await self._version.domain.twilio.request_async("GET", target_url) - return ShortCodePage(self._version, response, self._solution) + return TranscriptionsPage(self._version, response, self._solution) - def get(self, sid: str) -> ShortCodeContext: + def get(self, ttid: str) -> TranscriptionsContext: """ - Constructs a ShortCodeContext + Constructs a TranscriptionsContext - :param sid: The Twilio-provided string that uniquely identifies the ShortCode resource to update. + :param ttid: The Twilio type id of the transcriptions resource to update. """ - return ShortCodeContext( - self._version, service_sid=self._solution["service_sid"], sid=sid + return TranscriptionsContext( + self._version, room_sid=self._solution["room_sid"], ttid=ttid ) - def __call__(self, sid: str) -> ShortCodeContext: + def __call__(self, ttid: str) -> TranscriptionsContext: """ - Constructs a ShortCodeContext + Constructs a TranscriptionsContext - :param sid: The Twilio-provided string that uniquely identifies the ShortCode resource to update. + :param ttid: The Twilio type id of the transcriptions resource to update. """ - return ShortCodeContext( - self._version, service_sid=self._solution["service_sid"], sid=sid + return TranscriptionsContext( + self._version, room_sid=self._solution["room_sid"], ttid=ttid ) def __repr__(self) -> str: @@ -635,4 +608,4 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" diff --git a/twilio/twiml/voice_response.py b/twilio/twiml/voice_response.py index 18078b90a3..32c31f310d 100644 --- a/twilio/twiml/voice_response.py +++ b/twilio/twiml/voice_response.py @@ -2455,6 +2455,50 @@ def application( ) ) + def whats_app( + self, + phone_number, + url=None, + method=None, + status_callback_event=None, + status_callback=None, + status_callback_method=None, + **kwargs + ): + """ + Create a element + + :param phone_number: WhatsApp Phone Number to dial + :param url: TwiML URL + :param method: TwiML URL Method + :param status_callback_event: Events to trigger status callback + :param status_callback: Status Callback URL + :param status_callback_method: Status Callback URL Method + :param kwargs: additional attributes + + :returns: element + """ + return self.nest( + WhatsApp( + phone_number, + url=url, + method=method, + status_callback_event=status_callback_event, + status_callback=status_callback, + status_callback_method=status_callback_method, + **kwargs + ) + ) + + +class WhatsApp(TwiML): + """ TwiML Noun""" + + def __init__(self, phone_number, **kwargs): + super(WhatsApp, self).__init__(**kwargs) + self.name = "WhatsApp" + self.value = phone_number + class Application(TwiML): """ TwiML Noun""" From f53fb96f7e97d30fb3ae5751d7c3543986c65123 Mon Sep 17 00:00:00 2001 From: Twilio Date: Thu, 3 Jul 2025 09:43:48 +0000 Subject: [PATCH 4/7] Release 9.6.4 --- setup.py | 2 +- twilio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 97004e4a02..42adefc3a9 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name="twilio", - version="9.6.3", + version="9.6.4", description="Twilio API client and TwiML generator", author="Twilio", help_center="https://www.twilio.com/help/contact", diff --git a/twilio/__init__.py b/twilio/__init__.py index 5ce3ed13d0..8246f24ce6 100644 --- a/twilio/__init__.py +++ b/twilio/__init__.py @@ -1,2 +1,2 @@ -__version_info__ = ("9", "6", "3") +__version_info__ = ("9", "6", "4") __version__ = ".".join(__version_info__) From f7de80113e664cd4bb626cbb566ab9f4ea45be19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carolina=20L=C3=B3pez?= Date: Fri, 4 Jul 2025 14:34:24 -0500 Subject: [PATCH 5/7] fix: delete non existing import in rest/preview (#874) --- twilio/rest/preview/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/twilio/rest/preview/__init__.py b/twilio/rest/preview/__init__.py index 501ae417d0..7a175b902a 100644 --- a/twilio/rest/preview/__init__.py +++ b/twilio/rest/preview/__init__.py @@ -7,7 +7,6 @@ from twilio.rest.preview.hosted_numbers.hosted_number_order import HostedNumberOrderList from twilio.rest.preview.marketplace.available_add_on import AvailableAddOnList from twilio.rest.preview.marketplace.installed_add_on import InstalledAddOnList -from twilio.rest.preview.sync.service import ServiceList from twilio.rest.preview.wireless.command import CommandList from twilio.rest.preview.wireless.rate_plan import RatePlanList from twilio.rest.preview.wireless.sim import SimList From e56aa286c2004df15dd85a24b5859c03efa71773 Mon Sep 17 00:00:00 2001 From: Twilio Date: Thu, 10 Jul 2025 11:47:21 +0000 Subject: [PATCH 6/7] [Librarian] Regenerated @ 39bbd47c92a659f8a7464cedcc75b92c7ba69773 f51169e3becf53bb375f9c7413aec0c78fe78fcc --- CHANGES.md | 9 +++++++ twilio/rest/lookups/v2/lookup_override.py | 20 +++++++------- twilio/rest/numbers/v1/__init__.py | 24 +++++++++++------ ...=> porting_webhook_configuration_fetch.py} | 26 +++++++++---------- twilio/rest/video/v1/room/transcriptions.py | 5 ++-- 5 files changed, 50 insertions(+), 34 deletions(-) rename twilio/rest/numbers/v1/{webhook.py => porting_webhook_configuration_fetch.py} (78%) diff --git a/CHANGES.md b/CHANGES.md index 37ae0d14b5..d6e5e522d3 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,15 @@ twilio-python Changelog Here you can see the full list of changes between each twilio-python release. +[2025-07-10] Version 9.6.5 +-------------------------- +**Library - Fix** +- [PR #874](https://github.com/twilio/twilio-python/pull/874): delete non existing import in rest/preview. Thanks to [@lopenchi](https://github.com/lopenchi)! + +**Flex** +- update team name for web_channel, webchat_init_token, webchat_refresh_token + + [2025-07-03] Version 9.6.4 -------------------------- **Library - Chore** diff --git a/twilio/rest/lookups/v2/lookup_override.py b/twilio/rest/lookups/v2/lookup_override.py index 04da72c46e..ebd566b125 100644 --- a/twilio/rest/lookups/v2/lookup_override.py +++ b/twilio/rest/lookups/v2/lookup_override.py @@ -25,8 +25,8 @@ class LookupOverrideInstance(InstanceResource): class OverridesRequest(object): """ - :ivar line_type: - :ivar reason: + :ivar line_type: The new line type to override the original line type + :ivar reason: The reason for the override """ def __init__(self, payload: Dict[str, Any]): @@ -43,12 +43,12 @@ def to_dict(self): } """ - :ivar phone_number: - :ivar original_line_type: - :ivar overridden_line_type: + :ivar phone_number: The phone number for which the override was created + :ivar original_line_type: The original line type + :ivar overridden_line_type: The new line type after the override :ivar override_reason: The reason for the override :ivar override_timestamp: - :ivar overridden_by_account_sid: The user who overrode the line type + :ivar overridden_by_account_sid: The Account SID for the user who made the override :ivar code: Twilio-specific error code :ivar message: Error message :ivar more_info: Link to Error Code References @@ -217,8 +217,8 @@ class LookupOverrideContext(InstanceContext): class OverridesRequest(object): """ - :ivar line_type: - :ivar reason: + :ivar line_type: The new line type to override the original line type + :ivar reason: The reason for the override """ def __init__(self, payload: Dict[str, Any]): @@ -451,8 +451,8 @@ class LookupOverrideList(ListResource): class OverridesRequest(object): """ - :ivar line_type: - :ivar reason: + :ivar line_type: The new line type to override the original line type + :ivar reason: The reason for the override """ def __init__(self, payload: Dict[str, Any]): diff --git a/twilio/rest/numbers/v1/__init__.py b/twilio/rest/numbers/v1/__init__.py index 68f078a88d..043364c3d5 100644 --- a/twilio/rest/numbers/v1/__init__.py +++ b/twilio/rest/numbers/v1/__init__.py @@ -28,10 +28,12 @@ from twilio.rest.numbers.v1.porting_webhook_configuration_delete import ( PortingWebhookConfigurationDeleteList, ) +from twilio.rest.numbers.v1.porting_webhook_configuration_fetch import ( + PortingWebhookConfigurationFetchList, +) from twilio.rest.numbers.v1.signing_request_configuration import ( SigningRequestConfigurationList, ) -from twilio.rest.numbers.v1.webhook import WebhookList class V1(Version): @@ -56,10 +58,12 @@ def __init__(self, domain: Domain): self._porting_webhook_configurations_delete: Optional[ PortingWebhookConfigurationDeleteList ] = None + self._porting_webhook_configuration_fetch: Optional[ + PortingWebhookConfigurationFetchList + ] = None self._signing_request_configurations: Optional[ SigningRequestConfigurationList ] = None - self._webhook: Optional[WebhookList] = None @property def bulk_eligibilities(self) -> BulkEligibilityList: @@ -107,18 +111,22 @@ def porting_webhook_configurations_delete( ) return self._porting_webhook_configurations_delete + @property + def porting_webhook_configuration_fetch( + self, + ) -> PortingWebhookConfigurationFetchList: + if self._porting_webhook_configuration_fetch is None: + self._porting_webhook_configuration_fetch = ( + PortingWebhookConfigurationFetchList(self) + ) + return self._porting_webhook_configuration_fetch + @property def signing_request_configurations(self) -> SigningRequestConfigurationList: if self._signing_request_configurations is None: self._signing_request_configurations = SigningRequestConfigurationList(self) return self._signing_request_configurations - @property - def webhook(self) -> WebhookList: - if self._webhook is None: - self._webhook = WebhookList(self) - return self._webhook - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/numbers/v1/webhook.py b/twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py similarity index 78% rename from twilio/rest/numbers/v1/webhook.py rename to twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py index 69bd556326..5d381768c7 100644 --- a/twilio/rest/numbers/v1/webhook.py +++ b/twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py @@ -21,7 +21,7 @@ from twilio.base.version import Version -class WebhookInstance(InstanceResource): +class PortingWebhookConfigurationFetchInstance(InstanceResource): """ :ivar url: The URL of the webhook configuration request :ivar port_in_target_url: The complete webhook url that will be called when a notification event for port in request or port in phone number happens @@ -52,14 +52,14 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" -class WebhookList(ListResource): +class PortingWebhookConfigurationFetchList(ListResource): def __init__(self, version: Version): """ - Initialize the WebhookList + Initialize the PortingWebhookConfigurationFetchList :param version: Version that contains the resource @@ -68,12 +68,12 @@ def __init__(self, version: Version): self._uri = "/Porting/Configuration/Webhook" - def fetch(self) -> WebhookInstance: + def fetch(self) -> PortingWebhookConfigurationFetchInstance: """ - Asynchronously fetch the WebhookInstance + Asynchronously fetch the PortingWebhookConfigurationFetchInstance - :returns: The fetched WebhookInstance + :returns: The fetched PortingWebhookConfigurationFetchInstance """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -81,14 +81,14 @@ def fetch(self) -> WebhookInstance: payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) - return WebhookInstance(self._version, payload) + return PortingWebhookConfigurationFetchInstance(self._version, payload) - async def fetch_async(self) -> WebhookInstance: + async def fetch_async(self) -> PortingWebhookConfigurationFetchInstance: """ - Asynchronously fetch the WebhookInstance + Asynchronously fetch the PortingWebhookConfigurationFetchInstance - :returns: The fetched WebhookInstance + :returns: The fetched PortingWebhookConfigurationFetchInstance """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -98,7 +98,7 @@ async def fetch_async(self) -> WebhookInstance: method="GET", uri=self._uri, headers=headers ) - return WebhookInstance(self._version, payload) + return PortingWebhookConfigurationFetchInstance(self._version, payload) def __repr__(self) -> str: """ @@ -106,4 +106,4 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" diff --git a/twilio/rest/video/v1/room/transcriptions.py b/twilio/rest/video/v1/room/transcriptions.py index 393f6b13ed..3754063038 100644 --- a/twilio/rest/video/v1/room/transcriptions.py +++ b/twilio/rest/video/v1/room/transcriptions.py @@ -25,7 +25,6 @@ class TranscriptionsInstance(InstanceResource): class Status(object): - CREATED = "created" STARTED = "started" STOPPED = "stopped" FAILED = "failed" @@ -35,13 +34,13 @@ class Status(object): :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Room resource. :ivar room_sid: The SID of the transcriptions's room. :ivar status: - :ivar identity: The application-defined string that uniquely identifies the resource's User within a Room. If a client joins with an existing Identity, the existing client is disconnected. See [access tokens](https://www.twilio.com/docs/video/tutorials/user-identity-access-tokens) and [limits](https://www.twilio.com/docs/video/programmable-video-limits) for more info. :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 start_time: The time of transcriptions connected to the room in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. :ivar end_time: The time when the transcriptions disconnected from the room in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. :ivar duration: The duration in seconds that the transcriptions were `connected`. Populated only after the transcriptions is `stopped`. :ivar url: The absolute URL of the resource. + :ivar configuration: An JSON object that describes the video layout of the composition in terms of regions. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. """ def __init__( @@ -57,7 +56,6 @@ def __init__( self.account_sid: Optional[str] = payload.get("account_sid") self.room_sid: Optional[str] = payload.get("room_sid") self.status: Optional["TranscriptionsInstance.Status"] = payload.get("status") - self.identity: Optional[str] = payload.get("identity") self.date_created: Optional[datetime] = deserialize.iso8601_datetime( payload.get("date_created") ) @@ -72,6 +70,7 @@ def __init__( ) self.duration: Optional[int] = deserialize.integer(payload.get("duration")) self.url: Optional[str] = payload.get("url") + self.configuration: Optional[Dict[str, object]] = payload.get("configuration") self._solution = { "room_sid": room_sid, From 1f43fce728760c476ece57a1e6c857eea51c73e3 Mon Sep 17 00:00:00 2001 From: Twilio Date: Thu, 10 Jul 2025 11:52:34 +0000 Subject: [PATCH 7/7] Release 9.6.5 --- setup.py | 2 +- twilio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 42adefc3a9..c2eb466aac 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name="twilio", - version="9.6.4", + version="9.6.5", description="Twilio API client and TwiML generator", author="Twilio", help_center="https://www.twilio.com/help/contact", diff --git a/twilio/__init__.py b/twilio/__init__.py index 8246f24ce6..f28471b91a 100644 --- a/twilio/__init__.py +++ b/twilio/__init__.py @@ -1,2 +1,2 @@ -__version_info__ = ("9", "6", "4") +__version_info__ = ("9", "6", "5") __version__ = ".".join(__version_info__)